Search code examples
nixos

Why is nixos-rebuild switch creating a store for something that is not used?


I did something to my system when switching channels from nixos-18.09 to nixos-unstable and back, and now run into an issue that prevents $ nixos-rebuild switch from running successfully.

When I try to do that, I get the following error:

writing manifest file 'singledispatch.egg-info/SOURCES.txt'
Copying singledispatch.egg-info to build/bdist.linux-x86_64/wheel/singledispatch-3.4.0.3-py3.6.egg-info
running install_scripts
Traceback (most recent call last):
  File "nix_run_setup", line 8, in <module>
    exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
  File "setup.py", line 20, in <module>
    long_description = f.read()
  File "/nix/store/qbyckcddc74s2fi060n8xqcn8gygrhjl-python3-3.6.8/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 898: ordinal not in range(128)
builder for '/nix/store/mcncvdwadrq1335bwy279dg7q0sxhvhp-python3.6-rsa-4.0.drv' failed with exit code 1
cannot build derivation '/nix/store/pifmbmqallj7jkl3ar1wv8nqyfzq08hr-python3.6-python-jose-3.0.1.drv': 1 dependencies couldn't be built
building '/nix/store/1qy7ka8c0s3mjv51pdiyyp103d11awkb-python3.6-termstyle-0.1.11.drv'...
building '/nix/store/8zvlx7367p21vj0iccsvhpz1jv3wx0b6-python3.6-websocket_client-0.54.0.drv'...
cannot build derivation '/nix/store/3w08jzilgvddzx728nnkpaadc7sd9p2v-python3.6-moto-1.3.7.drv': 1 dependencies couldn't be built
building '/nix/store/qfkfr913dx4ssp1qahfd9wcj6csf6yxm-python3.6-xlrd-1.1.0.drv'...
building '/nix/store/dvi6y2zlc4gwli0qqhxhr6cbvfs5qwhx-python3.6-xlwt-1.3.0.drv'...
building '/nix/store/p38p279r5y8bh7n9pvw8194k9zvnybic-reload-container.drv'...
cannot build derivation '/nix/store/sf4d3zrds99sq22s096f4pdwb2602mf2-python3.6-pandas-0.23.4.drv': 1 dependencies couldn't be built
building '/nix/store/hy1197qj5ivb54wicyn0ljdbv8qxp0zc-remove-references-to.drv'...
building '/nix/store/6cqp8vf151gvxbnz03qp4sj9awd8lnfc-smb-dummy.conf.drv'...
building '/nix/store/cb5r8y9llx4yw64kyg2hhwds4g123h29-stage-1-init.sh.drv'...
building '/nix/store/4ps1704mhdqj5bp1ck7sa2x67l7h08x4-su.pam.drv'...
cannot build derivation '/nix/store/hx05mqxryfl1aqvc5lqf0q05n230qnz3-system-path.drv': 1 dependencies couldn't be built
building '/nix/store/zrrbcfif92d7yz1d4vlcnva3gx8npc2k-systemd-boot-builder.py.drv'...
building '/nix/store/z8mld3scs2hzb6k3hffjqvfyrg9qnlg7-systemd-user.pam.drv'...
building '/nix/store/0gixkqfsr3plwcyf72izycpkr5rf1r6k-udev-rules.drv'...
cannot build derivation '/nix/store/19sp5z5i8kg7x0inyrb1kzm1n6g6rzcc-nixos-system-nixos-19.03pre164715.201d739b0ff.drv': 1 dependencies couldn't be built
error: build of '/nix/store/19sp5z5i8kg7x0inyrb1kzm1n6g6rzcc-nixos-system-nixos-19.03pre164715.201d739b0ff.drv' failed

I have tried removing the offending path by running

$ nix-store --delete /nix/store/19sp5z5i8kg7x0inyrb1kzm1n6g6rzcc-nixos-system-nixos-19.03pre164715.201d739b0ff.drv

That path has no 'referrers' according to

$ nix-store -q --referrers /nix/store/19sp5z5i8kg7x0inyrb1kzm1n6g6rzcc-nixos-system-nixos-19.03pre164715.201d739b0ff.drv`)

I also garbage-collected using $ nix-store --gc. However, running $ nixos-rebuild switch still re-creates this path and gives the same error again.

Why is $ nixos-rebuild switch creating this path, and how can I get that command running successfully again?

I am not sure why nixos-system-nixos-19.03 is present on my system at all; at this point I am only tracking the nixos-18.09 channel:

$ nixos-channel --list
nixos-18.09 https://nixos.org/channels/nixos-18.09

Solution

  • If you filter through the error message, it's pretty clear about the chain of events:

    builder for '/nix/store/mcncvdwadrq1335bwy279dg7q0sxhvhp-python3.6-rsa-4.0.drv' failed with exit code 1
    cannot build derivation '/nix/store/pifmbmqallj7jkl3ar1wv8nqyfzq08hr-python3.6-python-jose-3.0.1.drv': 1 dependencies couldn't be built
    cannot build derivation '/nix/store/3w08jzilgvddzx728nnkpaadc7sd9p2v-python3.6-moto-1.3.7.drv': 1 dependencies couldn't be built
    cannot build derivation '/nix/store/sf4d3zrds99sq22s096f4pdwb2602mf2-python3.6-pandas-0.23.4.drv': 1 dependencies couldn't be built
    cannot build derivation '/nix/store/hx05mqxryfl1aqvc5lqf0q05n230qnz3-system-path.drv': 1 dependencies couldn't be built
    cannot build derivation '/nix/store/19sp5z5i8kg7x0inyrb1kzm1n6g6rzcc-nixos-system-nixos-19.03pre164715.201d739b0ff.drv': 1 dependencies couldn't be built
    error: build of '/nix/store/19sp5z5i8kg7x0inyrb1kzm1n6g6rzcc-nixos-system-nixos-19.03pre164715.201d739b0ff.drv' failed
    

    So, the build of the Python rsa module failed because that package has a bug.

    Why do we depend on rsa? Because...


    BTW, while this is the case on nixpkgs-unstable, the 18.09 release (latest published as of this answer) doesn't have this dependency from python-jose on rsa, and so doesn't exhibit the issue at hand. Might I suggest using it instead?