August 11th, 2024

OpenBSD 7.5 via QEMU on Hetzner physical machine (no phys. access / KVM console)

The article details installing OpenBSD 7.5 on a Hetzner server using QEMU, involving RAID1 setup, encrypted partitions, and utilizing Hetzner's rescue system for ISO installation without direct access.

Read original articleLink Icon
OpenBSD 7.5 via QEMU on Hetzner physical machine (no phys. access / KVM console)

The article discusses the process of setting up OpenBSD 7.5 on a Hetzner physical server using QEMU, without direct access to the installation images or a KVM console. The author outlines the steps taken to install OpenBSD, including the use of Hetzner's rescue system to download the installation ISO and configure the server. The setup involves creating a RAID1 configuration with two SSDs and an encrypted partition. The author emphasizes the need for a method that allows full control over the server, including access to a rescue mode. The installation process is detailed, including commands for wiping existing data on the SSDs, downloading the OpenBSD installation image, and configuring QEMU to boot from the ISO while using the physical disks. The article also provides hardware specifications of the server, including CPU, memory, and disk information, which are crucial for the installation process. The author concludes with a successful boot into the OpenBSD installation environment, demonstrating the effectiveness of the outlined method.

- OpenBSD 7.5 can be installed on a Hetzner server using QEMU without physical access.

- The setup includes RAID1 on two SSDs and an encrypted partition.

- The process utilizes Hetzner's rescue system to download the installation ISO.

- Commands for wiping existing data and configuring QEMU are provided.

- The article includes hardware specifications relevant to the installation.

Link Icon 15 comments
By @clan - 5 months
Nice write-up. It should really not be that hard but unfortunately it is. And it is getting worse.

It made me sad to see that Hetzner had discontinued the FreeBSD rescue system. But it seems to be correct: https://community.hetzner.com/tutorials/freebsd-openzfs-via-...

How much did it really cost them to have the mfsbsd image available?

By @Hetzner_OL - 5 months
On the off-chance that the author of the original text sees this, please know that I have passed it onto a few colleagues here at Hetzner. For those here who have posted other workarounds, thanks for that. And thanks to others for other constructive comments here. --Katie (Hetzner)
By @benlivengood - 5 months
I tried a couple times to get OpenBSD 7.4 and 7.5 booting on EC2 and GCE with no luck (hang during the bootloader). I ended up going with https://openbsd.amsterdam but it would be nice to have working images in the major cloud providers.
By @daneel_w - 5 months
This seems unusually complicated. With Hetzner's infra you should be able to just boot the install kernel ("miniroot") and proceed from there with a normal networked installation via their serial console. Same method also works with Oracle Cloud and Scaleway - I keep OpenBSD VPSes with both of them.
By @Cyph0n - 5 months
nixos-anywhere is a tool that allows you to do something similar (?) to install NixOS in-place on a remote machine (using kexec “magic” under the hood).

https://github.com/nix-community/nixos-anywhere

I tried it on a Hetzner VPS and was honestly pretty surprised that it even worked. What makes it even cooler is that you can continue to rebuild the machine’s config remotely even after initialization (thanks to NixOS).

By @accrual - 5 months
Pretty clever to boot a virtual QEMU VM and pass through the physical disks for installation. Nice that it can be done without a support request.
By @dim13 - 5 months
Well, I did it 11 years ago. There is little magic. Boot linux rescue system. Fire qemu. Go with auto-install. Even with raid setup if you want to. Done.

The only tweak -- auto-detection of swap space, as it is derived from RAM available and you cannot give all 100% RAM to qemu. So you need to adjust for it.

https://www.dim13.org/Install-OpenBSD-on-remote-host-without...

By @dtx1 - 5 months
Linux/Unix Kernels allow you to do some insane stuff. My best current example was swap on VRAM but this is even better.
By @blacklion - 5 months
Discontinuation of FreeBSD rescue system catches me off-guard when I ruined boot of my FreeBSD system by inaccurate ZFS operations (not ZFS or FreeBSD fault, but operator's one).

Trick with qemu works, but is veeeeery slow if you need a lot of disk access (ZFS zmirror scrub, or ZFS `send | receive` pipe or something like this).

By @evanjrowley - 5 months
This site is built on CodiMD, which seems like a really cool platform for editing and publishing markdown: https://github.com/hackmdio/CodiMD
By @anyfoo - 5 months
Website seems to have gotten HN’s hit of death, but the headline sounds fun.

I’ve also got OpenBSD 7.5 running on a Hetzner server, but it runs “natively”. By which I mean it’s still a VM from Hetzner, but I don’t have my own nested QEMU layer or anything.

By @gregnavis - 5 months
I host a virtual machine with Hetzner and it runs OpenBSD: the image was right there in the "ISO Images" tab. It seems that setting up a physical server with OpenBSD is much more complicated, though.
By @dspearson - 5 months
I do the exact same for Illumos, just ripped ideas from depenguin.me (which is how I previously installed FreeBSD after they discontinued the rescue system).
By @dvzk - 5 months
QEMU most likely is not required. OpenBSD's installer is inside a single 4.5 MiB [1] ramdisk kernel image. Chainload or netboot it, or download the ramdisk to ffs on sd0 and run installboot [2]. Once the ramdisk kernel is loaded you can erase the disk containing it.

1. https://cdn.openbsd.org/pub/OpenBSD/7.5/amd64/bsd.rd

2. installboot also needs /usr/mdec/biosboot and /usr/mdec/boot from base75.tgz.