The error:
$ sudo nixos-rebuild --impure --flake .#$HOSTNAME switch --show-trace
building the system configuration...
error: Cannot build '/nix/store/c193hazsr5da4vz4zm2k2nqm46w5zkli-initrd-linux-6.18.49.drv'.
Reason: builder failed with exit code 1.
Output paths:
/nix/store/zdbc3m1cg54v5jc8wg0jxnaf2y32r88n-initrd-linux-6.18.49
... full log redacted, see pastebin link below
> Error: failed to copy "/nix/store/sm8d6jpilwdy3bw3yq2lv8rr8jld26pb-systemd-261.2/lib/systemd/systemd" to "./root/nix/store/sm8d6jpilwdy3bw3yq2lv8rr8jld26pb-systemd-261.2/lib/systemd/systemd"
>
> Caused by:
> Operation not permitted (os error 1)
- Full error log: https://pastebin.com/PdDRzGYk (with --show-trace enabled)
- Error log produced by running
nix log /nix/store/c193hazsr5da4vz4zm2k2nqm46w5zkli-initrd-linux-6.18.49.drv: https://pastebin.com/xkTYAPeN
The context:
- I have a nixos config that works on many machines (home computer, laptop, server, WSL, etc.)
- I tried to set up an “Erase your Darlings”-style ephemeral rootfs using ZFS on one of my machines, where the rootfs is rolled back using ZFS at boot (see https://github.com/michaelhaaf/nix-config/blob/9abcc6601fb3e3362890041bd6dfd39ead8c7b9d/hosts/nixos/home/default.nix#L135-L157 for the relevant config
- This resulted in an arcane nixos bug on that machine, where both my primary user and the root user passwords were set to
!in/etc/shadow, effectively rendering it impossible to log in (see https://github.com/NixOS/nixpkgs/issues/208766 ) - I couldn’t figure out a way around it: I reinstalled NixOS from a version 25.11 USB stick I had
- Now, applying my config to that machine again (with the ZFS rollback startup script commented out), I get the error above.
My questions:
- I haven’t found this error online, any guesses as to what’s going on?
- What is the
./rootfolder named in the error – and why is a /nix/store being built under it?