"A new version of /boot/grub/menu.lst is available" when upgrading Ubuntu on an AWS server

Solution 1:

This issue can be caused by a range of different problems so there isn't a single solution. These steps should work on EC2.

Source:

The issue is caused by a local and remote change conflict in Grub legacy configuration. Grub legacy and Grub2 use different config locations:

  • Grub legacy: /boot/grub/menu.lst
  • Grub2: /boot/grub/grub.cfg

Causes:

You're probably using an Amazon EBS-Backed AMI. Instances construct their root file system from a pre-built base image (snapshot). The grub configuration is written in the snapshot, but the UCF registry isn't purged correctly. This means that you have a snapshot that thinks the menu.lst config was locally modified. More information can be found here: https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1485685

Why ubuntu uses UCF for grub is explained here: https://askubuntu.com/a/147079

Solution(s):

One general solution that works is removing menu.list and reconfiguring it. This ensures that ucf registry entry and configuration file resolve to the same hash.

#Remove the menu.lst config.

sudo rm /boot/grub/menu.lst
# Generate a new configuration file. 
sudo update-grub-legacy-ec2 -y

#Upgrade the configuration
sudo apt-get dist-upgrade -qq --force-yes

A second solution is modifying the UCF config to auto accept the maintainer changes

unset UCF_FORCE_CONFFOLD
export UCF_FORCE_CONFFNEW=YES
ucf --purge /var/run/grub/menu.lst
sudo apt-get dist-upgrade -qq --force-yes

Disclaimer:

This issue is very broad and use cases will impact the required solution. If possible its highly recommended to upgrade to grub2. Grub2 can be configured without modifying system files.

There are also a ton of different solutions offered and issue reports opened in the ubuntu tracker. I'd love to link to all of them but don't have the rep.

Good luck :)