Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hostname is not set on Hetzner cloud VPS after flatcar-reset #1604

Open
jmacdonagh opened this issue Dec 30, 2024 · 0 comments
Open

Hostname is not set on Hetzner cloud VPS after flatcar-reset #1604

jmacdonagh opened this issue Dec 30, 2024 · 0 comments
Labels
kind/bug Something isn't working platform/hetzner

Comments

@jmacdonagh
Copy link

Description

After flatcar-reset and a reboot on a Hetzner VPS, /etc/hostname does not exist and the machine's hostname will default to localhost.

Impact

You must manually ssh in to set the hostname, or remember to add -K /etc/hostname to flatcar-reset.

Environment and steps to reproduce

  1. Build and upload a snapshot of Flatcar for Hetzner following these steps and hcloud-upload-image. In this case it is Flatcar Container Linux by Kinvolk stable 4081.2.1 for Hetzner
  2. Transpile a minimal ignition config, for this example:
variant: flatcar
version: 1.0.0
storage:
  files:
    - path: /foo/bar
      mode: 420
      contents:
        inline: Hi
  1. Create a Hetzner cloud VPS, choose the uploaded snapshot, select your pre-existing SSH key, add the transpiled ignition under "Cloud config", choose a hostname, create the server.
  2. Once created and booted, ssh in. Note /etc/hostname exists and has the name of the VPS. Note that /foo/bar exists and has the contents "Hi".
  3. Run sudo flatcar-reset -K '/etc/ssh/ssh_host_.*' '/var/log' && sudo reboot
  4. After rebooted, ssh in. Note that the shell prompt says core@localhost and that /etc/hostname does not exist. Note that running hostname returns localhost. Note that /etc/hostname does not exist. Note that /foo/bar exists and has the contents "Hi".

Expected behavior

After flatcar-reset, the server should boot with the existing hostname configured.

Additional information

Looking through the logs during the reboot after flatcar-reset, it looks like Ignition is running successfully, and that /sysroot/etc/hostname is being written.

Dec 30 04:19:13 localhost systemd[1]: Starting initrd-setup-root.service - Root filesystem setup...
Dec 30 04:19:13 localhost coreos-metadata[800]: Dec 30 04:19:13.521 INFO Fetching http://169.254.169.254/hetzner/v1/metadata/hostname: Attempt #1
Dec 30 04:19:13 localhost coreos-metadata[800]: Dec 30 04:19:13.523 INFO Fetch successful
Dec 30 04:19:13 localhost coreos-metadata[800]: Dec 30 04:19:13.524 INFO wrote hostname my-new-server to /sysroot/etc/hostname
Dec 30 04:19:13 localhost systemd[1]: Finished flatcar-metadata-hostname.service - Flatcar Metadata Hostname Agent.

If I search through the logs I see Ignition running successfully 7 times after the flatcar-reset and reboot. Additionally, /run/metadata/flatcar has the correct COREOS_HETZNER_HOSTNAME var.

I have the full set of logs available if needed. From a quick (uneducated) glance I wasn't able to see a definitive difference between the initial boot and the reboot after flatcar-reset that would explain this.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working platform/hetzner
Projects
Status: 📝 Needs Triage
Development

No branches or pull requests

2 participants