Friday, April 16, 2010

ubuntu karmic grub error: "no such device" uuid/search nonsense

After cloning my recent karmic koala (9.10) install to another machine, I was annoyed that it wouldn't boot. It said:


error: no such device: ....

Failed to boot default entries.


Karmic now locates disk by UUID instead of the more traditional /dev/sda notation, which sucks when you want to clone a disk. But it's easy enough to fix.

To get it to boot once, use "e" from the grub menu to edit the command line. Remove the entire line that says:


search --no-floppy --fs-uuid --set ...


Then change the root= option in the next line to use /dev/sda1 instead of mounting by UUID:


/libux/boot/vmlinuz-... root=/dev/sda1 ro quiet splash


Then hit control-x to boot with those settings.

To fix it for good once the system boots, sudo gedit /etc/default/grub and uncomment this line:


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


Next, sudo gedit /etc/fstab and replace the UUID=... with /dev/sda1 for the / partition and /dev/sda5 for the swap partition (assuming you had ubuntu use the whole disk during install).

Finally, sudo gedit /usr/lib/grub/grub-mkconfig_lib and find this line (line 174 for me):


echo "search --no-floppy --fs-uuid --set ${fs_uuid}"


Change it to:


echo ""


Finally, sudo update-grub2 to write the changes to disk. Then cross your fingers and reboot.

5 comments:

Ted said...

Worked perfectly for me! Thanks!

Steve said...

Brilliant, worked a treat

Dan said...

Awesome - thanks for posting this!

Anonymous said...

How do I get to the "grub menu"?

My computer loads then goes to

"error: no such device: ################"
"grub rescue: "

is that menu that grub menu?

Anonymous said...

You have to be quick and hit left shift at just the right time. It often takes several tries.