Avatar (Fabio Alessandro Locati|Fale)'s blog

Fedora CoreOS on Hetzner Dedicated server

October 19, 2023

Over the last few years, I’ve moved many of my systems to Immutable versions of Fedora. One of the last systems still missing was my Hetzner Dedicated server. The blocking part for me was that Hetzner is not offering any Fedora or Immutable options.

However, Hetzner provides the Rescue System, which is a Debian system, so it is possible to leverage it!

After rebooting in Rescue mode: Go to Hetzner Robot. Select the proper server. Go to the “Rescue” tab. Click “Activate rescue system” after properly selecting the Public Key and keyboard layout. You can now reboot the machine, and after it boots back up, you can log in to the Rescue System.

The first thing we will need is butane. Since butane is not available in Debian, it is possible to get it directly from GitHub as follows:

curl --request GET -sL \
       --url "https://github.com/coreos/butane/releases/download/v0.19.0/butane-$(uname -m)-unknown-linux-gnu"\
       --output "/usr/local/bin/butane"
chmod +x /usr/local/bin/butane

We will also need Rust. Even though Debian has it in the repositories, the available version of rustc is 1.63, while the minimum required version is 1.64. So, we can proceed with installing it from GitHub.

curl -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"

We can now install the required libraries and the coreos-installer itself.

apt install -y pkg-config librust-curl+openssl-sys-dev libzstd-dev
cargo install coreos-installer

We can create the butane file now that we have all the needed bits. In my case, I called it install.bu and inserted the following content in it:

variant: fcos
version: 1.5.0
passwd:
  users:
    - name: fale
      ssh_authorized_keys:
        - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDNr2XI48ClIf9F+HD5gNa7F92l/srsIUrUDWVW8XBAvfJxoakbpAHtQV88lN7+TJ31hb9g2HEuqDKH3Oz5aPDN09TOzf0RQkBrg9TsZ0fPRI75e+za5luF7JZZJtuxw9dsatlxCHmgLnYSoLTzsqMqsZPxe2OCA5Zlt3mQJLeKj6Fa3gePirj6nJc7mDWmG0TlvjGPtO97CLt8Ahd1P3HcOks3RQ581AsdJFn6yIUtZlSH7HFn78aD6Cv5PNhkUlqdx8r2cUlbeX6UCzL9JDAkb7TAjpRf8A1wdM9yBZqFMZG87JY9/05DcOwci4ZF4TV2kyfFwwfhcfJ6XcNvdahmVcmC7E3yVMdA8XXUtpjx4/P6MF6Tqyk65B8qZY/0R0pDTeXSiibz+9qtPE1flGV1smWJYnQWhTnrIR/D1kTTSVnFKBYn3UkXRCJSxdtBDCjuW9WcCBbwh9ul8piH7Ichl6BTbtc2VUyMLjjIpFVsaBHeKfSCUssvqSOxGztuS0bvCXy6Kf3vAIuh2Lcp4sZBRo0lMTjxVHWhREL54wcBPZfKvrPjXwsC/cq8A3SPzEJe0YNcXKxqoUGadM+478j6TxL9APZ9lVOQprEN7zaXEp3e17ljIIf6e7o9rXvWYS6rOKJRly1JIQvOKJVb5wr2O6Leo2Wf9TRrHX39Y7eCWw== cardno:15 418 722"
      groups:
        - wheel
        - sudo
boot_device:
  mirror:
    devices:
      - /dev/sda
      - /dev/sdb
storage:
  disks:
    - device: /dev/sda
    - device: /dev/sdb
  files:
    - path: /etc/hostname
      mode: 0644
      contents:
        inline: "hzn0.fale.io"

The three main parts that this file defines are the user, the disk layout, and the hostname.

In the user part, you will probably want to use your name instead of mine and set your public key since the one in the example is mine :).

In the disk layout parts, you can probably use the same I used if you have two disks and want to put them in software RAID 1. In my experience, two disks in RAID 1 is the typical setup for Hetzner Dedicated servers, so it will probably also work for you.

As for the hostname, you should set one that makes sense to you.

Now that we have the install.bu file, we can create the Ignition file and consequent installation of the system.

butane < install.bu > install.ign
coreos-installer install -i install.ign -s stable /dev/sda

You can now reboot, and you’ll be able to log in to your Fedora CoreOS system!

Overall, the process is not rocket science, but documenting it was a good idea since I could not find much about it on the web.