Windows 7 VM migrated from VirtualBox to Bhyve doesn't boot

Hi, I'm trying to boot a Windows 7 Virtual Machine I migrated from Virtual Box to Bhyve running on FreeBsd 12.1-RELEASE 64bit

Before creating the VM I converted the .vdi disk to raw using "vboxmanage clonehd "Win 7.vdi" win7.img --format raw".

Then created the VM:

Code:
sudo vm create -t windows Windows7 disk0_opts="sectorsize=512"

And dd'ed the disk:

Code:
sudo dd if=win7.img of=/vms/Windows7/disk0.img

The config file is this:

Code:
loader="uefi"
graphics="yes"
xhci_mouse="yes"
cpu=1
memory=4G

# put up to 8 disks on a single ahci controller.
# without this, adding a disk pushes the following network devices onto higher slot numbers,
# which causes windows to see them as a new interface
ahci_device_limit="8"

# ideally this should be changed to virtio-net and drivers installed in the guest
# e1000 works out-of-the-box
network0_type="e1000"
network0_switch="public"

disk0_type="ahci-hd"
disk0_name="disk0.img"
disk0_opts="sectorsize=512"

# windows expects the host to expose localtime by default, not UTC
utctime="no"
uuid="ec6c2436-df2a-11ea-904a-b42e99ead36c"
network0_mac="58:9c:fc:06:7d:b9"

And the content of my /vms/Windows7 directory is this:

Code:
ls -lah /vms/Windows7/
total 52415540
drwxr-xr-x  2 root  wheel     7B 15 ago.  17:26 .
drwxr-xr-x  7 root  wheel     7B 15 ago.  16:10 ..
-rw-r--r--  1 root  wheel    44B 15 ago.  17:26 console
-rw-------  1 root  wheel    50G 15 ago.  17:21 disk0.img
-rw-r--r--  1 root  wheel    17B 15 ago.  17:26 run.lock
-rw-r--r--  1 root  wheel    12K 15 ago.  17:26 vm-bhyve.log
-rw-r--r--  1 root  wheel   671B 15 ago.  17:25 Windows7.conf

The problem I'm facing is that the VM desn't boot, showing the UEFI interactive shell after booting and connecting using VNC.

This is the vm-bhyve.log file:

Code:
ago. 15 17:22:08: starting bhyve (run 1)
ago. 15 17:25:56: bhyve exited with status 1
ago. 15 17:25:56: destroying network device tap2
ago. 15 17:25:56: stopped
ago. 15 17:25:59: initialising
ago. 15 17:25:59:  [loader: uefi]
ago. 15 17:25:59:  [cpu: 1]
ago. 15 17:25:59:  [memory: 4G]
ago. 15 17:25:59:  [hostbridge: standard]
ago. 15 17:25:59:  [com ports: com1]
ago. 15 17:25:59:  [uuid: ec6c2436-df2a-11ea-904a-b42e99ead36c]
ago. 15 17:25:59:  [utctime: no]
ago. 15 17:25:59:  [debug mode: no]
ago. 15 17:25:59:  [primary disk: disk0.img]
ago. 15 17:25:59:  [primary disk dev: file]
ago. 15 17:25:59: initialising network device tap2
ago. 15 17:26:00: adding tap2 -> vm-public (public addm)
ago. 15 17:26:00: bring up tap2 -> vm-public (public addm)
ago. 15 17:26:00: dynamically allocated port 5900 for vnc connections
ago. 15 17:26:00: booting
ago. 15 17:26:00:  [bhyve options: -c 1 -m 4G -Hwl bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd -U ec6c2436-df2a-11ea-904a-b42e99ead36c]
ago. 15 17:26:00:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,ahci,hd:/vms/Windows7/disk0.img,sectorsize=512 -s 5:0,e1000,tap2,mac=58:9c:fc:06:7d:b9 -s 6:0,fbuf,tcp=0.0.0.0:5900 -s 7:0,xhci,tablet]
ago. 15 17:26:00:  [bhyve console: -l com1,/dev/nmdm-Windows7.1A]
ago. 15 17:26:00:  [bhyve iso device: -s 3:0,ahci-cd,/vms/.config/null.iso]

Does anyone know why this isn't booting?
 
I cannot tell you how to migrate from VirtualBox. Also I have no clue about vm-bhyve (I'm using bhyve directly). But I can tell you that bhyve is able to run Windows 7 - but that's no fun: xHCI doesn't work, and without a working mouse… Well, it is running - but nearly unusable. You will need other options than bhyves VNC to get a remote desktop usable. Win7 is the only machine I have not migrated resp. stayed afterwards on the old host.
 
Yes I know it works, I'm running many windows versions on FreeNAS, that uses Bhyve. Also I'm running a migrated Ubuntu 16.04 from VirtualBox without issues.
 
....
And dd'ed the disk:
Code:
sudo dd if=win7.img of=/vms/Windows7/disk0.img
....
Does anyone know why this isn't booting?
What does gpart() tell about the disk image?
Code:
# mdconfig -a /vms/Windows7/disk0.img
# gpart show md0
xHCI doesn't work, and without a working mouse… Well, it is running - but nearly unusable. You will need other options than bhyves VNC to get a remote desktop usable
What's wrong with Window's RDP? net/freerdp is perfectly working and also provides sound and host's directories access.
 
Code:
leonardo@ws1 ~] $ gpart show md0                                            =>       63  104857537  md0  MBR  (50G)
         63       1985       - free -  (993K)
       2048     204800    1  ntfs  [active]  (100M)
     206848  104648704    2  ntfs  (50G)
  104855552       2048       - free -  (1.0M)

[leonardo@ws1 ~] $
 
I'd suggest installing sysutils/uefi-edk2-bhyve-csm to use the corresponding firmware file:
/usr/local/share/uefi-firmware/BHYVE_UEFI_CSM.fd.
I remember reading that CSM is needed for Windows 7. I don't use it, but I have a GPT disk with EFI partition for my Windows 7 in bhyve.
 
Well I tried uefi-csm and uefi_csm, looks like loader="uefi-csm" is the correct one, because I get a black screen and with the other the VNC server doesn't start.

Code:
ago. 16 16:42:50: initialising
ago. 16 16:42:50:  [loader: uefi-csm]
ago. 16 16:42:50:  [cpu: 1]
ago. 16 16:42:50:  [memory: 4G]
ago. 16 16:42:50:  [hostbridge: standard]
ago. 16 16:42:50:  [com ports: com1]
ago. 16 16:42:50:  [uuid: ec6c2436-df2a-11ea-904a-b42e99ead36c]
ago. 16 16:42:50:  [utctime: no]
ago. 16 16:42:50:  [debug mode: no]
ago. 16 16:42:50:  [primary disk: disk0.img]
ago. 16 16:42:50:  [primary disk dev: file]
ago. 16 16:42:50: initialising network device tap2
ago. 16 16:42:50: adding tap2 -> vm-public (public addm)
ago. 16 16:42:50: bring up tap2 -> vm-public (public addm)
ago. 16 16:42:50: dynamically allocated port 5900 for vnc connections
ago. 16 16:42:50: booting
ago. 16 16:42:50:  [bhyve options: -c 1 -m 4G -Hwl bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CSM.fd -U ec6c2436-df2a-11ea-904a-b42e99ead36c]
ago. 16 16:42:50:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,ahci,hd:/vms/Windows7/disk0.img,sectorsize=512 -s 5:0,e1000,tap2,mac=58:9c:fc:06:7d:b9 -s 6:0,fbuf,tcp=0.0.0.0:5900 -s 7:0,xhci,tablet]
ago. 16 16:42:50:  [bhyve console: -l com1,/dev/nmdm-Windows7.1A]
ago. 16 16:42:50: starting bhyve (run 1)

This is the vm-bhyve.log file when using uefi-csm.
 
This solution depends on the Windows 7 edition - it might not be available.
That's true, I've never used Home/Basic, thus didn't realized the RDP may not be available.

martinrame , if you like experimenting, you can try converting your HDD image from MBR to GPT. Unfortunately, M$ doesn't provide tools for in-place convertion for Windows 7. However, you can create an empty disk image with GPT scheme, then create an EFI partition of 200MB and a "ms-basic-data" partition slightly larger than your current Windows partition (or exactly of the same size). Then unzip and copy to EFI partition (it's has to be FAT32) the files from my working Windows 7 installation (you should see EFI directory on root). Then copy ( dd) your current Windows partition to the newly created "ms-basic-data" partition.
 
Back
Top