Eric Radman : a Journal

OpenBSD's VMM

Most of the examples below use command line options, but in general I find it much better to define VMs in vm.conf.

Alpine Linux

Use the virt edition of Alpine (the serial console is not enabled in the standard or extended images).

vmctl create -s 6G alpine.img
doas vmctl start -n local -i 1 -d ~/iso/alpine-virt-3.17.1-x86_64.iso -d /vm/alpine.img alpine
doas vmctl console alpine

First configure networking from the console

localhost login: root
# ifconfig eth0 172.16.0.7 netmask 255.255.255.0
# apk add openssh
# echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
# /etc/init.d/sshd restart
# passwd root
  XXXXXXXXXX

Then proceed by running the setup over an SSH connection

ssh root@172.16.0.7
# /sbin/setup-alpine

Modify boot timeout in /boot/extlinux.conf.

Fedora

vm "fedora" {
       disable
       boot device cdrom
       memory 2048M
       cdrom "/iso/Fedora-Server-netinst-x86_64-33-1.2.iso"
       disk "/vm/fedora.img"
       owner eradman
}

At the boot menu, press tab and add the boot options inst.text console=ttyS0 inst.sshd.

The installer will try DHCP, or set an ip address using

ip addr add 192.168.0.6/24 dev enp0s2
ip link set enp0s2 up
ip route add default via 192.168.0.1 dev enp0s2
dnf install @"Minimal Install"
rpm -e sudo
dnf remove @"Fedora Server Edition"
dnf install openssh-server sudo dhcp-client

To enable DHCP using Network Manager

dnf install NetworkManager
systemctl enable NetworkManager
systemctl start NetworkManager

nmcli connection modify enp0s2 ipv4.method auto
nmcli connection down enp0s2
nmcli connection up enp0s2

Ubuntu

Fetch mini.iso.

At the boot menu press tab and add the boot options console=ttyS0.

$ doas vmctl start -i 1 -B ~/iso/mini.iso -d ~/vm/ubuntu.img -m 1024M -c ubuntu

After install enable SSH

$ sudo apt install openssh-server

FreeBSD

FreeBSD is not yet supported (as of OpenBSD's 6.9)

vtnet0: Ethernet address: fe:e1:bb:d1:fe:3a
virtio_pci1: exhausted all interrupt allocation attempts
vtnet0: cannot setup interrupts

Create a FreeBSD image using qemu

#!/bin/sh -x

export ETHER=vether0
export BRIDGE=bridge0

qemu-system-x86_64 -m 512 -monitor stdio -vnc :0 -no-fd-bootchk \
   -net "nic,model=e1000,macaddr=fe:e1:bb:d1:8e:81" -net "tap,ifname=tap0" \
   -hda freebsd.qcow2 \
   -serial "telnet:localhost:4321,server,nowait" \
   -cdrom FreeBSD-13.0-RELEASE-amd64-bootonly.iso -boot d

After installing, enable the serial console

echo 'console="comconsole"' >> /boot/loader.conf

Test serial access using telnet

telnet localhost 4321

Arch Linux

The last known working version of Arch was 2019.07.01. Subsequent releases failt to find the mountpoint for the install image:

:: Mounting ‘/dev/disk/by-label/ARCH_202011’ to ‘/run/archiso/bootmnt’
Waiting 30 seconds for device /dev/disk/by-label/ARCH_202011 …
ERROR: ‘/dev/disk/by-label/ARCH_202011’ device did not show up after 30 seconds…
Falling back to interactive prompt
You can try to fix the problem manually, log out when you are finished
sh: can’t access tty; job control turned off
[rootfs ]#

Guix

Guix provides a qcow2 image, so no installation is nessesary.

Edit /etc/config.scm and add (service openssh-service-type) to the list of services. Run guix system reconfigure /etc/config.scm to apply.