unable to update "grub" boot menu when upgrading from Ubuntu 20.04 to 22.04

in flag

I recently upgraded a Ubuntu box (a rackmount server) from 20.04 to 22.04. However, the "grub" boot menu kept listing kernel 5.4.0-40 as the default kernel entry regardless what I did - and I've tried many different things

  • run update-grub
  • run grub-install --target=.. /boot/efi
  • disable UEFI boot and only allow legacy mode in the BIOS
  • remove the ubuntu folder inside /boot/efi/
  • umount /boot/efi and disable it from /etc/fstab
  • or even completely delete the /dev/nvme0n1p1 partition that was mapped to /boot/efi

regardless what I did, the boot menu is UNCHANGED! I don't know what was the issue. /boot/grub/grub.cfg clearly shows the 5.15 and 5.17 kernels as the top two options that I installed as part of the 22.04 upgrade, but they could not be shown and used.

I also installed efibootmgr and run efibootmgr -r, it complains "EFI variables are not supported on this system".

can someone let me know what was wrong? how can I update the boot menu?

Andra avatar
tr flag
maybe something similar in [here](
mook765 avatar
cn flag
I'm speechless, you should have asked before doing all these steps which probably seriously damaged your OS. My guess is that you have two OS installed, one in legacy mode and one in efi mode, and you were using the grub of the wrong OS. However, without detailed information about your system we can't give correct advice. Please create a [boot info summary]( and provide link to pastbin in your post.
in flag

I am going to answer my own question - for some reason, grub-install failed to update /boot/efi/EFI/ubuntu/grub.cfg even after using

grub-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot

the problem is somewhat like this post, except that the grub.cfg file was unchanged after the command.

I think a simply solution could have been copying /boot/grub/grub.cfg to overwrite /boot/efi/EFI/ubuntu/grub.cfg, however, since I deleted the ubuntu folder and even the partition during my test, I ended up re-creating the partition (/dev/nvme0n1p1) from gparted and reinstalling the efi boot folder following this post using a live-USB drive (Xubuntu 22.04).

after mounting all drives and chroot, I ran the same grub-install command above, and the updated kernel list are shown afterwards.

I still don't fully understand why the old /boot/efi/EFI/ubuntu/grub.cfg could not be updated. The Ubuntu on the rack server was installed by the factory. I also have no idea why the system still boots with the old EFI grub menu even after deleting the efi partition.

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.