Linux – How to avoid GRUB errors after running apt-get upgrade – Ubuntu

amazon ec2amazon-web-serviceslinuxubuntu-14.04

I'm running ubuntu 14.04 on an EC2.

After running apt-get upgrade, I'm prompted with a screen that asks me to reinstall GRUB boot loader

The GRUB boot loader was previously installed to a disk that is no longer present, or whose unique identifier has changed for some reason. It is important to make sure that the installed GRUB core image stays in sync with GRUB modules and grub.cfg. Please check again to make sure that GRUB is written to the appropriate boot devices.

  • How do I know which device should I select ?

  • What if I have mounted on my machine some additional EBS, should I select them as well ?

  • Can I avoid this prompt, during the upgrade or supply some defaults to the command ?

The following prompt is

A new version of /boot/grub/menu.lst is available, but the version installed currently has been locally modified.

  1. install the package maintainer's version
  2. keep the local version currently installed
  3. show the differences between the versions
  4. show a side-by-side difference between the versions
  5. show a 3-way difference between available versions
  6. do a 3-way merge between available versions (experimental)
  7. start a new shell to examine the situation

The same questions here:

  • How do I know which one should I select ?

  • Can I avoid this prompt, during the upgrade or supply some defaults to the command ?

Best Answer

There is a current bug opened for this located here and it was also present is 12.02 LTS as seen here. The steps listed in the bottom of the bug report by Anders Hall do work for the 14.04 LTS 64-bit (HVM) AMI (ami-d05e75b8 in US-EAST-1):

$ sudo apt-get update
$ sudo rm /boot/grub/menu.lst
$ sudo update-grub-legacy-ec2 -y
$ sudo apt-get dist-upgrade -qq --force-yes
$ sudo reboot

Upon reboot the 14.04.2 LTS was upgraded to 14.04.3 LTS and sudo apt-get update && sudo apt-get upgrade returned 0 new packages.