FreeBSD on Hetzner dedicated servers

The European cloud and dedicated server provider Hetzner has silently dropped support for FreeBSD. A FreeBSD rescue system is not offered anymore so users running dedicated servers with FreeBSD may run into difficulties if anything goes wrong. But luckily it is still possible to install FreeBSD using a mfsBSD image and to manage the installation from the Linux rescue system to some degree if using a root-on-ZFS installation.

If you have a fresh new server, it is quite easy to get into a FreeBSD rescue system, here are the steps:

  • boot the Linux rescue system
  • download a recent mfsBSD image (.img not .iso)
    wget https://mfsbsd.vx.sk/files/images/13/amd64/mfsbsd-13.1-RELEASE-amd64.img
  • write the image to the first drive
    • if it is a SATA or SAS drive
      dd if=mfsbsd-13.1-RELEASE-amd64.img of=/dev/sda bs=1m
    • if it is a NVMe drive
      dd if=mfsbsd-13.1-RELEASE-amd64.img of=/dev/nvme0n1 bs=1m
  • reboot the system
  • now you can login via SSH with the password “mfsroot”
    • if you want a secure password or an authorized key, you need to build your own mfsBSD image

I recommend using ZFS-on-root installs (e.g. the “zfsinstall” tool bundled in mfsBSD), so that in case of a problem you can import the zfs pool from the Linux rescue system and make changes to configuration files if necessary. The only thing that that cannot easily be installed from the Linux rescue system is the FreeBSD boot code.

If you are using a newer dedicated server that supports booting from UEFI, you can create an UEFI partition for booting and install and actually do a complete FreeBSD installation from the Linux rescue system.

More advanced users can setup grub to boot FreeBSD from ZFS, but there are many limitations to supported pool features and the user may require two ZFS pools. I personally recommend sticking to the FreeBSD boot loader.

Example minimalistic /etc/rc.conf with Hetzner-specific network configuration:

hostname="myhost"
zfs_enable="YES"
sshd_enable="YES"
ifconfig_igb0="inet A.B.C.D/32"
ifconfig_igb0_ipv6="inet6 AAAA:BBBB:CCCC:DDDD::2"
gateway_ip4="A.B.C.E"
gateway_if="igb0"
static_routes="gateway default"
route_gateway="-host $gateway_ip4 -interface $gateway_if"
route_default="default $gateway_ip4"
ipv6_defaultrouter="fe80::1%$gateway_if"

Explanations:

  • A.B.C.D is your IPv4 address
  • A.B.C.E is your IPv4 gateway
  • AAAA:BBBB:CCCC:DDDD::2 is your IPv6 address
  • igb0 is your network interface

Example minimalistic /boot/loader.conf:

zfs_load="YES"
vfs.root.mountfrom="zfs:rpool/ROOT/FreeBSD"

Posted in Uncategorized

0 thoughts on “FreeBSD on Hetzner dedicated servers

  • Hi! Thank you for that information.
    I just wanted to migrate a few hosts to Hetzner next week – now I will host them my own as I do currently. Quite bad, I liked Hetzner so far.

    Is there any official documentation about the reason they’ve done that?
    THX

    • Martin Matuška says:

      I have only unofficial information – the number of uses of the rescue system was low and the company focuses now on other projects.

  • I understand this system will allow one to install FreeBSD on a bare server. But what can one do if he needs to access the server in Rescue mode, for example to fix a fstab file, a firewall port, etc?

    Will the Linux Rescue mode allow to mount zroot/ROOT/default in edit mode?

    The way we have been doing this, was to have a USB thumbdrive always attached to the server, with the wonderful mfsBSD image. It is a small extra fee, but well worth it.

  • subnetspider says:

    Hi, thanks for the writeup.
    I want to install FreeBSD on a dedicated Server where IONOS only offers Linux (or Windows).
    I followed your instructions, downloaded and then flashed the .img file to the harddrive with dd.
    Unfortunatelly, after I reboot the Server, mfsBSD gets stuck while trying to mount /dev/md0 and tells me to manually mout it via mountroot:


    mountroot: waiting for device /dev/md0...
    Mounting from ufs:/dev/md0 failed with error 19.
    ...
    mountroot>

    Afaik error 19 means the device was not found, but that is about all I could find out.
    Trying this in a Proxmox Debian 11 VM results in the same behavior, tried it with the FreeBSD 13.0 and 13.1 image.

    I also tried to manually build a mfsBSD image via the instructions in the FreeBSD Handbook, however here I can’t even build the image (make complains it cant find DIST/base and DIST/kernels).

    I don’t know what I am doing wrong nor do I know how to fix this, neither can I find any helpful informations. Any help would be much appreciated.

Leave a Reply to Christian Cancel Reply

Your email address will not be published.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>