Profile conflict error in nix upgrade-nix redux #839

Open
opened 2025-05-23 22:23:27 +00:00 by samb · 0 comments

Describe the bug

A variation on https://git.lix.systems/lix-project/lix/issues/411.

Steps To Reproduce

With NixCpp installed, run:

sudo --preserve-env=PATH $(which nix) run \
     --experimental-features "nix-command flakes" \
     --extra-substituters https://cache.lix.systems --extra-trusted-public-keys "cache.lix.systems:aBnZUw8zA7H35Cz2RyKFV
s3H4PlGTLawyY5KRbvJR8o=" \
     'git+https://git.lix.systems/lix-project/lix?ref=refs/tags/2.93.0' -- \
     upgrade-nix \
     --extra-substituters https://cache.lix.systems --extra-trusted-public-keys "cache.lix.systems:aBnZUw8zA7H35Cz2RyKFV
s3H4PlGTLawyY5KRbvJR8o=" -vv

(This is the code on https://lix.systems/install/ with nix run replaced with $(which nix) run because the former had sudo complaining it couldn't find nix, and -vv flags added to show what it's trying to do.)

This produces the following output:

found Nix in '/nix/var/nix/profiles/default/bin'
found profile '/nix/var/nix/profiles/default'
upgrading Nix in profile '/nix/var/nix/profiles/default'
querying latest Nix version...
downloading 'https://releases.lix.systems/manifest.nix'...
downloading '/nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0'......
verifying that '/nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0' works......
running /nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0/bin/nix-env --uninstall /nix/store/xlg2s2hdngc2gjb6kfwac1g7b4q2pcg5-nix-2.28.3/bin/nix-env --profile /nix/var/nix/profiles/default
warning: selector '/nix/store/xlg2s2hdngc2gjb6kfwac1g7b4q2pcg5-nix-2.28.3/bin/nix-env' matched no installed derivations
running /nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0/bin/nix-env --profile /nix/var/nix/profiles/default --install /nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0 --no-sandbox
installing 'lix-2.93.0'
building '/nix/store/c1bn8sps0rpxirv75y9sqps54l79fm6s-user-environment.drv'...
error: Unable to build profile. There is a conflict for the following files:

         /nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0/libexec/nix/build-remote
         /nix/store/pfh6bq2wxbpp3xz5sinymmp44n505zh8-nix-2.28.3/libexec/nix/build-remote
error: builder for '/nix/store/c1bn8sps0rpxirv75y9sqps54l79fm6s-user-environment.drv' failed with exit code 1
error: program '/nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0/bin/nix-env' failed with exit code 100

New in this variant of the problem:

running /nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0/bin/nix-env --uninstall /nix/store/xlg2s2hdngc2gjb6kfwac1g7b4q2pcg5-nix-2.28.3/bin/nix-env --profile /nix/var/nix/profiles/default
warning: selector '/nix/store/xlg2s2hdngc2gjb6kfwac1g7b4q2pcg5-nix-2.28.3/bin/nix-env' matched no installed derivations

Expected behavior

Given the discussion in #411, the change in cl/1604, and the fact that the command is running a version of the upgrade-nix command that contains the commit ae7eab49b9, I was expecting this to actually work.

nix --version output

nix (Nix) 2.28.3

Additional context

[
  {
    meta = { };
    name = "nix-2.28.3";
    out = {
      outPath = "/nix/store/pfh6bq2wxbpp3xz5sinymmp44n505zh8-nix-2.28.3";
    };
    outPath = "/nix/store/pfh6bq2wxbpp3xz5sinymmp44n505zh8-nix-2.28.3";
    outputs = [ "out" ];
    system = "unknown";
    type = "derivation";
  }
  {
    meta = { };
    name = "nss-cacert-3.95";
    out = {
      outPath = "/nix/store/sp6cj9vw557zpfirwvvix36p58av82dj-nss-cacert-3.95";
    };
    outPath = "/nix/store/sp6cj9vw557zpfirwvvix36p58av82dj-nss-cacert-3.95";
    outputs = [ "out" ];
    system = "unknown";
    type = "derivation";
  }
]

Note that the manifest references store path:

/nix/store/pfh6bq2wxbpp3xz5sinymmp44n505zh8-nix-2.28.3

but lix's upgrade-nix tried to uninstall:

/nix/store/xlg2s2hdngc2gjb6kfwac1g7b4q2pcg5-nix-2.28.3/bin/nix-env

It seems that the former consists mostly of symlinks to the inside of the latter's store object?

Here's the dependency tree:

$ nix-store --query --tree /nix/store/pfh6bq2wxbpp3xz5sinymmp44n505zh8-nix-2.28.3
/nix/store/pfh6bq2wxbpp3xz5sinymmp44n505zh8-nix-2.28.3
└───/nix/store/xlg2s2hdngc2gjb6kfwac1g7b4q2pcg5-nix-2.28.3
    ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36
    │   ├───/nix/store/2d5spnl8j5r4n1s4bj1zmra7mwx0f1n8-xgcc-13.3.0-libgcc
    │   ├───/nix/store/qwjjm4j652ck9izaid7bz63s4hd5bnha-libidn2-2.3.7
    │   │   ├───/nix/store/6pqgj71r0850b0cd95yxx0d52zax016i-libunistring-1.2
    │   │   │   └───/nix/store/6pqgj71r0850b0cd95yxx0d52zax016i-libunistring-1.2 [...]
    │   │   └───/nix/store/qwjjm4j652ck9izaid7bz63s4hd5bnha-libidn2-2.3.7 [...]
    │   └───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...]
    ├───/nix/store/ybjcla5bhj8g1y84998pn4a2drfxybkv-gcc-13.3.0-lib
    │   ├───/nix/store/j8rzqx7farv0w3isp9z943zy437zk02f-gcc-13.3.0-libgcc
    │   ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...]
    │   └───/nix/store/ybjcla5bhj8g1y84998pn4a2drfxybkv-gcc-13.3.0-lib [...]
    ├───/nix/store/319hpn6dffzslywqhvjcwhs8xj822rdl-nix-util-2.28.3
    │   ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...]
    │   ├───/nix/store/2vgwd43vqxm66grkgsy7z1d87z31nzph-brotli-1.1.0-lib
    │   │   ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...]
    │   │   └───/nix/store/2vgwd43vqxm66grkgsy7z1d87z31nzph-brotli-1.1.0-lib [...]
    │   ├───/nix/store/ybjcla5bhj8g1y84998pn4a2drfxybkv-gcc-13.3.0-lib [...]
    │   ├───/nix/store/f5zq1g323xw7pbl72vnc9i414zwmqbny-boost-1.81.0
    │   │   ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...]
    │   │   ├───/nix/store/ybjcla5bhj8g1y84998pn4a2drfxybkv-gcc-13.3.0-lib [...]
    │   │   └───/nix/store/f5zq1g323xw7pbl72vnc9i414zwmqbny-boost-1.81.0 [...]
    │   ├───/nix/store/k1dsk0zyq43pvi7f76is2rx6l4aphm5z-openssl-3.3.2
    │   │   ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...]
    │   │   └───/nix/store/k1dsk0zyq43pvi7f76is2rx6l4aphm5z-openssl-3.3.2 [...]
    │   ├───/nix/store/ki28jqabr02w1k3p4h2ky230vzh9k4n8-libsodium-1.0.20
    │   │   ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...]
    │   │   └───/nix/store/ki28jqabr02w1k3p4h2ky230vzh9k4n8-libsodium-1.0.20 [...]

Maybe it would be better to just try to uninstall nix or something?

## Describe the bug A variation on <https://git.lix.systems/lix-project/lix/issues/411>. ## Steps To Reproduce With NixCpp installed, run: ```bash sudo --preserve-env=PATH $(which nix) run \ --experimental-features "nix-command flakes" \ --extra-substituters https://cache.lix.systems --extra-trusted-public-keys "cache.lix.systems:aBnZUw8zA7H35Cz2RyKFV s3H4PlGTLawyY5KRbvJR8o=" \ 'git+https://git.lix.systems/lix-project/lix?ref=refs/tags/2.93.0' -- \ upgrade-nix \ --extra-substituters https://cache.lix.systems --extra-trusted-public-keys "cache.lix.systems:aBnZUw8zA7H35Cz2RyKFV s3H4PlGTLawyY5KRbvJR8o=" -vv ``` (This is the code on https://lix.systems/install/ with `nix run` replaced with `$(which nix) run` because the former had `sudo` complaining it couldn't find `nix`, and `-vv` flags added to show what it's trying to do.) This produces the following output: ```shell-output found Nix in '/nix/var/nix/profiles/default/bin' found profile '/nix/var/nix/profiles/default' upgrading Nix in profile '/nix/var/nix/profiles/default' querying latest Nix version... downloading 'https://releases.lix.systems/manifest.nix'... downloading '/nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0'...... verifying that '/nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0' works...... running /nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0/bin/nix-env --uninstall /nix/store/xlg2s2hdngc2gjb6kfwac1g7b4q2pcg5-nix-2.28.3/bin/nix-env --profile /nix/var/nix/profiles/default warning: selector '/nix/store/xlg2s2hdngc2gjb6kfwac1g7b4q2pcg5-nix-2.28.3/bin/nix-env' matched no installed derivations running /nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0/bin/nix-env --profile /nix/var/nix/profiles/default --install /nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0 --no-sandbox installing 'lix-2.93.0' building '/nix/store/c1bn8sps0rpxirv75y9sqps54l79fm6s-user-environment.drv'... error: Unable to build profile. There is a conflict for the following files: /nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0/libexec/nix/build-remote /nix/store/pfh6bq2wxbpp3xz5sinymmp44n505zh8-nix-2.28.3/libexec/nix/build-remote error: builder for '/nix/store/c1bn8sps0rpxirv75y9sqps54l79fm6s-user-environment.drv' failed with exit code 1 error: program '/nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0/bin/nix-env' failed with exit code 100 ``` New in this variant of the problem: ``` running /nix/store/c47cym23n56kkss8z0ican8nynkf6cwk-lix-2.93.0/bin/nix-env --uninstall /nix/store/xlg2s2hdngc2gjb6kfwac1g7b4q2pcg5-nix-2.28.3/bin/nix-env --profile /nix/var/nix/profiles/default warning: selector '/nix/store/xlg2s2hdngc2gjb6kfwac1g7b4q2pcg5-nix-2.28.3/bin/nix-env' matched no installed derivations ``` ## Expected behavior Given the discussion in https://git.lix.systems/lix-project/lix/issues/411, the change in cl/1604, and the fact that the command is running a version of the `upgrade-nix` command that contains the commit https://git.lix.systems/lix-project/lix/commit/ae7eab49b952895b3aa88192768843bccabe1ea2, I was expecting this to actually work. ## `nix --version` output ```nix (Nix) 2.28.3``` ## Additional context ```$ nixfmt < /nix/var/nix/profiles/default/manifest.nix [ { meta = { }; name = "nix-2.28.3"; out = { outPath = "/nix/store/pfh6bq2wxbpp3xz5sinymmp44n505zh8-nix-2.28.3"; }; outPath = "/nix/store/pfh6bq2wxbpp3xz5sinymmp44n505zh8-nix-2.28.3"; outputs = [ "out" ]; system = "unknown"; type = "derivation"; } { meta = { }; name = "nss-cacert-3.95"; out = { outPath = "/nix/store/sp6cj9vw557zpfirwvvix36p58av82dj-nss-cacert-3.95"; }; outPath = "/nix/store/sp6cj9vw557zpfirwvvix36p58av82dj-nss-cacert-3.95"; outputs = [ "out" ]; system = "unknown"; type = "derivation"; } ] ``` Note that the manifest references store path: ``` /nix/store/pfh6bq2wxbpp3xz5sinymmp44n505zh8-nix-2.28.3 ``` but lix's upgrade-nix tried to uninstall: ``` /nix/store/xlg2s2hdngc2gjb6kfwac1g7b4q2pcg5-nix-2.28.3/bin/nix-env ``` It seems that the former consists mostly of symlinks to the inside of the latter's store object? Here's the dependency tree: ``` $ nix-store --query --tree /nix/store/pfh6bq2wxbpp3xz5sinymmp44n505zh8-nix-2.28.3 /nix/store/pfh6bq2wxbpp3xz5sinymmp44n505zh8-nix-2.28.3 └───/nix/store/xlg2s2hdngc2gjb6kfwac1g7b4q2pcg5-nix-2.28.3 ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 │ ├───/nix/store/2d5spnl8j5r4n1s4bj1zmra7mwx0f1n8-xgcc-13.3.0-libgcc │ ├───/nix/store/qwjjm4j652ck9izaid7bz63s4hd5bnha-libidn2-2.3.7 │ │ ├───/nix/store/6pqgj71r0850b0cd95yxx0d52zax016i-libunistring-1.2 │ │ │ └───/nix/store/6pqgj71r0850b0cd95yxx0d52zax016i-libunistring-1.2 [...] │ │ └───/nix/store/qwjjm4j652ck9izaid7bz63s4hd5bnha-libidn2-2.3.7 [...] │ └───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...] ├───/nix/store/ybjcla5bhj8g1y84998pn4a2drfxybkv-gcc-13.3.0-lib │ ├───/nix/store/j8rzqx7farv0w3isp9z943zy437zk02f-gcc-13.3.0-libgcc │ ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...] │ └───/nix/store/ybjcla5bhj8g1y84998pn4a2drfxybkv-gcc-13.3.0-lib [...] ├───/nix/store/319hpn6dffzslywqhvjcwhs8xj822rdl-nix-util-2.28.3 │ ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...] │ ├───/nix/store/2vgwd43vqxm66grkgsy7z1d87z31nzph-brotli-1.1.0-lib │ │ ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...] │ │ └───/nix/store/2vgwd43vqxm66grkgsy7z1d87z31nzph-brotli-1.1.0-lib [...] │ ├───/nix/store/ybjcla5bhj8g1y84998pn4a2drfxybkv-gcc-13.3.0-lib [...] │ ├───/nix/store/f5zq1g323xw7pbl72vnc9i414zwmqbny-boost-1.81.0 │ │ ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...] │ │ ├───/nix/store/ybjcla5bhj8g1y84998pn4a2drfxybkv-gcc-13.3.0-lib [...] │ │ └───/nix/store/f5zq1g323xw7pbl72vnc9i414zwmqbny-boost-1.81.0 [...] │ ├───/nix/store/k1dsk0zyq43pvi7f76is2rx6l4aphm5z-openssl-3.3.2 │ │ ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...] │ │ └───/nix/store/k1dsk0zyq43pvi7f76is2rx6l4aphm5z-openssl-3.3.2 [...] │ ├───/nix/store/ki28jqabr02w1k3p4h2ky230vzh9k4n8-libsodium-1.0.20 │ │ ├───/nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36 [...] │ │ └───/nix/store/ki28jqabr02w1k3p4h2ky230vzh9k4n8-libsodium-1.0.20 [...] ``` Maybe it would be better to just try to uninstall `nix` or something?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#839
No description provided.