Reinstalling an openbsd.amsterdam VM from Scratch

· technology · revision 1


I had to reinstall the openbsd.amsterdam VM. The nice thing about their setup is that even if the guest VM is inaccessible over SSH, you can SSH into the physical host and manage your VM with vmctl.

For convenience, lets assume the VM is named vm99 on server88.openbsd.amsterdam and make sure you have access to the network info, that can be found at the introductory email.

1. Connect to the host

OpenBSD Amsterdam provides SSH access to the host on a high port. Details can be found in the introductory email. Using the same username and SSH key associated with the VM, access the base system and check the VM status:

ssh -p 31415 atma@server88.openbsd.amsterdam
vmctl status vm99

2. Stop the existing VM

vmctl stop vm99
vmctl status vm99

Wait until its state is stopped. There is no need to delete or recreate the VM’s disk image. The OpenBSD installer can simply overwrite the existing installation.

3. Boot the OpenBSD installer

OpenBSD Amsterdam keeps bsd.rd, OpenBSD’s RAM-disk installation kernel, on the host. Boot the VM from it:

vmctl start -b /var/vmm/bsd.rd vm99

Then attach to its serial console:

vmctl console vm99

You should eventually see:

(I)nstall, (U)pgrade, (A)utoinstall or (S)hell?

Choose I to start the installation. To detach from the console later without stopping the VM, press Enter, followed by tilde and dot ~..

4. Install OpenBSD

Proceed through the normal OpenBSD installer. For networking, use the IPv4/IPv6 addresses, netmasks and gateways provided in the original OpenBSD Amsterdam onboarding email. The VM’s virtual network interface is normally vio0. For the console, answer:

Change the default console to com0? [yes]

Keep yes. This is important because it allows the VM to remain accessible through vmctl console.

For the disk, a whole-disk MBR/OpenBSD layout followed by OpenBSD’s automatic filesystem layout works well with vmd. It’s a common best practice to install all sets.

5. Reboot

When installation finishes:

CONGRATULATIONS! Your OpenBSD install has been successfully completed!
Exit to (S)hell, (H)alt or (R)eboot? [reboot]

Reboot the VM. Because bsd.rd was supplied with vmctl start -b, it was only used for that boot. The VM should subsequently boot normally from its newly installed virtual disk.

Log in through the console and apply security patches:

su -
syspatch
reboot

Finally, check for remaining patches:

syspatch -c

And that should do it!