[SOLVED] Physical drive EFI disk passthrough issues.

owen0926

New Member
Jan 28, 2023
20
3
3
I created a new virtual machine on proxmox using OMVF for UEFI support for my Arch Linux install, after finishing setup I shutdown the VM, detached the CD/ROM drive, and used "qm set <VMID> -efidisk0 /dev/disk/by-id/<DISKID-PART#-OFEFI>,efitype=4m,format=raw" followed by "qm set <VMID> -scsi0 /dev/disk/by-id/<DISKID>" once I attempted to boot my VM I just got such with "Guest has not initialized display(yet)." The same thing happened on a physical drive passthrough of a Linux Mint install. I know it's the EFI disk that's tripping it up. The VM doesn't boot without "format" being set and the only thing I can set it to is raw which causes the issues. I have tried switching between q35 and the default, allocating GPU memory, setting EFI to not use a specific partition, changing OS type, and a few other things. I'm not sure what I'm doing wrong or what may be causing this but tried for a long time to fix this before asking on forum.

VM config as follows:

bios: ovmf
boot: order=scsi0
cores: 4
efidisk0: /dev/disk/by-id/ata-PNY_CS900_500GB_SSD_PNY2244221104010144E,efitype=4m,format=raw,size=488386584K
localtime: 0
machine: q35
memory: 4096
meta: creation-qemu=7.1.0,ctime=1674860461
name: superArch
numa: 0
ostype: l26
scsi0: /dev/disk/by-id/ata-PNY_CS900_500GB_SSD_PNY2244221104010144E,size=488386584K
smbios1: uuid=77df691b-4fa5-4f71-a6c7-0c20e74b6440
sockets: 1
vmgenid: c84736d5-87f9-433a-8863-6763b9cf99ad
 
Have you tried adding the CD/ROM disk back to the hardware list with the ISO mounted to see if it'll boot? I wonder if the VM's OS hadn't quite finished installing before you stole the CD away from it? I'd start there. If that didn't work, recreate the VM anew and don't remove the CD-ROM from the hardware list and see if you can get it to boot properly and shut down reliably. You might have a bad ISO that's causing VM issues and nothing to do with Proxmox.
 
Have you tried adding the CD/ROM disk back to the hardware list with the ISO mounted to see if it'll boot? I wonder if the VM's OS hadn't quite finished installing before you stole the CD away from it? I'd start there. If that didn't work, recreate the VM anew and don't remove the CD-ROM from the hardware list and see if you can get it to boot properly and shut down reliably. You might have a bad ISO that's causing VM issues and nothing to do with Proxmox.
It does boot with the CD/ROM iso going into the installer where I can see the disk and files created. However I have not tried booting with just the CD/ROM drive without an attached ISO or different ISO install. I will try both. I have the same issue with a Linux Mint NVME drive too that was setup and working previously on bare-metal that I tried to boot into with the same settings as above.

Thanks for the advice and I'll comment back on how that works out.
 
  • Like
Reactions: alafrosty
I couldn't get it to boot that way either. Attempting an Ubuntu install to see if it was an installation error onto the drive.
 
Same issue with ubuntu install. I'll attach some screenshots. Am I supposed to point the efidisk to the efi partition?

It boots with a CD/ROM drive ISO attached into that and I can go onto live mode with an OS like mint and see the disk and that everything partitioned correctly and the files are there.
 

Attachments

  • Screenshot 2023-01-30 104415.png
    Screenshot 2023-01-30 104415.png
    19.1 KB · Views: 35
  • Screenshot 2023-01-30 104403.png
    Screenshot 2023-01-30 104403.png
    16.5 KB · Views: 34
  • Screenshot 2023-01-30 104351.png
    Screenshot 2023-01-30 104351.png
    44.4 KB · Views: 35
Actually, with the efidisk attached it won't boot the CD/ROM, before commenting I had booted the CD/ROM live to see which partition Ubuntu put EFI on (part1) and after adding it via "qm set 105 -efidisk0 /dev/disk/by-id/ata-PNY_CS900_500GB_SSD_PNY2244221104010144E-part1,efitype=4m,format=raw" the machine no longer boots and hangs at "Guest has not initialized display(yet)"
 
The EFI-disk is not the ESP (EFI System Partition) but the virtual equivalent of a little piece of persistent memory of a physical motherboard, which keeps some settings like the boot order and where the various boot loaders are stored.
I would expect booting the VM in UEFI mode (OVMF) with some Linux LiveCD, chroot-ing into your existing Linux installation (inside the VM) and repairing/reinstalling that boot loader would fix it. The details of repairing/reinstalling the boot loader depends on the specific Linux distribution.
 
  • Like
Reactions: Chris
The EFI-disk is not the ESP (EFI System Partition) but the virtual equivalent of a little piece of persistent memory of a physical motherboard, which keeps some settings like the boot order and where the various boot loaders are stored.
I would expect booting the VM in UEFI mode (OVMF) with some Linux LiveCD, chroot-ing into your existing Linux installation (inside the VM) and repairing/reinstalling that boot loader would fix it. The details of repairing/reinstalling the boot loader depends on the specific Linux distribution.
Interesting, I didn't know this. So my most important installation is of Linux Mint on a physical NVME. Configuration is identical to that of what this thread is based on. So, what exactly do I need to set? Do I need to create a virtual efidisk then point my VM to that as it's EFI partition or something entirely different?

Thank you so much for all the help that makes a lot of sense.
 
So, what exactly do I need to set? Do I need to create a virtual efidisk then point my VM to that as it's EFI partition or something entirely different?
If the original booted in UEFI-mode then you need to add an EFI Disk and select OVMF in Proxmox.
Boot the VM with a Linux LiveCD (like GParted Live, which can be useful for a lot of stuff). Then you can mount the Linux Mint and ESP partitions, chroot into it (as if Linux Mint was booted), and reinstall the boot loader (probably GRUB) while you are "inside" Linux Mint.
This is generic GRUB boot repair and not specific to Proxmox. You would need similar steps if you replaced the motherboard. Maybe there is a exact, recent guide for it, but I can't find it right now. Maybe Step 2 of this askubuntu answer can help you?
 
If the original booted in UEFI-mode then you need to add an EFI Disk and select OVMF in Proxmox.
Boot the VM with a Linux LiveCD (like GParted Live, which can be useful for a lot of stuff). Then you can mount the Linux Mint and ESP partitions, chroot into it (as if Linux Mint was booted), and reinstall the boot loader (probably GRUB) while you are "inside" Linux Mint.
This is generic GRUB boot repair and not specific to Proxmox. You would need similar steps if you replaced the motherboard. Maybe there is a exact, recent guide for it, but I can't find it right now. Maybe Step 2 of this askubuntu answer can help you?
Thank you for the guidance I will give that a try in a little bit and post how it goes!
 
  • Like
Reactions: alafrosty
Followed the steps posted below and now getting dumped into UEFI shell and seems the VM doesn't currently see the disk at all.
 

Attachments

  • Screenshot 2023-01-30 180234.png
    Screenshot 2023-01-30 180234.png
    65.3 KB · Views: 27
  • Screenshot 2023-01-30 180057.png
    Screenshot 2023-01-30 180057.png
    12.4 KB · Views: 28
  • Screenshot 2023-01-30 180049.png
    Screenshot 2023-01-30 180049.png
    33.2 KB · Views: 26
  • Screenshot 2023-01-30 181105.png
    Screenshot 2023-01-30 181105.png
    201.7 KB · Views: 27
Current config (and yes scsi0 is the first in boot order/only (tried with and w/o disk)):
 

Attachments

  • Screenshot 2023-01-30 180356.png
    Screenshot 2023-01-30 180356.png
    15.2 KB · Views: 18
Last edited:
Changing over from my SCSI controller to VirtIO SCSI controller we get into the grub shell! Some progress but still not booting yet!
 

Attachments

  • Screenshot 2023-01-30 192651.png
    Screenshot 2023-01-30 192651.png
    208.6 KB · Views: 20
Looks like I'm in! Did some disk grub recovery and made it back into the physical NVME. Thank you so much leesteken for your insight on how UEFI and EFI disk work and pointing me in the correct direction. As well as alafrosty's intial suggestion.

Outside of that would either of you happen to know why the default (LSI 53C895A) SCSI controller wouldn't work to boot? If not no worries just was wondering! I will now mark as solved :)
 
  • Like
Reactions: alafrosty
Looks like I'm in! Did some disk grub recovery and made it back into the physical NVME. Thank you so much leesteken for your insight on how UEFI and EFI disk work and pointing me in the correct direction. As well as alafrosty's intial suggestion.

Outside of that would either of you happen to know why the default (LSI 53C895A) SCSI controller wouldn't work to boot? If not no worries just was wondering! I will now mark as solved :)

I am confused about what configuration actually worked? How did you put your EFIDISK in the VM? did you pointed the SCSI to the same place, or to a part2?
 
And how did you boot cause I can't get it to boot with EFI disk attached eventhough the boot order is to stat with the CD
 
To get it to actually work I needed to perform GRUB recovery because the EFI disk was looking for a set of keys that are stored on the motherboard of the old system it was from (which is normal for EFI systems) so I needed to boot up a live image and follow the given grub recovery steps to get it working on the migrated system. You don't point the EFI disk to any special part you actually just create a new one as shown in my one config photo. The issue I was experiencing after recovery is I set the disk controller from virtio to an actual PCI controller and that causes issues so just leave that set to virt io. If you have any questions more specifically on it I can answer when I am back home. Hopefully this helps :)
 
So i create an empty EFI, got it! now do I expose all 3 parts as scsi to my VM ? and then follow the process in the posted:
------------------
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
exit
------------------
where : sdX = disk | sdXX = EFI partition | sdXXX = system partition
 
Last edited:
Hello, you're starting to get the idea. Not dumb at al either, it took me a while to figure out and you're right in your post it is NOT documented at all and very vague that they are only talking about LEGACY system passthrough in any post. You want to point proxmox to the disk by ID which you get from:
"find /dev/disk/by-id/ -type l|xargs -I{} ls -l {}|grep -v -E '[0-9]$' |sort -k11|cut -d' ' -f9,10,11,12"
on the proxmox server root shell.
Say for example we were working with: "ata-SPCC_Solid_State_Disk_AA230418S301KG01281"
We set that to "scsiX" to the disk by id so it's using the whole disk not individual partitions then use VirtIO as controller also sometimes it can help to NOT "pre-enroll" the EFI keys (not always but from experience, some EFI VMs don't seem to work with that option)
Then set the CD/ROM to any live linux image I think I used Ubuntu? Then yes follow what you posted and it should set the EFI keys updated to those established in the VM creation process. From there it should work? If I can remember correctly, I actually don't have that VM anymore but if you have any issues please let me know and I will work to help you resolve them :D
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!