elitak / nixos-infect

[GPLv3+] install nixos over the existing OS in a DigitalOcean droplet (and others with minor modifications)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running on ExtraVM (Ubuntu 20.04 x64) gives "error: The option value `networking.hostName' in `/etc/nixos/configuration.nix' is not of type `string matching the pattern ^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$'"

stianlagstad opened this issue · comments

Complete log:

stian@extravm:~$   curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-20.09 bash -x
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0+ set -e -o pipefail
100  9291  100  9291    0     0  38712      0 --:--:-- --:--:-- --:--:-- 38712
+ '[' '' = digitalocean ']'
+ prepareEnv
+ for grubdev in /dev/vda /dev/sda
+ [[ -e /dev/vda ]]
+ break
++ awk '{print $1;}'
++ grep 'on / type'
++ mount
+ rootfsdev=/dev/vda1
+ export USER=root
+ USER=root
+ export HOME=/root
+ HOME=/root
+ mkdir -p -m 0755 /nix
mkdir: cannot create directory ‘/nix’: Permission denied

stian@extravm:~$ sudo su
root@extravm:/home/stian#   curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-20.09 bash -x
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0+ set -e -o pipefail
100  9291  100  9291    0     0   181k      0 --:--:-- --:--:-- --:--:--  181k
+ '[' '' = digitalocean ']'
+ prepareEnv
+ for grubdev in /dev/vda /dev/sda
+ [[ -e /dev/vda ]]
+ break
++ awk '{print $1;}'
++ grep 'on / type'
++ mount
+ rootfsdev=/dev/vda1
+ export USER=root
+ USER=root
+ export HOME=/root
+ HOME=/root
+ mkdir -p -m 0755 /nix
+ makeSwap
++ mktemp /tmp/nixos-infect.XXXXX.swp
+ swapFile=/tmp/nixos-infect.2h1uC.swp
+ dd if=/dev/zero of=/tmp/nixos-infect.2h1uC.swp bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 1.28505 s, 836 MB/s
+ chmod 0600 /tmp/nixos-infect.2h1uC.swp
+ mkswap /tmp/nixos-infect.2h1uC.swp
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=c45c4811-eaf4-475a-8417-fb96c966389d
+ swapon -v /tmp/nixos-infect.2h1uC.swp
swapon: /tmp/nixos-infect.2h1uC.swp: found signature [pagesize=4096, signature=swap]
swapon: /tmp/nixos-infect.2h1uC.swp: pagesize=4096, swapsize=1073741824, devsize=1073741824
swapon /tmp/nixos-infect.2h1uC.swp
+ checkEnv
+ which dnf
+ which bzcat
/bin/bzcat
+ which xzcat
/usr/bin/xzcat
+ which curl
/usr/bin/curl
++ whoami
+ [[ root == \r\o\o\t ]]
+ req curl
+ type curl
+ req bzcat
+ type bzcat
+ req xzcat
+ type xzcat
+ req groupadd
+ type groupadd
+ req useradd
+ type useradd
+ req ip
+ type ip
+ req awk
+ type awk
+ req cut
+ type cut
+ makeConf
+ [[ -e /etc/nixos/configuration.nix ]]
+ mkdir -p /etc/nixos
+ local 'IFS=
'
+ for trypath in /root/.ssh/authorized_keys $HOME/.ssh/authorized_keys
+ [[ -r /root/.ssh/authorized_keys ]]
+ for trypath in /root/.ssh/authorized_keys $HOME/.ssh/authorized_keys
+ [[ -r /root/.ssh/authorized_keys ]]
+ local network_import=
+ [[ -n '' ]]
+ cat
++ hostname
++ read -r line
++ echo -n '
    "" '
++ read -r line
+ cat
+ [[ -n '' ]]
+ true
+ infect
+ groupadd nixbld -g 30000
+ for i in {1..10}
++ which nologin
+ useradd -c 'Nix build user 1' -d /var/empty -g nixbld -G nixbld -M -N -r -s /usr/sbin/nologin nixbld1
+ for i in {1..10}
++ which nologin
+ useradd -c 'Nix build user 2' -d /var/empty -g nixbld -G nixbld -M -N -r -s /usr/sbin/nologin nixbld2
+ for i in {1..10}
++ which nologin
+ useradd -c 'Nix build user 3' -d /var/empty -g nixbld -G nixbld -M -N -r -s /usr/sbin/nologin nixbld3
+ for i in {1..10}
++ which nologin
+ useradd -c 'Nix build user 4' -d /var/empty -g nixbld -G nixbld -M -N -r -s /usr/sbin/nologin nixbld4
+ for i in {1..10}
++ which nologin
+ useradd -c 'Nix build user 5' -d /var/empty -g nixbld -G nixbld -M -N -r -s /usr/sbin/nologin nixbld5
+ for i in {1..10}
++ which nologin
+ useradd -c 'Nix build user 6' -d /var/empty -g nixbld -G nixbld -M -N -r -s /usr/sbin/nologin nixbld6
+ for i in {1..10}
++ which nologin
+ useradd -c 'Nix build user 7' -d /var/empty -g nixbld -G nixbld -M -N -r -s /usr/sbin/nologin nixbld7
+ for i in {1..10}
++ which nologin
+ useradd -c 'Nix build user 8' -d /var/empty -g nixbld -G nixbld -M -N -r -s /usr/sbin/nologin nixbld8
+ for i in {1..10}
++ which nologin
+ useradd -c 'Nix build user 9' -d /var/empty -g nixbld -G nixbld -M -N -r -s /usr/sbin/nologin nixbld9
+ for i in {1..10}
++ which nologin
+ useradd -c 'Nix build user 10' -d /var/empty -g nixbld -G nixbld -M -N -r -s /usr/sbin/nologin nixbld10
+ /bin/bash
+ curl -L https://nixos.org/nix/install
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  2699  100  2699    0     0  13841      0 --:--:-- --:--:-- --:--:-- 13841
downloading Nix 2.3.10 binary tarball for x86_64-linux from 'https://releases.nixos.org/nix/nix-2.3.10/nix-2.3.10-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.L9vjWSOaVs'...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16.4M  100 16.4M    0     0  62.8M      0 --:--:-- --:--:-- --:--:-- 62.8M
Note: a multi-user installation is possible. See https://nixos.org/nix/manual/#sect-multi-user-installation
warning: installing Nix as root is not supported by this script!
performing a single-user installation of Nix...
copying Nix to /nix/store......................................
installing 'nix-2.3.10'
building '/nix/store/3988ni0kzan1yl3n9a67vk470flgnqi2-user-environment.drv'...
created 6 symlinks in user environment
unpacking channels...
created 1 symlinks in user environment
modifying /root/.profile...

Installation finished!  To ensure that the necessary environment
variables are set, either log in again, or type

  . /root/.nix-profile/etc/profile.d/nix.sh

in your shell.
+ source /root/.nix-profile/etc/profile.d/nix.sh
++ '[' -n /root ']'
++ '[' -n root ']'
++ NIX_LINK=/root/.nix-profile
++ export NIX_PATH=/root/.nix-defexpr/channels
++ NIX_PATH=/root/.nix-defexpr/channels
++ export 'NIX_PROFILES=/nix/var/nix/profiles/default /root/.nix-profile'
++ NIX_PROFILES='/nix/var/nix/profiles/default /root/.nix-profile'
++ '[' -e /etc/ssl/certs/ca-certificates.crt ']'
++ export NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
++ NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
++ '[' -n '' ']'
++ export PATH=/root/.nix-profile/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
++ PATH=/root/.nix-profile/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
++ unset NIX_LINK
+ [[ -z nixos-20.09 ]]
+ nix-channel --remove nixpkgs
uninstalling 'nixpkgs-21.05pre283043.f0efbe21f9a'
building '/nix/store/xsk9wjy0dpp7w7d3r3bkzxzaklqdzq6q-user-environment.drv'...
created 0 symlinks in user environment
+ nix-channel --add https://nixos.org/channels/nixos-20.09 nixos
+ nix-channel --update
unpacking channels...
created 1 symlinks in user environment
+ export NIXOS_CONFIG=/etc/nixos/configuration.nix
+ NIXOS_CONFIG=/etc/nixos/configuration.nix
+ nix-env --set -I nixpkgs=/root/.nix-defexpr/channels/nixos -f '<nixpkgs/nixos>' -p /nix/var/nix/profiles/system -A system
error: The option value `networking.hostName' in `/etc/nixos/configuration.nix' is not of type `string matching the pattern ^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$'.
(use '--show-trace' to show detailed location information)

hostname:

root@extravm:/home/stian# hostname
extravm.stianlagstad.no

Should I change the hostname? Thanks!

Machine info:

Operating System | Ubuntu 20.04 x64
-- | --
IPv6 Address | 1
Disk Space | 7 GB
Bandwidth | 1 TB
Memory | 512 MB
Swap | 256 MB
Virtualization Type | (KVM)

This was indeed solved by changing my hostname. Sorry for the noise :)