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

nixos-infect on Ionos #188

Open
RegEM opened this issue Dec 27, 2023 · 4 comments
Open

nixos-infect on Ionos #188

RegEM opened this issue Dec 27, 2023 · 4 comments

Comments

@RegEM
Copy link

RegEM commented Dec 27, 2023

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

@guiguid
Copy link

guiguid commented Dec 27, 2023

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
Copy link
Author

RegEM commented Dec 27, 2023

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

@niklasmohrin
Copy link

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 ; }

@RegEM
Copy link
Author

RegEM commented Oct 29, 2024

I finally made the effort to try again. Not sure, but part of my issue may have just been impatience (not waiting for the infect reboot), and not seeing the prompt change to nixos (so not recognizing that it worked). Hard to say, as much of my efforts were originally with a debian image, a year a go.

Anyways, I install directly with the ubuntu 20.11 image, using #cloud-config. Caddy is available after the install, and I confirm the os with hostnamectl command. Eventually, I'll upgrade to a more expensive vps.

Don't know if I can go directly to my sudo user.

#cloud-config

# User setup configuration
users:
  - name: root
#    gecos: Example User
    sudo: ['ALL=(ALL) NOPASSWD:ALL']
    groups: sudo
    homedir: /home/root
    shell: /bin/bash
    ssh_authorized_keys:
      - ssh-rsa AAAA_the_long_key= user@LAPTOP-######## 
write_files:
- path: /etc/nixos/host.nix
  permissions: '0644'
  content: |
    {pkgs, ...}:
    {
      environment.systemPackages = with pkgs; [ caddy ];
    }

runcmd:
  - curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIXOS_IMPORT=./host.nix NIX_CHANNEL=nixos-23.11 bash 2>&1 | tee /tmp/infect.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants