Description
I am using deploy-rs to configure my server, but after a reboot the server reverts to an older configuration. I am not entirely sure how to debug this problem, so any pointers are appreciated. I initially installed NixOS using nixos-anywhere, so this might be part of the problem.
I did notice that /run/current-system
is reverted back to /run/booted-system
(which is the same as /nix/var/nix/profiles/system
) after a reboot.
Here you can see the effect of deploying and rebooting the server.
The current state, after running for a while and applying various configurations:
[root@jefke:~]# ls -alh /nix/var/nix/profiles/
total 12K
lrwxrwxrwx 1 root root 43 14 jan 19:40 default -> /nix/var/nix/profiles/per-user/root/profile
drwxr-xr-x 1 root root 8 6 jan 22:23 per-user
lrwxrwxrwx 1 root root 13 6 jan 22:23 system -> system-1-link
lrwxrwxrwx 1 root root 85 6 jan 22:23 system-1-link -> /nix/store/i7l51f77b4bsdmbx7k4m9274lkn87bps-nixos-system-jefke-23.11.20231215.40c3c94
[root@jefke:~]# ls -alhd /run/booted-system
lrwxrwxrwx 1 root root 85 7 jan 00:49 /run/booted-system -> /nix/store/i7l51f77b4bsdmbx7k4m9274lkn87bps-nixos-system-jefke-23.11.20231215.40c3c94
[root@jefke:~]# ls -alhd /run/current-system
lrwxrwxrwx 1 root root 85 14 jan 16:43 /run/current-system -> /nix/store/pdn5n3xf2vlkr7h09d9w6bvbgnp7ry4y-nixos-system-jefke-23.11.20231215.40c3c94
Note that the /nix/var/nix/profiles/default
symlink above points to a non-existent file.
The state after rebooting:
[root@jefke:~]# ls -alh /nix/var/nix/profiles/
total 12K
lrwxrwxrwx 1 root root 43 14 jan 19:40 default -> /nix/var/nix/profiles/per-user/root/profile
drwxr-xr-x 1 root root 8 6 jan 22:23 per-user
lrwxrwxrwx 1 root root 13 6 jan 22:23 system -> system-1-link
lrwxrwxrwx 1 root root 85 6 jan 22:23 system-1-link -> /nix/store/i7l51f77b4bsdmbx7k4m9274lkn87bps-nixos-system-jefke-23.11.20231215.40c3c94
[root@jefke:~]# ls -alhd /run/booted-system
lrwxrwxrwx 1 root root 85 14 jan 19:46 /run/booted-system -> /nix/store/i7l51f77b4bsdmbx7k4m9274lkn87bps-nixos-system-jefke-23.11.20231215.40c3c94
[root@jefke:~]# ls -alhd /run/current-system
lrwxrwxrwx 1 root root 85 14 jan 19:46 /run/current-system -> /nix/store/i7l51f77b4bsdmbx7k4m9274lkn87bps-nixos-system-jefke-23.11.20231215.40c3c94
Above we see that the system reverted back to /run/booted-system
.
The state after re-applying my configuration using deploy-rs again:
[root@jefke:~]# ls -alh /nix/var/nix/profiles/
total 12K
drwxr-xr-x 1 root root 68 14 jan 19:52 .
drwxr-xr-x 1 root root 92 14 jan 19:52 ..
lrwxrwxrwx 1 root root 43 14 jan 19:40 default -> /nix/var/nix/profiles/per-user/root/profile
drwxr-xr-x 1 root root 8 6 jan 22:23 per-user
lrwxrwxrwx 1 root root 13 6 jan 22:23 system -> system-1-link
lrwxrwxrwx 1 root root 85 6 jan 22:23 system-1-link -> /nix/store/i7l51f77b4bsdmbx7k4m9274lkn87bps-nixos-system-jefke-23.11.20231215.40c3c94
[root@jefke:~]# ls -alhd /run/booted-system
lrwxrwxrwx 1 root root 85 14 jan 19:46 /run/booted-system -> /nix/store/i7l51f77b4bsdmbx7k4m9274lkn87bps-nixos-system-jefke-23.11.20231215.40c3c94
[root@jefke:~]# ls -alhd /run/current-system
lrwxrwxrwx 1 root root 85 14 jan 19:52 /run/current-system -> /nix/store/pdn5n3xf2vlkr7h09d9w6bvbgnp7ry4y-nixos-system-jefke-23.11.20231215.40c3c94