bhyve Using bhyve to run Kali

Greeting! I am considering taking a class locally in Cyber Security. This class will make use of the Kali distribution. I see a good opportunity to explore bhyve here, and I am hoping to install bhyve on my 14.4-RELEASE system, and then install a Kali Linux distribution as the guest software on that VM. It's pretty much all new to me, so I would like to know if anyone has done this, and if you have any tips for a novice. Any help and suggestion would be really appreciated.

I have never used Kali, but I suspect that it makes use of a graphic environment. I don't mind a command line interface at all -- that is how I do most of my FreeBSD work. But if a remote graphics setup can be made, that's icing on the cake. Note: By "remote" I mean something like what I presently do for some work: I write VHDL code from time to time, and use ghdl to compile and gtkwave to view simulations. I view those simulations on my MacBook air by running a (Quartz) xterm window with a command line like: xterm -e ssh -X foo@bar gtkwave design.ghw design.gtkw. I don't know if that could be done with Kali, and if not, I can cope with the CLI.

I do the remote viewing on the Mac because my FreeBSD systems are "headless", and I don't often need graphics. I run gimp this same way and it gets the job done.

Any pointers or suggestions are welcome. Thank you.
 
Long time ago, I set a Kali VM under bhyve. It worked and it's likely to still work.

I advise you to use sysutils/vm-bhyve even if I don't use it myself. It's a good and efficent wrapper around bhyve that will easier your life.

Use UEFI booting and don't forget to set uefi_vars=yes in its config file. You connect to the VM with a vnc client.
 
Kali is just another distribution of Linux. It does have some tools to make your life easier (venom generator). Not sure if pwntools is installed there by default. I personally never used it, I stayed true to my favorite Linux distribution. But Kali does make sense if you are starting to learn, you'll easily google information you need. I guess AI will be able to assist you easier too.

I can't personally advise on bhyve, The setup you've described should work though, there's no reason why not.
If you hit a problem with bhyve you still have /accelerated/ option - VirtualBox (though you can't mix two on a same host, they both use vmm).
Personally I'd run Kali on osx with VMware or UTM (qemu).

As always the best way to start tinkering with it is to go through handbook.
 
I am hoping to install bhyve on my 14.4-RELEASE system
No need to install it, it's included with the base OS.

Also highly recommend sysutils/vm-bhyve, it's a nice collection of wrapper scripts that make creating, configuring and running bhyve(8) VMs a breeze.

I have never used Kali, but I suspect that it makes use of a graphic environment.
Enable EFI boot and graphics for the VM. Then you can use a VNC viewer to connect to the VM's graphical console. Other than that, ssh X-forwarding could certainly be a viable option. If Kali supports that, not sure what it uses for graphics (Wayland or X11?).
 
I had installed kali under bhyve in 2024. Yesterday I did "apt update; apt full-upgrade" and it upgraded to kali 2026.3 from 2024.2 & kernel from 6.16.8 to 7.0.12 painlessly. startx brought up Xorg and Xfce (in a vnc window).
 
it of course depends what software you will be using, however, for anything graphical I do NOT recommend x-forwarding or vnc, use xrdp instead - simply install xrdp server on kali and use your remote desktop protocol client software.
 
Thanks to everyone for your input.

I followed the Handbook's instructions today for setting up a FreeBSD Host with bhyve and the section for Creating a Linux Guest. I am stuck in the process. The Handbook says that after I run grub-bhyve, the Linux kernel should be loaded and I can proceed with starting bhyve. This is where I am hung up. When I run grub-bhyve, the grub.cfg file is found and I get a menu for installing Kali. ( This is all done via sshd into the target machine. ) I select the Install option rather than the Graphical install option. The menu exits immediately. The host where I am installing happens to have a monitor attached at the moment, so I tried this at the monitor, with the exact same results. It also exits immediately with the Graphical Install option.

Here is what I did to set this up. Note the directory where I have the VM disk image also contains a copy of the installation .iso file.
( I omitted the network configuration steps from the listing below. )

Code:
root@dagobah:/home/matt # pkg install vm-bhyve
root@dagobah:/home/matt # kldload vmm
root@dagobah:/home/matt # mkdir /mnt/vm/kali
root@dagobah:/home/matt # cd /mnt/vm/kali
root@dagobah:/mnt/vm/kali # truncate -s 25G kali.img
root@dagobah:/mnt/vm/kali # pkg install grub2-bhyve
[matt@dagobah /mnt/vm/kali]$ cat device.map 
(hd0) ./kail.img
(cd0) ./kali-linux-2026.2-installer-amd64.iso

[matt@dagobah /mnt/vm/kali]$ lal
total 4691276
-rw-r--r--  1 matt wheel  4802531328 Aug  4 14:26 kali-linux-2026.2-installer-amd64.iso
drwxr-xr-x  3 root wheel         512 Aug  5 13:32 ..
-rw-r--r--  1 root wheel 26843545600 Aug  5 13:34 kali.img
drwxrwxrwx  2 root wheel         512 Aug  5 14:00 .
-rw-r--r--  1 matt wheel          63 Aug  5 14:01 device.map

root@dagobah:/mnt/vm/kali # grub-bhyve -m device.map -r cd0 -M 4096M kalivm

Again, I am looking for a suggestion to allow me to proceed. I don't see what I am doing wrong.

One other thing - the Handbook suggests that after running grub-bhyve, the Linux kernel
should be running, and the virtual machine can then be started. That seems odd to me -- I would think the
Linux kernel boots when the virtual machine starts.

But in any case the Kali distribution is not being installed. Their web page installation instructions did not give me any insight, unless having the .iso image on disk, and NOT on a CD-ROM is the issue.

Thanks for any help.
 
You don't need grub-bhyve. I did a fresh install just to check. This is what I used:
Code:
bhyve -c 1 \
        -s 0,hostbridge \
        -s 4,ahci-cd,kali-linux-2026.2-installer-amd64.iso \
        -s 5,nvme,kali.img \
        -s 10,virtio-net,tap1,mac=11:22:33:44:55:66 \
        -s 20,xhci,tablet \
        -s 31,lpc \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        -s 11,fbuf,tcp=0.0.0.0:5901,w=1920,h=1080 \
        -l com1,/dev/nmdm1B \
        -m 2G -H \
        kali
I chose the graphical install via a vnc window and basically chose all defaults. After installation, on restart it came up fine. I didn't even have to remove the .iso arg from the command line. Hope you can map these args for vm-bhyve (or someone here will help you). [I did this on a 15-stable system, should work on 14.4]
 
You don't need grub-bhyve. I did a fresh install just to check. This is what I used:
Code:
bhyve -c 1 \
        -s 0,hostbridge \
        -s 4,ahci-cd,kali-linux-2026.2-installer-amd64.iso.iso \
        -s 5,nvme,kali.img \
        -s 10,virtio-net,tap1,mac=11:22:33:44:55:66 \
        -s 20,xhci,tablet \
        -s 31,lpc \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        -s 11,fbuf,tcp=0.0.0.0:5901,w=1920,h=1080 \
        -l com1,/dev/nmdm1B \
        -m 2G -H \
        kali
I chose the graphical install via a vnc window and basically chose all defaults. After installation, on restart it came up fine. I didn't even have to remove the .iso arg from the command line. Hope you can map these args for vm-bhyve (or someone here will help you). [I did this on a 15-stable system, should work on 14.4]
bakul, thanks for the note. You have given me a few things to try: I will attempt to map this to vm-bhyve after I study its man page for a while. I will also give the VNC connection a try right from the start rather than doing the install via sshd. I'll give this a try tomorrow. The host machine does not have UEFI, so I will need to get that figured out. The curse of old hardware I suppose.

Thanks!
 
You just need to have edk2-bhyve installed.

Some people advised you to install vm-bhyve because it simplifies the first contact with bhyve, it's not without reason. And again, some people told you to use UEFI, because only UEFI make vnc connection to the VM possible.
 
here is my vm-bhyve configuration file:

loader="uefi
cpu=2
memory=8192M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
uuid="f67252bf-79f0-41a3-952d-d3d78579b304"
network0_mac="58:9c:fc:0f:4c:b3"

graphics="yes"
graphics_listen="192.168.1.11"
graphics_port="5966"
graphics_vga=io

After installing that, "vm install kali /isos/kali-install.iso" should start the installation, and with a vncviewer you can connect (in my case to the LAN interface 192.168.1.11 port 5966") and install or use the kali live image.
 
Back
Top