【问题标题】:Why is nixos-rebuild switch creating a store for something that is not used?为什么 nixos-rebuild 开关要为不使用的东西创建一个商店?
【发布时间】:2019-01-03 17:38:07
【问题描述】:

在将频道从nixos-18.09 切换到nixos-unstable 并返回时,我对我的系统做了一些处理,现在遇到了一个问题,导致$ nixos-rebuild switch 无法成功运行。

当我尝试这样做时,我收到以下错误:

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

我已尝试通过运行删除违规路径

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

根据

,该路径没有“推荐人”
$ nix-store -q --referrers /nix/store/19sp5z5i8kg7x0inyrb1kzm1n6g6rzcc-nixos-system-nixos-19.03pre164715.201d739b0ff.drv`)

我还使用$ nix-store --gc 进行了垃圾收集。但是,运行 $ nixos-rebuild switch 仍然会重新创建此路径并再次给出相同的错误。

为什么$ nixos-rebuild switch 创建此路径,我怎样才能让该命令再次成功运行?

我不知道为什么nixos-system-nixos-19.03 会出现在我的系统上;此时我只跟踪nixos-18.09 频道:

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

【问题讨论】:

  • 如果没有构建成功,那么依赖它的任何东西都不会成功,因此会创建一个 gc 根,所以是的,nix-store --gc 对此一无所知。
  • nix show-derivation -r /nix/store/19sp5z5i8kg7x0inyrb1kzm1n6g6rzcc-nixos-system-nixos-19.03pre164715.201d739b0ff.drv 是你的朋友 -- 它拥有追踪此事件所需的一切。
  • ...或者,如果您想要图形形式的内容,nix-store -q --graph /nix/store/19sp5z5i8kg7x0inyrb1kzm1n6g6rzcc-nixos-system-nixos-19.03pre164715.201d739b0ff.drv 可能是一个不错的起点。
  • 也就是说,您的错误消息也很清楚依赖链是什么。您的系统配置为在默认 PATH 中使用带有 pandas 的 Python 3。 pandas 依赖于moto,它依赖于python-jose,它依赖于rsa,这就是失败的原因。
  • 顺便说一句,nixos-channel 命令来自哪里? nix-channel --list我熟悉; nixos-channel --list,没有那么多。如果您想检查与nixos-rebuild 相关的nix 频道,请确保查看为root 配置的频道,而不是您的用户帐户;因此,sudo nix-channel --list 是合适的。

标签: nixos


【解决方案1】:

如果您过滤错误消息,则事件链非常清楚:

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

因此,Python rsa 模块的构建失败,因为该包有错误。

我们为什么要依赖rsa?因为……


顺便说一句,虽然在 nixpkgs-unstable 上就是这种情况,但 18.09 版本(截至本答案的最新发布)在 rsa 上没有来自 python-jose 的这种依赖关系,因此不会在手。我可以建议改用它吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-10
    • 2017-02-16
    • 2017-07-12
    • 2023-03-04
    相关资源
    最近更新 更多