bhyve Windows 10 as a guest through bhyve

D

Deleted member 67862

Guest
Hello,

I am new to bhyve but I decided to go ahead and try it out. I need a Windows 10 vm for schoolwork and want to make use of bhyve. I've been following this guide completely, though instead of /vm I put the directory in /usr/vm and my vm is named win10.

Everything has worked up until the point of installing Windows 10 ( vm create -t windows -s 40G win10). It seems that as soon as the vm is spun up, its locked or stops. When trying to view localhost:5900 with vncviewer, I get a "vncviewer: VNC server closed connection" error. This is what vm list looks like promptly after installing or starting the vm:

Code:
hunter@mybsdpc:/usr/vm % sudo vm list
NAME   DATASTORE  LOADER  CPU  MEMORY  VNC           AUTOSTART  STATE
win10  default    uefi    2    2G      0.0.0.0:5900  No         Locked (mybsdpc)

Originally I had ran this twice and it was first locked and then in the "Stopped" state. But after running the install command this last time has left it in "Locked" state with no way to view the virtual machine (Update: it stopped again). Any input/help is appreciated.
 
I'd suggest running it manually, to me it's much easier and straight forward.
I wrote a script which launches a Windows 10 VM in a loop, i.e. restarts if I restart Window and quits if I shutdown Windows:
Code:
#!/bin/sh
CD=/mnt/zoo/vm/virtio-win-0.1.196.iso
HD=/mnt/zoo/vm/win10.img
HD1=/mnt/zoo/vm/win-d.img
USB="5/0/0"
UEFI=/usr/local/share/uefi-firmware/BHYVE_UEFI.fd
MEM=4G
VM="win10"
IF="tap0"
MAC="mac=00:A0:98:78:32:10"
DPY="w=1600,h=900"

sudo ifconfig $IF up
while true
do
    sudo bhyve \
      -c 4,sockets=2,cores=2 -S \
      -s 0,hostbridge \
      -s 3,ahci-hd,$HD,sectorsize=512 \
      -s 4,ahci-hd,$HD1,sectorsize=512 \
      -s 5,fbuf,tcp=0.0.0.0:5903,$DPY \
      -s 6,xhci,tablet \
      -s 10,virtio-net,$IF,$MAC \
      -s 11,passthru,$USB \
      -s 31,lpc \
      -l bootrom,$UEFI \
      -m $MEM -H -w \
      $VM

    RES=$?
    sudo bhyvectl --destroy --vm=$VM
    if [ $RES -eq 1 ]
    then
        exit 1
    fi
    echo sleeping for 5 sec...
    sleep 5
done
 
I'd suggest running it manually, to me it's much easier and straight forward.
I wrote a script which launches a Windows 10 VM in a loop, i.e. restarts if I restart Window and quits if I shutdown Windows:
Code:
#!/bin/sh
CD=/mnt/zoo/vm/virtio-win-0.1.196.iso
HD=/mnt/zoo/vm/win10.img
HD1=/mnt/zoo/vm/win-d.img
USB="5/0/0"
UEFI=/usr/local/share/uefi-firmware/BHYVE_UEFI.fd
MEM=4G
VM="win10"
IF="tap0"
MAC="mac=00:A0:98:78:32:10"
DPY="w=1600,h=900"

sudo ifconfig $IF up
while true
do
    sudo bhyve \
      -c 4,sockets=2,cores=2 -S \
      -s 0,hostbridge \
      -s 3,ahci-hd,$HD,sectorsize=512 \
      -s 4,ahci-hd,$HD1,sectorsize=512 \
      -s 5,fbuf,tcp=0.0.0.0:5903,$DPY \
      -s 6,xhci,tablet \
      -s 10,virtio-net,$IF,$MAC \
      -s 11,passthru,$USB \
      -s 31,lpc \
      -l bootrom,$UEFI \
      -m $MEM -H -w \
      $VM

    RES=$?
    sudo bhyvectl --destroy --vm=$VM
    if [ $RES -eq 1 ]
    then
        exit 1
    fi
    echo sleeping for 5 sec...
    sleep 5
done
Is that the .conf file within the vm's folder?
 
2 GB of memory for Windows 10? That seems rather low.
That was the default. I can raise it.

Actually, I did raise it to 4G but still get the same results.
 
Check the logs for clues why it failed to start. It does seem to want to start but then crashes (hence the 'locked'). Logs of the VM should be in the VM's directory.
 
I ended up using Virtualbox and removed the /usr/vm direcory (rm -rf) earlier today. Sorry about that.
 
I ended up using Virtualbox and removed the /usr/vm direcory (rm -rf) earlier today. Sorry about that.
Well, I definitely have better experience with bhyve than with VirtualBox. I'm running my Windows 10 for 2+ years 24/7 without any issue.

[EDIT] Also, you cannot pass-trough USB to a VirtualBox's guest in FreeBSD.
I need that, and I pass-through a USB controller to my Windows 10 in bhyve.
 
Well, I definitely have better experience with bhyve than with VirtualBox. I'm running my Windows 10 for 2+ years 24/7 without any issue.

[EDIT] Also, you cannot pass-trough USB to a VirtualBox's guest in FreeBSD.
I need that, and I pass-through a USB controller to my Windows 10 in bhyve.
If I may ask: What kind of protocol/programs do you use to access the Windows VM? Eg. RDP, VNC, which clients you use etc? What kind of scenario (eg. on the host locally only, over LAN, over the internet, ...)?
I'm trying to get a bit of a sense for the "user experience" in terms of performance.
 
What kind of protocol/programs do you use to access the Windows VM? Eg. RDP, VNC, which clients you use etc? What kind of scenario (eg. on the host locally only, over LAN, over the internet, ...)?
I'm trying to get a bit of a sense for the "user experience" in terms of performance.
RDP's performance is pretty good, very rarely I use VNC when network issues occur. I use RDP both over LAN and from a remote location ― using OpenVPN in Windows and in other boxes I have. I use the passed-through USB to flash Qualcomm devices since Qualcomm provides only Windows tools for that.
 
If I may ask: What kind of protocol/programs do you use to access the Windows VM? Eg. RDP, VNC, which clients you use etc?
My Windows machines are just for tests & checks, so I'm using the HOME editions with VNC and net/tigervnc-viewer (formerly I've used net/krdc). One machine got a USB card with PCI passthrough to be able to join Teams or Zoom sessions - video stream works well with VNC, no need to upgrade. The keyboard is limited - special chars don't work (but I haven't invest any time in solving this - not important to me).

To set up my machines I've used the handbook - and not a frontend tool. By the time I've wrote two scripts (for GRUB and for UEFI boot) to easy set up and run my bhyve machines - just setting up some environment variables at the top and (un)comment the lines for install or normal boot.
 
Back
Top