Synopsis #
Install an amd64 Alpine Linux guest using vm-bhyve’s UEFI loader. First complete bhyve and vm-bhyve preparation , including a working datastore and a switch with the network access the guest needs.
The example uses a switch named public, a 16 GiB guest disk, and 1 GiB of RAM. The guest is separate from FreeBSD’s Linux compatibility layer
: it boots its own Linux kernel.
Prepare the template and installer #
Install UEFI firmware:
# pkg install bhyve-firmware
# vm switch list
In the datastore’s .templates directory, create alpine.conf with these settings:
loader="uefi"
cpu="1"
memory="1G"
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
graphics="yes"
graphics_listen="127.0.0.1"
xhci_mouse="yes"
Use the actual prepared switch name. Download the x86_64 Virtual ISO and its SHA-256 checksum from Alpine Linux . The commands below use version 3.24.4; use the filenames and checksum for the selected release:
# vm iso https://dl-cdn.alpinelinux.org/alpine/v3.24/releases/x86_64/alpine-virt-3.24.4-x86_64.iso
Run sha256 on the downloaded file in the datastore’s .iso directory and compare it with Alpine’s published checksum before booting it.
Create and install the guest #
# vm create -t alpine -s 16G alpine
# vm install alpine alpine-virt-3.24.4-x86_64.iso
# vm list
# vm info alpine
Find the VNC port in the output. It listens only on the FreeBSD host’s loopback address. From a workstation, forward that port through SSH; for example, if it is 5900:
$ ssh -N -L 5901:127.0.0.1:5900 admin@FREEBSD_HOST
Connect a VNC client to 127.0.0.1:5901 to release the installer’s firmware screen. Alpine’s Virtual image sends its login prompt to the serial console. On the FreeBSD host, connect with:
# vm console alpine
Log in as root and run:
# setup-alpine
Choose the keyboard, hostname, network settings, time zone, and a package mirror. Set passwords and create a normal user. Select vda, the guest’s virtual disk, and sys installation mode when prompted. This erases the selected guest disk; check its name and size before confirming.
Shut down from inside Alpine after installation:
# poweroff
Once vm list shows the guest stopped, start it without the installer:
# vm start alpine
Verify the installed system #
Reconnect with vm console alpine and log in. To detach without stopping the guest, press Enter and then ~.; through an SSH session, type ~~. instead. In Alpine, check the installed system, address, route, and name resolution:
$ cat /etc/alpine-release
$ uname -r
$ ip address
$ ip route
$ nslookup alpinelinux.org
A private vm-bhyve switch does not provide DHCP or Internet access by itself. If the guest has no address or default route, check that network’s DHCP or static configuration before changing the virtual disk or boot loader.
From the FreeBSD host, request a clean stop and restart:
# vm stop alpine
# vm list
# vm start alpine
Wait until it is stopped before starting it again. Confirm that the installed system boots and its files persist. Add autostart only after these checks succeed. A forced poweroff is for an unresponsive guest, not normal shutdown.