Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed Ubuntu on my external hard drive but it won't boot on my laptop. What do I do?

I did some reading and traced the source of the problem to Grub2. Apparently, Grub2 doesn't use the device's UUID, and uses the linux directory instead (/dev/sdf2). This means that whenever I plug my E-HDD into a system that has a different number of drives connected to it, I won't be able to boot without editing the boot command. I don't understand it too well but that's what I got from what I read.

Is there any way to fix this?

Here's my grub config (trimmed to show example kernel entry). I have no idea why it's not using UUID. I didn't tweak it once...

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-20-generic" {
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    set quiet=1
    linux   /boot/vmlinuz-2.6.31-20-generic root=/dev/sdc2 ro   quiet splash
    initrd  /boot/initrd.img-2.6.31-20-generic
menuentry "Ubuntu, Linux 2.6.31-20-generic (recovery mode)" {
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    linux   /boot/vmlinuz-2.6.31-20-generic root=/dev/sdc2 ro single 
    initrd  /boot/initrd.img-2.6.31-20-generic
share|improve this question
I did the same and it works. Did you install the boot loader to the external or to the internal hard drive? – petersohn Apr 18 '10 at 6:43
external... i think it has something to do with it not registering the drive properly... it keeps reading sdf when there's only sda and sdc... i think my hard drive is sdc – cesar Apr 18 '10 at 6:58
ubuntu's Grub2 does use the UUID, unless you've made some tweak. please post your Grub configuration (menu.lst or grub.cfg). – quack quixote Apr 18 '10 at 11:30
i haven't tweaked anything... kind of a noob if you haven't noticed so i've been cautious so far and haven't played with any of the config files. – cesar Apr 18 '10 at 12:07
oh dear gawd, you're right, it's not using the UUID. that's very odd. which version of ubuntu are you running? i'm going to assume Ubuntu 9.10 (Karmic) based on the kernel entries. – quack quixote Apr 18 '10 at 12:27

The problem was that my was not configured properly which led to grub using the ubuntu names, e.g. sdf2, rather than the UUIDs of the hard drive. the fix was to update and then update grub2. It is done by running 'drivemap', i think, then update-grub. I'm not too sure on the command to update because i did this about a week ago, but yeah. This is just in case anyone runs into my problem.

share|improve this answer

OK, you're right that that's not grabbing UUIDs, which strikes me as odd.

Here's how a kernel entry should look (this is from my Ubuntu 9.10 VM, slightly tweaked but this should be fairly stock):

menuentry "Ubuntu, Linux 2.6.31-20-generic" {
    if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    set quiet=1
    insmod ext2
    set root=(hd0,1)
    search --no-floppy --fs-uuid --set b22c7fe9-4354-40bf-b9bf-87a469289f6e
    linux /boot/vmlinuz-2.6.31-20-generic root=UUID=b22c7fe9-4354-40bf-b9bf-87a469289f6e ro
    initrd        /boot/initrd.img-2.6.31-20-generic

The /boot/grub/grub.cfg file is generated when something runs update-grub from the scripts in /etc/grub.d and variables in file /etc/default/grub.

  • Now, there is a variable in the default file, GRUB_DISABLE_LINUX_UUID, that if set to true will give a root=/dev/sdXY value to the linux kernel line (instead of a root=UUID=... value). I don't think that's your problem, but check your /etc/default/grub file to make sure. You should see these lines (the # at the beginning of the line means it's commented out):

    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux

    If you see GRUB_DISABLE_LINUX_UUID without the # at the beginning, insert it, save the file, and run sudo update-grub to regenerate grub.cfg. Then check grub.cfg again to see if it looks right.

  • If the defaults file looks OK, next check your drive's UUIDs themselves. It's possible that the drive UUIDs aren't set correctly, or aren't getting detected correctly. uDev has the job of creating symlinks in the device tree for disk UUIDs; check them:

    $ ls -l /dev/disk/by-uuid
    total 0
    lrwxrwxrwx 1 root root 10 2010-04-18 04:15 b22c7fe9-4354-40bf-b9bf-87a469289f6e -> ../../sda1
    lrwxrwxrwx 1 root root 10 2010-04-18 04:15 e1c64ac1-186d-4c15-8833-6072ac6421df -> ../../sda5

    If this doesn't show you a partition you're expecting to see, you might need to check the filesystem directly with tune2fs (manpage) (replace /dev/sda1 with the right device name):

    $ sudo tune2fs -l /dev/sda1 | grep UUID
    Filesystem UUID:          b22c7fe9-4354-40bf-b9bf-87a469289f6e

    If this is missing, you can recreate it with:

    $ sudo tune2fs -U random /dev/sda1

    Now re-check the tune2fs -l output, and then check /dev/disks/by-uuid again. You may need to reboot before uDev picks up the changes. The update-grub scripts should now pick up the UUID, so re-run it and check the new grub.cfg to see if it looks right.

  • If none of these are panning out, you may need to dig a little deeper. Let's check our assumptions:
    • How is your boot drive partitioned? (fdisk -l)
    • How is your boot drive formatted? (ext2/3/4? FAT32? NTFS?)
    • Did you install via Wubi?
share|improve this answer isn't configured right apparently. i got ubuntu to work on my laptop but through trial-and-error (had to edit the parameters using 'e'). I know it's stupid, but is there a way to set automatically or do i have to set it manually? – cesar Apr 18 '10 at 15:52
@anonymous: yeah, i've had to do that too. i'm not sure offhand about redetecting i've had to set manually before; it's mainly used to preset the relationship between /dev/sdX and (hdX); if devices aren't listed in it, Grub will assign (hdX) dynamically at boot time. – quack quixote Apr 18 '10 at 16:01
grub ain't setting it automatically... so do i just set the things i need? right now, my external is set to sdc2... should i just set it manually as in "(hd0) sdc" – cesar Apr 18 '10 at 18:25
@anon: honestly i'm not sure. you could try with an empty and see... but i think for that to have a prayer of working you'd need to get the UUID issue fixed. there's a good Grub2 resource at ... you might look through it for some ideas. – quack quixote Apr 18 '10 at 19:53
thanks... because of that link, i'm pretty sure i managed to fix it. i'll post the fix below – cesar Apr 23 '10 at 5:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .