Other bhyve guest: image file vs USB SSD

aragats

Daemon

Reaction score: 766
Messages: 1,664

I have a working Windows 10 guest running off an image file (GPT scheme). When I dd it to a USB SSD and try booting off it by running exactly the same bhyve command I get "Boot failed. EFI Hard drive" message. What am I missing?
Code:
HD=/dev/da0

bhyve .... -s 3,ahci-hd,$HD,sectorsize=512 ....

Foreseeing this question: since the USB SSD's size is larger, after dd I run gpart recover da0.

Thanks for advises!

[EDIT] The message "Boot failed. EFI Hard drive" appears at BIOS (UEFI) screen (doesn't come from Windows), so it won't even try to boot.
 

Phishfry

Beastie's Twin

Reaction score: 3,219
Messages: 6,348

I wonder if ahci-hd is appropriate for a USB disk.
I thought USB used xhci or similar.
 
OP
aragats

aragats

Daemon

Reaction score: 766
Messages: 1,664

I wonder if ahci-hd is appropriate for a USB disk.
I thought USB used xhci or similar.
Well, isn't it just an emulated controller presented to the guest?
From the OS perspective /dev/da0 and /path/to/win10.img should be the same IMO. If not, why and what's the solution?
 

Mjölnir

Daemon

Reaction score: 1,530
Messages: 2,114

I have a working Windows 10 guest running off an image file (GPT scheme). When I dd it to a USB SSD and try booting off it by running exactly the same bhyve command I get "Boot failed. EFI Hard drive" message. What am I missing?
The message suggests that your Windows expects to boot from a by legacy BIOS hard drive method?
 
OP
aragats

aragats

Daemon

Reaction score: 766
Messages: 1,664

The message suggests that your Windows expects to boot from a legacy BIOS hard drive?
Well, that's a BIOS (UEFI) message, not Windows', if I leave it untouched it falls into UEFI shell.
 

Mjölnir

Daemon

Reaction score: 1,530
Messages: 2,114

What does gpart show da0 tell you? Let's compare that to
mdconfig -o readonly -f /path/to/win10.img
gpart show md0
mdconfig -du 0
 
OP
aragats

aragats

Daemon

Reaction score: 766
Messages: 1,664

That was the first think I've done:
Code:
% gpart show md0
=>       34  134217661  md0  GPT  (64G)
         34       2014       - free -  (1.0M)
       2048    1083392    1  ms-recovery  (529M)
    1085440     202752    2  efi  (99M)
    1288192      32768    3  ms-reserved  (16M)
    1320960  132892672    4  ms-basic-data  (63G)
  134213632       2048    5  ms-basic-data  (1.0M)
  134215680       2015       - free -  (1.0M)

% gpart show da0
=>       40  468862048  da0  GPT  (224G)
         40       2008       - free -  (1.0M)
       2048    1083392    1  ms-recovery  (529M)
    1085440     202752    2  efi  (99M)
    1288192      32768    3  ms-reserved  (16M)
    1320960  132892672    4  ms-basic-data  (63G)
  134213632       2048    5  ms-basic-data  (1.0M)
  134215680  334646408       - free -  (160G)
So, the very first part of the disk is different.
 
OP
aragats

aragats

Daemon

Reaction score: 766
Messages: 1,664

I installed another UEFI emulator from sysutils/uefi-edk2-bhyve-devel, and it gave me a more informative message:
Code:
BdsDxe: failed to load Boot0001 "UEFI BHYVE SATA DISK BHYVE-9C43-OB5D-2224" from PciRoot (0x0)/Pci(0x3,0x0/Sata(0x0,FFFF,0x0): Not Found
I'm not sure what BHYVE-9C43-OB5D-2224 refers too, I don't see such ID in the output of gpart list | grep -i 9c43.
 

Mjölnir

Daemon

Reaction score: 1,530
Messages: 2,114

I installed another UEFI emulator from sysutils/uefi-edk2-bhyve-devel, and it gave me a more informative message:
Code:
BdsDxe: failed to load Boot0001 "UEFI BHYVE SATA DISK BHYVE-9C43-OB5D-2224" from PciRoot (0x0)/Pci(0x3,0x0/Sata(0x0,FFFF,0x0): Not Found
I'm not sure what BHYVE-9C43-OB5D-2224 refers too, I don't see such ID in the output of gpart list | grep -i 9c43.
Of course not, that's the virtual SATA disk inside the VM.
 
OP
aragats

aragats

Daemon

Reaction score: 766
Messages: 1,664

Of course not, that's the virtual SATA disk inside the VM
Right, but it has to be either based on some real numbers or just hardcoded somewhere.
Windows doesn't show that ID anywhere, I went through all properties of the hard disk and found no such ID.
 

Mjölnir

Daemon

Reaction score: 1,530
Messages: 2,114

Maybe the sector size of the USB SSD - which is a real device - and of the virtual SATA disk on the file differ?
EDIT: change the device emulation from ahci-hd to ahci EDIT2 and also try xhci?
 
OP
aragats

aragats

Daemon

Reaction score: 766
Messages: 1,664

I tried "ahci" and "virtio-blk" with no lo luck, removed the sector size too (it was there from old times when Windows understood only 512).
Also at some point the BHYVE disk ID (reported in the EFI error) has changed. I found that the ID is the disk's "serial number", Windows has it in the registry:
scr-0723-081154.png
 
Top