View previous topic :: View next topic |
Author |
Message |
cmrd n00b
Joined: 13 Jul 2014 Posts: 44
|
Posted: Fri Sep 18, 2020 1:10 am Post subject: [Solved] gentoo KVM EFI guest's efibootmgr entry not saved |
|
|
I have a KVM host running gentoo, on which I'm trying to install a gentoo EFI guest, which has been configured with virt-manager.
This guest needs to boot EFI to set the boot ROM of a passthrough PCI device.
This guest is x86_64 pc-i440fx-5.0, with a pflash loader and an NVRAM file.
I believe the issue is in the guest, as debian and Windows guests are able to create EFI boot entries in similar configurations on the same host.
Inside the guest, the EFI fs is mounted rw:
Code: | (chroot)# mount | grep efi
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
|
EFI entries prior to attempt:
Code: | (chroot)# efibootmgr -v
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0002,0001,0000,0003
Boot0000* UiApp FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
Boot0001* UEFI QEMU DVD-ROM QM00005 PciRoot(0x0)/Pci(0x4,0x0)/Sata(0,65535,0)N.....YM....R,Y.
Boot0002* UEFI Misc Device PciRoot(0x0)/Pci(0x5,0x0)N.....YM....R,Y.
Boot0003* EFI Internal Shell FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1) |
Attempt following https://wiki.gentoo.org/wiki/Efibootmgr :
Code: | (chroot)# efibootmgr -c -d /dev/vda -p 2 -L "Gentoo" -l '\efi\boot\bootx64.efi' -u 'root=/dev/vg_root/lv_root initrd=\efi\boot\initramfs.img'
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0004,0002,0001,0000,0003
Boot0000* UiApp
Boot0001* UEFI QEMU DVD-ROM QM00005
Boot0002* UEFI Misc Device
Boot0003* EFI Internal Shell
Boot0004* Gentoo
|
Confirming that entry has been added:
Code: | (chroot)# efibootmgr -v
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0004,0002,0001,0000,0003
Boot0000* UiApp FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
Boot0001* UEFI QEMU DVD-ROM QM00005 PciRoot(0x0)/Pci(0x4,0x0)/Sata(0,65535,0)N.....YM....R,Y.
Boot0002* UEFI Misc Device PciRoot(0x0)/Pci(0x5,0x0)N.....YM....R,Y.
Boot0003* EFI Internal Shell FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)
Boot0004* Gentoo HD(2,GPT,3c5194e3-7baa-4dbe-86e0-21e781355759,0x40800,0xefbf7df)/File(\efi\boot\bootx64.efi)r.o.o.t.=./.d.e.v./.v.g._.r.o.o.t./.l.v._.r.o.o.t. .i.n.i.t.r.d.=.\.e.f.i.\.b.o.o.t.\.i.n.i.t.r.a.m.f.s...i.m.g.
|
Then after rebooting the VM it fails to boot from the disk.
After booting from the live-cd, and reentering the chroot environment:
Code: | (chroot)# efibootmgr -v
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0002,0001,0000,0003
Boot0000* UiApp FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
Boot0001* UEFI QEMU DVD-ROM QM00005 PciRoot(0x0)/Pci(0x4,0x0)/Sata(0,65535,0)N.....YM....R,Y.
Boot0002* UEFI Misc Device PciRoot(0x0)/Pci(0x5,0x0)N.....YM....R,Y.
Boot0003* EFI Internal Shell FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)
|
I expected the new boot entry to be present after a reboot.
Any ideas why this was not the case, and what I could to do fix this?
Last edited by cmrd on Fri Sep 18, 2020 8:43 pm; edited 1 time in total |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3879
|
Posted: Fri Sep 18, 2020 8:08 am Post subject: |
|
|
Hi
in the guest you need
Code: |
GRUB_PLATFORMS="efi-64" #####in make.conf
emerge -1av grub
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=gentoo --recheck
grub-mkconfig -o /boot/grub/grub.cfg
|
Make sure efivars mounted rw.
You do NOT need to mess with efibootmgr on a vm.
It is more useful in a multi boot installations(like if you have many installations on your disk)
Did you choose UEFI in Virt-manager when creating your VM?
Do you have ovmf installed in the host?
|
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2719
|
Posted: Fri Sep 18, 2020 8:37 am Post subject: |
|
|
Are debian and windows really keeping entries? They may just be using --removable path where efivars wouldn't matter if options are self-contained (you could do the same, grub can of course pass options, and even a EFI stub kernel can have builtin options).
If still want to use, do make double sure the VM's efivars changes get saved, with qemu personally I use: Code: | -drive if=pflash,format=raw,unit=0,file=/usr/share/edk2-ovmf/OVMF_CODE.fd,readonly
-drive if=pflash,format=raw,unit=1,file=/path/to/readwrite/efivars.fd | And they get written in this efivars.fd for next time I boot the VM. Worked fine with gentoo+efivarfs+efibootmgr last I tried using a EFI stub kernel (no grub). I don't use virt-manager and things like that though, I'd assume virt-manager would set that up for you if configured right but I never tried. |
|
Back to top |
|
|
cmrd n00b
Joined: 13 Jul 2014 Posts: 44
|
Posted: Fri Sep 18, 2020 8:42 pm Post subject: |
|
|
Quote: | You do NOT need to mess with efibootmgr on a vm. |
Thanks! This is my first time trying to install using UEFI, so I wasn't sure.
Quote: | Did you choose UEFI in Virt-manager when creating your VM?
Do you have ovmf installed in the host? |
Definitely yes for both.
Your instructions worked (it's super unclear how to work out which grub platform to use, I tried emu, qemu previously).
I needed to use just /boot as otherwise it made /boot/efi/EFI.
Code: | --efi-directory=/boot |
Quote: | Are debian and windows really keeping entries? |
All I know is they boot EFI VMs from disk persistently.
I had (maybe wrongly) inferred that they are actually keeping entries. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|