Solved BSD hypervisor

# The thread was opened with the idea of installing Bhyve-server in an old amd server with 13.1 command line, the first few posts relate to the errors / limitations during install in that server. After that I moved on to install in in a desktop with kde5. The errors mentioned in the first few posts are no longer relevant.#

Posting this thread to request help in installing Bhyve-server in a amd server of minimal resources and the bhyve-client in a desktop. What is the right sequence of installing the Bhyve server?

I thought bhyve needed to be installed. But understand that bhyve is part of the base system from the handbook The first step as listed in the handbook is kldload vmm which returns an error:
Code:
kldload: can't load vmm: module already loaded or in kernel

Do I have to make it work by installing CBSD by following instructions given here or here ?

(The base system is 13.1-Release, command line, hardened.)

Thank you.
 
Last edited by a moderator:
As far as I know, bhyve do not have any bhyve-client.
You can manage running virtual machines via virtual serial console, VNC, RDP, ssh.

Please tell us about the operation systems which you want to run with bhyve.

kldload vmm which returns an error:
Maybe you have loaded this module before. You can run kldstat to check all loaded kernel modules (but some modules may be compiled in kernel and cannot be loaded separately).
If "module is already loaded or in kernel" then skip this step and follow the next part of manual.
 
I thought bhyve needed to be installed. But understand that bhyve is part of the base system from the handbook The first step as listed in the handbook is [B]kldload vmm[/B] which returns an error:

You should check and enable virtualization-related options in BIOS first: VT-x or Intel Virtualization for Intel and SVM Mode for AMD-based CPU.
 
You should check and enable virtualization-related options in BIOS first: VT-x or Intel Virtualization for Intel and SVM Mode for AMD-based CPU.
I don't see SVM mode in my BIOS, but someone helped me try Virtualization in this machine before. It will work. Thank you.
 
For example.
How I installed Window 10 VM on FreeBSD host (a simple case - on machine with igb0 interface with address received from DHCP). My hostmame is 'freebsd'.
For simplicity, all being installed locally (bhyve and vnc-client).
Try to create bridge:
Code:
ifconfig tap0 create
ifconfig bridge0 create
ifconfig bridge0 addm igb0 addm tap0
ifconfig bridge0 up
install needed packages:
pkg install bhyve-firmware uefi-edk2-bhyve uefi-edk2-bhyve-csm tigervnc-viewer
add to /etc/rc.conf:
Code:
kld_list="... vmm nmdm"
cloned_interfaces="bridge0 tap0"
ifconfig_bridge0="addm igb0 addm tap0 up"
add to /boot/loader.conf:
Code:
vmm_load="YES"
vmm_name="/boot/kernel/vmm.ko"
nmdm_load="YES"
if_bridge_load="YES"
if_tap_load="YES"
add to /etc/sysctl.conf:
Code:
net.link.tap.up_on_open=1
reboot - shutdown -r now
make VM's directory, /vm (for example), and create two subdirs in it: iso and vms
create an empty disk image for VM:
Code:
 /vm/vms$ truncate -s 50G w10.img
copy an installation iso-file here: /vm/iso/Win10_21H1_XXX_x64.iso
copy the virtio network drivers disk here: /vm/iso/virtio-win-0.1.215.iso
which can be dowloaded from https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.215-2
Create the following scripts:
vm_install.sh:

bhyve -c 2 -m 8G -H -w \
-s 0,hostbridge \
-s 3,ahci-cd,/vm/iso/Win10_21H1_XXX_x64.iso \
-s 4,ahci-hd,/vm/vms/w10.img \
-s 5,virtio-net,tap0 \
-s 29,fbuf,tcp=0.0.0.0:5900,wait \
-s 30,xhci,tablet \
-s 31,lpc \
-l com1,stdio \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
w10

vm_config.sh:

bhyve -c 2 -m 8G -H -w \
-s 0,hostbridge \
-s 3,ahci-cd,/vm/iso/virtio-win-0.1.215.iso \
-s 4,ahci-hd,/vm/vms/w10.img \
-s 5,virtio-net,tap0 \
-s 29,fbuf,tcp=0.0.0.0:5900,wait \
-s 30,xhci,tablet \
-s 31,lpc \
-l com1,stdio \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
w10

vm_run.sh:

bhyve -c 2 -m 8G -H -w \
-s 0,hostbridge \
-s 4,ahci-hd,/vm/vms/w10.img \
-s 5,virtio-net,tap0 \
-s 29,fbuf,tcp=0.0.0.0:5900,wait \
-s 30,xhci,tablet \
-s 31,lpc \
-l com1,stdio \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
w10

Open two terminals.
In the first terminal run: sudo ./vm_install.sh, in the second - run: vncviewer freebsd:0
In a new window, hit <space> to load from installation disk - install Windows...
After Windows is installed, exit from it, and (in terminal) kill vm: sudo bhyvectl --destroy --vm=w10
In the first terminal run: sudo ./vm_config.sh, in the second - run: vncviewer freebsd:0
When Windows started, install network drivers - from C:\NetKVM\w10\amd64\netkvm
Exit from Windows, kill vm: sudo bhyvectl --destroy --vm=w10
In the first terminal , run sudo ./vm_run.sh, in the second - vncviewer freebsd:0.
 
Andrey Lanin pkg install bhyve-firmware uefi-edk2-bhyve uefi-edk2-bhyve-csm tigervnc-viewer

Done, but said This port is deprecated. Uses python 2.7 . I am proceeding further.
 
This can be successfully ignored
I have Win10_21H1_XXX_x64.iso under /vm/iso/ and vm_config.sh vm_install.sh vm_run.sh and w10.img under vm/vms

The command at root prompt ./vm_install.sh or ./vm/vms/vm_install.sh both at the moment return the error command not found; In another terminal, vncviewer.sh also says command not found. Wrong directories ? Wrong way of executing the files ?

Ifconfig shows bridge0 and tap0, shows ether address, status: no carrier, while the Internet is connected with an IP address.
 
Prefix './' means that script resides in the current directory. Change directiry to /vm/vms and try again. Command vncviewer does not have suffix '.sh'
 
Prefix './' means that script resides in the current directory. Change directiry to /vm/vms and try again. Command vncviewer does not have suffix '.sh'

Said permission denied, even to root. chmod +x v,_install.sh fixed it.
./vm_install.sh
Code:
pci slot 0:31:0: unknown device  "1pc"
Now the error in VNC viewer command is "Can't open display" --- I have BSD 13.1 in commandline. Should I install kde and try?
 
In which window manager did you do the above work? And what exactly command you use to run vncviewer?

Edit: I did this work in gnome window manager.
 
In which window manager did you do the above work? And what exactly command you use to run vncviewer?

Edit: I did this work in gnome window manager.
I don't have a window manager installed, I installed bhyve in a computer with 13.1 memstick image installed. I will try it on a computer with kde5 plasma now.
 
Something strange happens in a computer with Kde5:

Command given as root: ifconfig bridge0 create
Error: ifconfig: SIOCIFCREATE2: Invalid argument

Repeated, retyped the command a few times, same error
 
 
Sorry. I can't help you set up network interfaces - I'm not a system administrator. I just showed an example of how bhyve can be configured. Try to get the necessary knowledge on setting up network interfaces on your own.

First of all, check if bridge0 is already in use in the system
 
Sorry. I can't help you set up network interfaces - I'm not a system administrator. I just showed an example of how bhyve can be configured. Try to get the necessary knowledge on setting up network interfaces on your own.

First of all, check if bridge0 is already in use in the system

Thank you. The example is useful, I am taking a bit of time to set it up in the right environment. I will troubleshoot issues as they occur by searching for answers or for raising it in the forum. Thank you.
 
  • Thanks
Reactions: _al
Yet another option: Personally, I can really strongly recommend sysutils/cbsd from Ole as it also allows working with jails and Xen, not just bhyve. There are also some other goodies in there.

1. I followed the link from elgrande and port installed vm-bhyve and configured it to the extent of the instructions on the freshports page.
2. I have port installed cbsd.

I am not sure if the steps Andrey Lanin mentioned bhyve-firmware uefi-edk2-bhyve uefi-edk2-bhyve-csm have been completed as part of the port installation process. I haven't created virtual network interfaces nor created the bridge. Haven't added anything to /etc/rc.conf /boot/loader.conf /etc/sysctl.conf

Please tell me the next steps, including some specifics about what directory to download the vm image into, and how to install. Is it ok to repeat the steps outline in Andrey's steps outlined above over and top of what has been done already, or have I created an environment different from what is relevant for Andrey Lanin 's instructions?

Thank you.
 
The manual has everything you need to start a single FreeBSD guest.
Start there and work up to Win10.
Sections 22.6.4 and Sections 22.6.7 are what I recommend.
Forget networking for now. Get a single VM up and nmdm into it.
Serial console is the easiest way to reach your VM's
 
Ahh you need two crutches? That will really help you..
NOT
My understanding is that CBSD provides an overall management to run bhyve and that it would not be a conflict to install them both.

The manual has everything you need to start a single FreeBSD guest.
Start there and work up to Win10.
Sections 22.6.4 and Sections 22.6.7 are what I recommend.
Forget networking for now. Get a single VM up and nmdm into it.
Serial console is the easiest way to reach your VM's

CBSD is a software project intended as a management layer for the FreeBSD Jail subsystem, written to utilize jail(8), bhyve and Xen.

Thank you. Section 22.6 is what definitely helps me move forward, for a start.
 
Back
Top