I see the post above saying “Workaround!”, but if “recover a previous snapshot of the VM” is the workaround, it won’t really help you if you don’t have such a snapshot…
Below worked for me to fix my existing image, so lets call it workaround 2.
So in my case I have Home Assistant working as Unraid VM. After last update everything seemed to work fine, but I had a power outage during the night and for some reason VM didn’t auto start… when I got to the VNC I saw the UEFI Shell.
When I went to fs0:, there was an “EFI” folder, but it was EMPTY.
I went ahead and checked the img file layout:
fdisk -l HomeAssistant.img Disk HomeAssistant.img: 22 GiB, 23622320128 bytes, 46137344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8CA1F3FF-2608-4EA7-9C48-63226A18DEEB
Device Start End Sectors Size Type
HomeAssistant.img1 2048 67583 65536 32M EFI System
HomeAssistant.img2 67584 116735 49152 24M Linux filesystem
HomeAssistant.img3 116736 641023 524288 256M Linux filesystem
HomeAssistant.img4 641024 690175 49152 24M Linux filesystem
HomeAssistant.img5 690176 1214463 524288 256M Linux filesystem
HomeAssistant.img6 1214464 1230847 16384 8M Linux filesystem
HomeAssistant.img7 1230848 1427455 196608 96M Linux filesystem
HomeAssistant.img8 1427456 46137310 44709855 21.3G Linux filesystem
512 block size * 2048 start of the partition gives us 1048576 for mount offset…
Then I mounted the UEFI partition to confirm what the UEFI shell was showing:
mount -t vfat -o loop,offset=1048576,umask=0000 HomeAssistant.img testFolder1
Entering the root of the drive shows the EFI folder with additional error:
/bin/ls: cannot access 'EFI': Input/output error
Getting the same error when trying to enter the UEFI folder…
So I grabbed the current image:
Unpacked it with 7-zip to Unraid’s network share to get the file in and then converted it to img:
qemu-img convert -f qcow2 -O raw hassos_ova-5.10.qcow2 testimage.img
I did the same fdisk and mount operations on the new image and all the partition sizes and offsets matched, so I decided to try to restore just the EFI partition with dd:
dd conv=notrunc if=testimage.img of=HomeAssistant.img skip=2048 seek=2048 bs=512 count=65536
Started the VM and while I’m writing this my lights came on automatically so looks like it did the trick.
At this stage looks like the last OS update might have been touching the UEFI boot files and due to the power failure the drive corrupted the UEFI partition (the failure was hours after the update). Fortunately the content didn’t change between what I had in my img file and the latest available on the release page so it worked out of the box. I hope this helps!