I have an Ubuntu 16.04 virtual machine (local, no cloud) which was created as a clone of another computer. Each time GRUB packages are upgraded using apt upgrade
, I get the following message:1
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.
and then it asks to select an install device.
I am able to finish the GRUB upgrade successfully but the message appears again during the next GRUB upgrade, although the disk is not altered between the upgrades.
How can I “reset” the GRUB configuration to the current one, so it does not ask again?
Examined similar questions
I am not trying to silence upgrade messages as similar questions (https://serverfault.com/questions/662624/how-to-avoid-grub-errors-after-runing-apt-get-upgrade-ubunut, How do I apt-get -y dist-upgrade without a grub config prompt?) suggest. I want to overcome this particular question regarding GRUB upgrade.
The commands from the most upvoted answer to a similar question on ServerFault cannot be applied in my case, I don’t have the mentioned files /boot/grub/menu.lst
and update-grub-legacy-ec2
on my machine.
My configuration
I tried to run the commands suggested by oldfred:
$ sudo debconf-show grub-pc
grub-pc/install_devices_failed_upgrade: true
grub-pc/mixed_legacy_and_grub2: true
grub-pc/install_devices_failed: false
grub-pc/hidden_timeout: false
grub2/update_nvram: true
grub-pc/timeout: 5
grub-pc/install_devices_empty: false
* grub-pc/install_devices_disks_changed: /dev/disk/by-id/ata-VBOX_HARDDISK_VBd7a628c1-923a4727
grub2/kfreebsd_cmdline:
* grub2/linux_cmdline: consoleblank=0
grub2/kfreebsd_cmdline_default: quiet splash
grub-pc/disk_description:
grub-pc/postrm_purge_boot_grub: false
grub-pc/partition_description:
* grub-pc/install_devices: /dev/disk/by-id/ata-VBOX_HARDDISK_VBd7a628c1-923a4727
grub-pc/chainload_from_menu.lst: true
grub2/force_efi_extra_removable: false
grub-pc/kopt_extracted: false
* grub2/linux_cmdline_default:
grub2/device_map_regenerated:
seems to match
$ sudo lshw -C Disk | grep serial
serial: VBd7a628c1-923a4727
but grub-probe -t device /boot/grub
returns the name of the root device of the clone’s master. I tried the suggested command sudo dpkg-reconfigure grub-pc
but it did not update the output of sudo grub-probe -t device /boot/grub
. How to fix this?
1 I get the message in a localized version, the pasted English version is copied from https://samrueby.com/2014/09/02/updating-grub-in-ubuntu-amazon-ec2-instance/.
If I were you, I would completely reinstall grub, checking UUIDs of disks. But you should do this OUTSIDE of your linux instance, i.e. running a live distro on a USB key and then mounting your partitions on the live filesystem and THEN reinstalling GRUB.
Have a look here: https://help.ubuntu.com/community/Grub2/Installing