Omnipotent OpenBSD

Published on 2022-03-09 by Andrei

Cool tips and tricks or just general advice about OpenBSD :D

There is a lot of cool things about OpenBSD so instead of making a separate post about each one I've decided to just make one post and keep updating it with different content.

Playing Tetris in the terminal (as well as some other old-school Unix games)

If you selected the games set when you installed the system, you simply run tetris in your terminal to play a nice round of old-school tetris.

Check out man 6 intro for even more fun games you can play in your spare time. Some of them are even somewhat useful, such as random(6), banner(6), and factor(6)

(pig(6) is also a must-try)

Using vmctl(8) and vmd(8) to create and manage virtual machines.

OpenBSD does not support KVM or XEN virtualization, but it does have a virtualizer of it's own, vmm. It's comparatively limited and only supports a single CPU per virtual machine but you can do some pretty cool stuff with it.

First, enable and start the hypervisor service. vmd is included within the base OS install, so there's no need to install any additional software.

# rcctl enable vmd
# rcctl start vmd

You can now use vmctl(8) to create the VM image.

# vmctl create -s 20G disk.qcow2

This will create a 20GB qcow2 image.

Now we can boot into the VM!

# vmctl start -m 8G -L -i l -r installX.iso -d disk.qcow2 test

This create a VM called "test" that has 8GB of ram allocated and has access to the host's network adapter, and have it boot from the "installX.iso" file. Do note that to actually get network access within the VM you may need to edit your /etc/pf.conf.

To actually connect your terminal to the newly created VM can do # vmctl console test. Obviously if you specified a different VM name when you started the virtual machine replace "test" with the name you specified.

Now you can do whatever you want with it! Any operating system that supports a serial console output could theoretically be able to be used within vmm, although it's works much better out of the box with an OpenBSD guest.

Keeping your system up to date

Although OpenBSD has a lot of security features and the code is rigorously audited, sometimes bugs do pop up in the stable release.

To combat this, regularity run the syspatch(8) utility to download any necessary security or bug fix patches for your system.

# syspatch

Also make sure to update your packages to the latest patched version as sometimes security vulnerabilities are found within packages as well.

# pkg_add -u

Stay tuned! I might update this page in the future.