Vmm /

OpenBSD VMM Install Guide

In this guide, we discuss how to install an OpenBSD virtual machine inside VMM.

NOTE: This guide is no substitute for reading the OpenBSD FAQ. In particular, you should read the Installation Guide

  1. vmm is a hypervisor, which allows us to run multiple virtual machines inside a single physical server (a dedicated server). Your virtual machine is a guest which lives inside the host. You will first need to connect to the host, which runs the hypervisor. The hostname may be of the form host.example.com. Check your email or contact your network admin if you are uncertain.
    1. NOTE: The host machine (host.example.com) is NOT the guest virtual machine (username.host.example.com). Your virtual private server runs as a guest inside a host machine. You have root access inside your guest machine, but not the host machine.
    2. NOTE: The host is not your personal virtual machine (VM). Your personal VM is a guest inside the host. The guest lives inside the host, so in order to get serial console access to the guest, you must first log in to the host.
  2. Read up on vmctl for how to administer your virtual machine. NOTE: VMM uses ssh rather than VNC or a webpanel to administer your virtual machine.
  3. Once inside the host machine, type:
    $ vmctl console <VM name>
    

    Make sure to replace <VM name> with the actual virtual machine name. The VM name will be in your email, and is likely your username.
This will open the serial console, so you can administer the virtual machine during bootup.
$ ssh host.example.com
Last login: Sun Apr  7 16:16:18 2024 from 172.56.233.107
OpenBSD 7.4 (GENERIC.MP) #2: Fri Dec  8 15:39:04 MST 2023

NOTE: This is the host, not the guest!
...
username$ vmctl console username
Connected to /dev/ttypd (speed 115200)
  1. At any time, if you want to escape the serial console, type ~. (tilde followed by a period) or ~^d (tilde followed by ctrl+d). Note: ^d is ctrl+d. Sometimes, you may need to press enter a few times before the ~. or ~^d combination works. On some keyboards, you may need to type ~~. (two tildes followed by a period).
  2. You can safely ignore the error message Boot failed: not a bootable disk. By default, your virtual machine will boot from the OpenBSD ISO image when there is no operating system installed. After the OS is installed, your virtual machine will automatically boot from hard disk instead of ISO image. There is no need to mount/unmount the ISO image.
    Boot failed: not a bootable disk
    
    CD-ROM: E0
    Loading /7.5/AMD64/CDBOOT
    probing: pc0 com0 mem[638K 2046M a20=on]
    disk: hd0+* cd0
    >> OpenBSD/amd64 CDBOOT 3.65
    boot> 
    cannot open cd0a:/etc/random.seed: No such file or directory
    booting cd0a:/7.5/amd64/bsd.rd: 4076463+1688576+3891240+0+708608 [109+464016+317541]=0xaa40e8
    entry point at 0xffffffff81001000
    Copyright (c) 1982, 1986, 1989, 1991, 1993
            The Regents of the University of California.  All rights reserved.
    Copyright (c) 1995-2024 OpenBSD. All rights reserved.  https://www.OpenBSD.org
    
    OpenBSD 7.5 (RAMDISK_CD) #76: Wed Mar 20 15:53:54 MDT 2024
    
  3. Once you see the bootup screen, follow the normal install instructions.

Upgrade/Reinstall with bsd.rd

NOTE: OpenBSD now provides sysupgrade for unattended system upgrades. For routine system upgrades, sysupgrade is preferred.

  1. To delete all data on your disk and reinstall the operating system, see the OS reinstall guide.
  2. If you want to upgrade or reinstall the operating system, follow the bsd.rd install guide. You will want to type something immediately after you see the boot prompt to prevent the system from automatically booting the default kernel. Alternatively, you can edit /etc/boot.conf. If the system automatically boots by accident, you will need to restart the system. You can log in and then run $ doas shutdown -r now to reboot.

Bug fixes

VMM appears to have a bug where VMs lose network connectivity after a few hours. Here is one workaround.

Run these command to add this cronjob:

# echo "@reboot /usr/bin/tmux new -d 'while true; do /sbin/ping -i5 104.167.242.129; done' \;" >> /var/cron/tabs/root
# /usr/bin/tmux new -d 'while true; do /sbin/ping -i5 104.167.242.129; done' \;

Alternatively, you can manually add this line to the bottom of your crontab:

@reboot /usr/bin/tmux new -d 'while true; do /sbin/ping -i5 104.167.242.129; done' \;

This helps ensure that a ping runs in the background to keep the network alive.

See Also

vmctl(8)VMM User Guide