[SOLVED] Grub-install error while upgrading from Proxmox 8 to 9

johnyb0y

Active Member
Mar 19, 2019
9
2
43
35
Hi everyone,

While upgrading from Proxmox 8 to 9 I had the following error while running apt dist-upgrade:

Code:
Setting up grub-efi-amd64 (2.12-9+pmx2) ...
Replacing config file /etc/default/grub with new version
Installing for x86_64-efi platform.
grub-install.real: error: cannot find EFI directory.
Failed: grub-install --target=x86_64-efi
WARNING: Bootloader is not properly installed, system may not be bootable

Since i did a full Rescuezilla backup of the whole disk beforehand, I wasn't too worried and tried my luck and rebooted.
As somewhat expected, I wasn't able to boot anymore.
I restored from my Rescuezilla image and started investigating:

This is an UEFI system. I double checked: /sys/firmware/efi exists.

But /boot/efi is not mounted.

lsblk -f returns this. I suspect sdg2 should be the EFI partiton:

Code:
sdg
├─sdg1
├─sdg2               vfat        FAT32                   DCBB-E417
└─sdg3               LVM2_member LVM2 001                m6lsnd-9YxI-QYdD-Qpxq-wD22-idHs-9a3vdt
  ├─pve-swap         swap        1                       7d82bd32-9c21-4414-9331-8d1d175dc599                  [SWAP]
  ├─pve-root         ext4        1.0                     3cd57cf0-f8ca-4191-92a5-0819b32e52aa     47.4G    13% /var/hdd.log
  │                                                                                                            /
  ├─pve-data_tmeta
  │ └─pve-data-tpool
  │   └─pve-data
  └─pve-data_tdata
    └─pve-data-tpool
      └─pve-data

So I tried mounting it: mount /dev/sdg2 /boot/efi

And then reinstalling and reconfiguring grub:

Code:
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=proxmox --recheck
update-grub

I also added it to my /etc/fstab: UUID=DCBB-E417 /boot/efi vfat umask=0077 0 1, so /boot/efi is mounted on every boot.

After rebooting again, I found myself in grub rescue:

Code:
error: symbol 'grub_disk_native_sectors' not found.
Entering rescue mode...
grub rescue>

So my suspicion is I'm doing something wrong here.
My understanding of EFI and grub is only very superficial, so it would be great if you could give me any pointers.
I can always restore from my Rescuezilla image, so I'm free to try out suggestions.

Thank you!
 
it sounds like you are booting from the removable boot loader entry, and did not update that one, so now there is a mismatch between the first part of grub and the rest of grub on the ESP..

could you post the output of "efibootmgr -v" (from a live cd/rescue boot)?
 
  • Like
Reactions: Stoiko Ivanov
I ran into the same issue as @johnyb0y.

I booted from the PVE9 boot iso and only ran
Code:
mount /dev/sdg2 /boot/efi
after that checked my /boot/efi/EFI directory as shown in the KB article here: Recover_From_Grub_Failure. Realized, that the file grubx64.efi was from back in 2023.
To mitigate it, ran
Code:
apt reinstall grub-efi-amd64
and again verfied with
Code:
ls -l /boot/efi/EFI/proxmox/grubx64.efi
.

Rebooted the server after successful install and was again able to boot. There was no mentioning of this in the 8to9 check, I ran before.
 
  • Like
Reactions: cbrosius
Hi @fabian and @surfer2100, I fixed it! :)

Here's a small writeup of my steps, maybe helpful to someone in the future:

Using my Rescuezilla image I restored my proxmox installation, so I was able to boot normally.

I mounted /boot/efi using mount /dev/sdg2 /boot/efi and reinstalled grub-efi-amd64: apt reinstall grub-efi-amd64
I also added it to my /etc/fstab: UUID=DCBB-E417 /boot/efi vfat umask=0077 0 1.

I then restarted, and at first was greeted with grub rescue again. But I noticed in my Mainboard boot menu two entries: One "UEFI Disk" and one "proxmox".
"UEFI Disk" booted to grub rescue, but "proxmox" worked!
I suspect "UEFI Disk" is what @fabian referred to as the removable boot loader entry?

So i booted with the "proxmox" entry and ran efibootmgr. In efibootmgr I deleted the "UEFI disk" entry and set the bootorder so that "proxmox" would be the first entry.

After rebooting successfully once more, I started the Proxmox 9 upgrade. This time everything worked just fine.
During installation I noticed this entry (probably because I deleted the "UEFI disk" entry in efibootmgr before):

Code:
Removable bootloader found at '/boot/efi/EFI/BOOT/BOOTX64.efi', but GRUB packages not set up to update it!
Run the following command:

echo 'grub-efi-amd64 grub2/force_efi_extra_removable boolean true' | debconf-set-selections -v -u

Then reinstall GRUB with 'apt install --reinstall grub-efi-amd64'

I executed these two commands and rebooted succesfully once more, now in Proxmox 9.

So thank you again!

@fabian Here's my current efibootmgr output. Does this look okay to you, or do you think I need do something else? Thanks you!

Code:
root@pve:/home/root# efibootmgr
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0002,0001
Boot0000* proxmox       HD(2,GPT,0bed9793-5dfd-43b8-b12f-b0b087b64812,0x800,0x100000)/File(\EFI\PROXMOX\GRUBX64.EFI)
Boot0001  Hard Drive    BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0200)0000474f00004e4fc300000008000000850054004f00530048004900420041002000540048004e00530046004a0032003500360047004300530055000000050109000200000000010416008b12e85cec2cf040837280640e3dc85802007fff040002010c00d041030a0000000001010600021f03120a000100ffff00007fff040001043e00ef47642dc93ba041ac194d51d01b4ce620002000200020002000200020002000340039005300480031003100340030003800540057004c0000007fff04000000424f
Boot0002* UEFI OS       HD(2,GPT,0bed9793-5dfd-43b8-b12f-b0b087b64812,0x800,0x100000)/File(\EFI\BOOT\BOOTX64.EFI)0000424f
 
Last edited: