Fix a ubuntu upgrade problem with Grub2

With Ubuntu 10.04 came a new version of Grub. During an upgrade from a previous version to 10.04 or higher there will be a time when the system will ask you if you want to keep your own version of the configuration or get the package maintener version.

If I am not mistaken, you should say you want the maintener one.

But then something strange may happen depending on your upgrade path.

If like me you are operating a server and you can’t see the bootup process because it’s all remote, then you probably have only one good configuration and you want to use it and never change.

So how to do that when it’s too late?

If you have access to a rescue mode, this is the time to start it. I am using a dedibox from Free. So I go on my console and I start the rescue mode for that server.

Then you need to connect using ssh to that server in rescue mode.

Once connected you can chroot to your server environment. I suggest the following process:

sudo su -
cd /mnt
mkdir chroot
mount /dev/sda2 $d

/dev/sda2 is my root file system
/dev/sda1 is my /boot file system 

mount /dev/sda1 $d/boot


mount -o bind /dev $d/dev
mount -o bind /sys $d/sys
mount -o bind /dev/shm $d/dev/shm
mount -o bind /proc $d/proc
chroot $d
df -h 

If you see a df which looks familiar after the last command, you are on a good way.

Reinstall grub and update the configuration with the automatic tool (in that order):

grub-install /dev/sda

Get out of the rescue mode and hope for the best!

Leave a Reply

Your email address will not be published.