Need help on failure of building my configuration

I believe it can remote inputs to non-gc’d flakes. A flake in the store is just a content addressed path of that flake’s source; I don’t believe it contains any references to its input (which is for the best, since inputs can be reconfigured without changing the flake’s source).

I get very similar error when during a rebuild of the system it runs out of space on /boot. And the solution too is to simply nix-garbage-collect. I can’t check right now that it’s exactly the same problem, as I it’s hard to reproduce (I’d need to ill up my /boot somehow). This is very annoying because the error message looks completely unrelated.

That’s interesting. I can’t imagine how low /boot space could cause a system generation to point to the wrong path.

I just got it again, and indeed it’s a bit different, especially the first stacktrace:

❯ sudo nixos-rebuild switch --flake .
warning: Git tree '/home/artem/dotfiles' is dirty
building the system configuration...
warning: Git tree '/home/artem/dotfiles' is dirty
Traceback (most recent call last):
  File "/nix/store/zwg93hsr2yhjyg5104gbmi3gs3m0pwm9-systemd-boot", line 278, in main
    write_entry(*gen, machine_id)
  File "/nix/store/zwg93hsr2yhjyg5104gbmi3gs3m0pwm9-systemd-boot", line 117, in write_entry
    initrd = copy_from_profile(profile, generation, specialisation, "initrd")
  File "/nix/store/zwg93hsr2yhjyg5104gbmi3gs3m0pwm9-systemd-boot", line 90, in copy_from_profile
    copy_if_not_exists(store_file_path, "/boot%s" % (efi_file_path))
  File "/nix/store/zwg93hsr2yhjyg5104gbmi3gs3m0pwm9-systemd-boot", line 25, in copy_if_not_exists
    shutil.copyfile(source, dest)
  File "/nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/lib/python3.9/shutil.py", line 275, in copyfile
    _fastcopy_sendfile(fsrc, fdst)
  File "/nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/lib/python3.9/shutil.py", line 166, in _fastcopy_sendfile
    raise err from None
  File "/nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/lib/python3.9/shutil.py", line 152, in _fastcopy_sendfile
    sent = os.sendfile(outfd, infd, offset, blocksize)
OSError: [Errno 28] No space left on device: '/nix/store/3w4nvd4qsk46fg3pdcfks7dnlyywl2pb-initrd-linux-5.15.11/initrd' -> '/boot/efi/nixos/3w4nvd4qsk46fg3pdcfks7dnlyywl2pb-initrd-linux-5.15.11-initrd.efi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/zwg93hsr2yhjyg5104gbmi3gs3m0pwm9-systemd-boot", line 314, in <module>
    main()
  File "/nix/store/zwg93hsr2yhjyg5104gbmi3gs3m0pwm9-systemd-boot", line 284, in main
    print("ignoring profile '{}' in the list of boot entries because of the following error:\n{}".format(profile, e), file=sys.stderr)
UnboundLocalError: local variable 'profile' referenced before assignment
warning: error(s) occurred while switching to the new configuration

What confuses me is the second stacktrace, which better not be there at all imo.

That’s a completely different error. Your /boot file system is out of space. The second traceback is presumably because the script calling the script that failed isn’t handling the failure correctly.

See nixpkgs issue #93694 and nixpkgs issue #144811. The problem occurs because you run nixos-rebuild with the current working directory in the nix store. The poster of #144811 probably didn’t run into #93694 as a result because he wasn’t using systemd-boot. The menu builder for grub, for example, handles this circumstance fine.

The cleanest solution for the moment is to run ls -l /nix/var/nix/profiles/system* and look for the bad generation, then run sudo nix-env -p /nix/var/nix/profiles/system --delete-generations <num> to delete it.

1 Like