Fixing a broken Grub2 Bootloader after hard drive upgrade

13 11 2010

I recently replaced the hard drive in my laptop. I used Acronis True Image Home 2011 to clone the old hard drive to the new one. It increased the sizes of the partitions proportionatly and made the drive bootable. So far so good.

In addition to Windows 7 I have Ubuntu 10.10 dual booted using Grub2.

Windows 7 booted just fine after the upgrade but Ubuntu would not boot and dropped into busybox with the following error

/dev/disk/by-uuid/xxxx does not exist
dropping to shell

Where xxxx is a long number called a UUID

Because the Linux partition was now 20GB larger than before it had a new UUID which did not match what Ubuntu expected.  Since the introduction of Grub2 Ubuntu boots using UUID’s instead of device ID’s. This has many advantages if a linux partition is moved from one device to another or devices ID’s are reassigned after new hardware is added or removed.  However if the UUID changes Ubuntu can’t find the installation partition to boot from.

Fortunately, changing the UUID Ubuntu expects is fairly easy.

First you have to note the new UUID of the Linux partition. After Ubuntu fails to boot enter

blkid

at the recovery prompt, this will list the partitions and associated UUID’s.

Next reboot the computer and press the letter e when Grub first loads. You will see the boot commands listed, change the UUID to match the UUID you noted  earlier, press the down arrow at least once then press Ctrl-X to boot using these new parameters. If you entered the UUID correctly Ubuntu should boot normally.

Log into Ubuntu and open a command prompt.

Type

sudo update-grub

followed by your password when prompted.

Type

sudo reboot

and the system should reboot and load Ubuntu normally.

Of course things didn’t work out so well for me, and the update-grub command failed to list Windows 7 with the following error

Boot: No such file or directory
ls: cannot access /var/lib/os-prober/mount/boot

I could now boot Ubuntu but not Windows 7 :-)

Fixing this is fairly straight forward

Once Ubuntu is loaded open the ‘System Reserved’ volume in places. Look to see of there are two boot folders. One will be all lowercase /boot and one will be captalized /Boot. Rename the lowercase /boot to something else.

Now repeat the update-grub command listed above and it should update the boot configuration without errors and list Windows correctly.

Ubuntu cannot be directly faulted for having problems, Acronis True Image Home should have made the requisite adjustments to UUID’s to enable Ubuntu to resume normal operations.

About these ads

Actions

Information

2 responses

8 09 2011
Karl

Great stuff!
What exactly did this step do?
“Rename the lowercase /boot to something else.”

8 09 2011
jpwhitehome

If you fail to do this, then the Linux partition will fail to boot properly. There is another folder with a similar name it gets confused with. Be sure to rename the all lowercase /boot folder.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.

Join 104 other followers

%d bloggers like this: