$ uname -a A_BLOG_ABOUT_UNIX_TOOLS_AND_THE_BEAUTY_OF_SIMPLE_SYSTEMS
SYS.YEAR  2026
← Back to articles
2026-09-01ARTICLE

Blog Netbsd Vm

Running NetBSD 11 on bhyve

Prerequisites

  • FreeBSD host with bhyve (tested on 15.1-RELEASE)
  • vm-bhyve for VM management
  • NetBSD 11 install ISO

Step 1: Create the vm-bhyve configuration

Create /vm/netbsd11/netbsd11.conf:

loader="uefi"
cpu="2"
memory="2G"
network0_type="virtio-net"
network0_switch="public"
network0_mac="58:9c:fc:09:0b:12"
disk0_type="ahci-hd"
disk0_name="disk0.img"
uuid="d321439d-9332-11f1-886a-681def3efed7"
xhci_mouse="no"

Key settings:

  • loader="uefi" - NetBSD 11 requires UEFI boot on bhyve
  • disk0_type="ahci-hd" - use AHCI, not virtio-blk (NetBSD bhyve compatibility)
  • xhci_mouse="no" - prevents the xhci USB 3 driver from crashing bhyve

Step 2: Install NetBSD 11

vm create netbsd11
vm install netbsd11 /path/to/NetBSD-11.0-amd64.iso

Go through the standard NetBSD installer. Use GPT partitioning and UEFI boot.

Step 3: Serial console (critical!)

bhyve with UEFI has no VGA framebuffer by default. The NetBSD bootloader defaults to VGA output, so the boot appears to hang after "Loading /var/db/entropy-file" because all output goes to a display that doesn't exist.

At the boot menu, press 3 to drop to the boot prompt, then:

> consdev com0
> boot

This redirects all console output to the serial port, which bhyve maps to /dev/nmdm-<vmname>.1A.

To make this permanent, after booting, edit /boot.cfg:

menu=Boot normally:rndseed /var/db/entropy-file;consdev com0;boot
menu=Boot single user:rndseed /var/db/entropy-file;consdev com0;boot -s
menu=Drop to boot prompt:prompt
default=1
timeout=5
clear=1

Step 4: Enable SSH root access

# Set root password
passwd root

# Edit sshd_config
vi /etc/ssh/sshd_config

Set:

PermitRootLogin yes

Restart sshd:

/etc/rc.d/sshd restart

Troubleshooting

Boot hangs at "Loading /var/db/entropy-file"

The bootloader is sending output to VGA, but bhyve has no display. Use consdev com0 at the boot prompt. See Step 3.

bhyve crashes with signal 11 (segfault)

The xhci (USB 3) driver crashes bhyve. Set xhci_mouse="no" in the vm-bhyve config.

Connecting via serial console from the host

# Find the nmdm device
ls /dev/nmdm-netbsd11*

# Connect with cu or tip
cu -l /dev/nmdm-netbsd11.1A -s 115200

Or via vm-bhyve:

vm console netbsd11

Next steps

Once NetBSD is running with SSH access, you can proceed to install additional software. See BLOG_CELLS.md for setting up Cells isolation with a Caddy web server.