Recovering from Grub Rescue after upgrading to Ubuntu 11.04

Over the weekend I upgraded one of my computers to the new beta of Ubuntu. Upon restarting the computer I got dumped into grub-rescue with the message missing-xputs. Part of the cause of this was having Adobe CS3 installed in my dual boot with Windows 7.

When you install Adobe products a little DRM program called FlexNet gets installed into your boot sector which is also where grub resides. When grub is upgraded along with Ubuntu it flicks a warning about the FlexNet being in the sector but then continues to install. However, when you restart grub will not run and will be unable to boot your system into either Ubuntu or Windows.

The following instructions is a result of about five hours of googling, reading forums and talking to other linux geeks. The following commands should take about 15 minutes to complete.

This is how I got my system back:

Warning: I cannot gaurantee this instructions will work on your computer. Please read them all before continuing and take extreme care. I am not responsible if these instructions result in corrupt data or the loss of system functionality.

1. Boot to the LiveCD Desktop (Ubuntu 9.10 or later). Please note that the Live CD must be the same as the system you are fixing – either 32-bit or 64-bit.

2. Open a terminal

3. Determine your normal system partition

sudo fdisk -l

4. Mount your normal system partition:

sudo mount /dev/sdXX /mnt
Example: sudo mount /dev/sda1 /mnt

5. Mount the critical virtual filesystems:

sudo mount -B /dev /mnt/dev
sudo mount -B /dev/pts /mnt/dev/pts
sudo mount -B /proc /mnt/proc
sudo mount -B /sys /mnt/sys

6. Chroot into your normal system device:

sudo chroot /mnt

7. Attempt to install grub

apt-get install grub-pc grub-common

During install a warning should appear about FlexNet being in one of the sectors. In my case it was sector 51, others have reported it in 32 and elsewhere.

8. Purge grub

apt-get purge grub-pc grub-common

9. Remove the flexnet sector

dd if=/dev/zero of=/dev/sda bs=512 count=1 seek=X

Where X is the sector number grub-install warned about, in my case 51.

10. Reinstall grub

apt-get install grub-pc grub-common

11. Exit chroot


12. Unmount

sudo umount /mnt/dev/pts
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys
sudo umount /mnt

13. Reboot

sudo reboot

Further References: