Fix a ubuntu upgrade problem with Grub2

Reading Time: < 1 minute

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.

Reading Time: < 1 minute

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
d=/mnt/chroot
cd.. 
mount /dev/sda2 $d

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

mount /dev/sda1 $d/boot

then

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):

update-grub
grub-install /dev/sda
update-grub

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

By Marc Olivier Meunier

Marc has spent the past few years putting oil on the fire of a hyper growth ad tech company. At Smartly.io he was in charge of scaling the support and its culture. At Eficode he is now leading an engineering team and running operations. He leads by example and puts a lot of emphasis on diversity and inclusion, constantly working to create a safe environment. A warm leader with a passion for memorable experiences and innovation.
Find Marc on Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *