Nixos-anywhere deployed server becomes unreachable after setup

Hi everyone!

Using nixos-anywhere, i deployed Nixos to Ubuntu and Debian VPS’ hosted by contabo, seemingly successful. But after the server reboot, the system is completely unreachable (ssh times out, ping gets lost).
I followed nixos-anywhere’s quick-start guide without any major modifications. The setup runs without any errors and finally echoes “### Done! ###”

How do i even start to debug this?

output of:

nix run github:nix-community/nixos-anywhere -- \
      --generate-hardware-config nixos-generate-config ./hardware-configuration.nix \
      --flake ./#generic \
      --target-host root@212.90.120.119 \
      --debug \
      2>&1 > output.txt

Is here

Maybe related: i can access the vm’s terminal via vnc and it shows the login shell, but it won’t accept the root password (i temporarily tried very simple ones to rule out misstypes)

If i set a password with users.users.root.hashedPassword i can at least login via a VNC-viewer.
ip addr then shows, that the ip has changed, which would explain why icmp and ssh goes nowhere.

Do you have an ssh key set up in your configuration.nix ?

yes.
Contabo also uses netplan to configure the interfaces, which means i have a handy .yaml file as a template to define interface addr. and routes in my nix config.

bit of a headache, but let’s see if this works.

I think I forgot to read the log you posted, so you have your public ssh key set up.
I can only say that I use a vaguely similar deployment on hetzner and for logging on to the deployed vm I use a match block (HostName is the ip of the vm obviously) in my ssh_config whatsoever and ssh thefinevm to log onto it:

Host thefinevm
  User root
  HostName ip.ip.ip.ip
  IdentityFile ~/.ssh/id_ed25519
  IdentitiesOnly yes
  PubKeyAuthentication yes
  PasswordAuthentication no
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  LogLevel FATAL

It’s a fairly fresh vm and certainly has room for improvements but as a template it should do, other means of logging in can be explored when that is working.

ssh isn’t the problem here, when i can’t even ping the server!
As i mentioned in my second post, the servers ip has changed after nixos was installed. As a result the server isn’t reachable under it’s assigned (static) IP.

Try networking.useDHCP = false; ?

DHCP respects staticly set network configurations, Disabling it would mean i wouldn’t even get assigned a dynamic IP.
I’ve tested it and as expected the ethernet interface is down as a result.

as i’ve said, i have to carry over the static network configuration (originally handled by netplan on debian) and leave dhcp enabled, because dhcpd was also running on the host-provided images.

Someone wrote down what they did here: NixOS on Contabo (via)

1 Like

ah cool! thats exactly what i’m doing now.

i’ll post the gist, when i get it working

1 Like

here’s the gist of a working config. Nixos Networking on a contabo VPS · GitHub