elitak/nixos-infect

nixos-infect on Ionos

RegEM opened this issue · 4 comments

RegEM commented

Hi,
I struggled over getting nixos running on ionos vps. I tried nixos-infect, and loading an img with digital-ocean-init.nix too.

My main issue is I needed to rename the hostname. But I wanted to do this as part of the cloud-init. Eventually I got there (See below).

Not sure if the fqdn part is correct, or will cause problems with certain packages?
Or if the 127.0.0.2 is a possible issue as well?

The original hosts file had an 127.0.1.1 entry, that was causing a known bug. See. NixOS/nixpkgs#1248 (comment)

I have a $1.month Cloud Server S, CPU:1 vCore, RAM:0.5 GB, SSD:10 GB.
The DNS host name is *******.online-server.cloud

This is the /etc/hosts after infection
127.0.0.1 localhost
::1 localhost
127.0.0.2 *******.online-server.cloud *******
::1 *******.online-server.cloud *******

I reinstall the image as Debian 12. With root password, and ssh key. The cloud-init, is the same as the digital ocean example 2, with the extra four cc entries for the hostname and fqdn.

#cloud-config
preserve_hostname: false
prefer_fqdn_over_hostname: true
hostname: *******
fqdn: *****.online-server.cloud
write_files:
...
runcmd:
− curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | PROVIDER=digitalocean NIXOS_IMPORT=./host.nix NIX_CHANNEL=nixos-22.11 bash 2>&1 | tee /tmp/infect.log

Hi, working without any problem last day.
From ionos vps with fresh ubuntu image 22.04

first step : ssh-copy-id to root
next : curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-23.11 bash -x
wait for reboot
login has root@ionosvpsip

that's all, now do what you want with configuration.nix and let's nixos-rebuild switch do the job ( like hostname ;-)

RegEM commented

Hi Guillaume, thanks.
Originally, I had to manually change the networking.hostName and networking.domain in configuration.nix, from localhost and localdomain to that of the DNS public setting. And then run the inject..
Since I got it to work directly via the cloud-config, I tried 23.11-small, and 23.11 but it wouldn't work. Not surprised with small.
So I was going to try and run a second cloud-init command to automatically upgrade to 23.11-small, but then I noticed another issue.
I see in the boot log, that my cloud-init 22.11, is generating the 'ICMPv6: RA: ndisc_router_discovery' error, discussed in the following link. So I'm investigating that, and whether my fqdn... in cloud-init is causing it. I see there is a 'manage_etc_hosts:' label too.
NixOS/nixpkgs#89025

Cheers. Richard

Encountered the same issue with the Debian image from ionos. After reading @guiguid's comment, I installed the Ubuntu image through the cloud panel and followed the steps, which almost worked, except that I had to change one line of the script for it to run until the end:

376c376
<   mv -v /boot /boot.bak || { cp -a /boot /boot.bak ; rm -rf /boot/* ; umount /boot ; }
---
>   mv -v /boot /boot.bak || { cp -a /boot /boot.bak ; umount /boot/efi ; rm -rf /boot/* ; umount /boot ; }