0

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?

FangQ
  • 367
  • 1
    maybe something similar in here – Andra Apr 02 '23 at 19:17
  • 2
    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. – mook765 Apr 02 '23 at 19:58

1 Answers1

0

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.

FangQ
  • 367