home-manager icon indicating copy to clipboard operation
home-manager copied to clipboard

bug: new home-manager install fails with file conflict between home-manager-path and nix-2.9.0

Open benjaminfjones opened this issue 2 years ago • 17 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Issue description

While installing Nix and home-manager on a new machine, I encountered a file priority conflict error:

sh <(curl -L https://nixos.org/nix/install) --no-daemon
export NIX_PATH=$HOME/.nix-defexpr/channels:/nix/var/nix/profiles/per-user/ubuntu/channels

nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install

results in ...

Creating initial Home Manager generation...

/nix/store/qk1v11a6d6qk8g584kwwj71hmzr23apr-home-manager-generation
Starting Home Manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
installing 'home-manager-path'
building '/nix/store/nd94p3ar0wc3w55cr65161gxpqc0q2cg-user-environment.drv'...
error: files '/nix/store/kqcy7af4psh1plik6hjahm9hg0qzzr3q-home-manager-path/share/zsh/site-functions/_nix' and '/nix/store/2pnxdjz3x3c3jqadaks1h3zm83mhb9az-nix-2.9.0/share/zsh/site-functions/_nix' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' or type 'nix profile install --help' if using 'nix profile' to find out howto change the priority of one of the conflicting packages (0 being the highest priority)
error: builder for '/nix/store/nd94p3ar0wc3w55cr65161gxpqc0q2cg-user-environment.drv' failed with exit code 1

Oops, Nix failed to install your new Home Manager profile!

Perhaps there is a conflict with a package that was installed using
"nix-env -i"? Try running

    nix-env -q

and if there is a conflicting package you can remove it with

    nix-env -e {package name}

Then try activating your Home Manager configuration again.
Uh oh, the installation failed! Please create an issue at

    https://github.com/nix-community/home-manager/issues

if the error seems to be the fault of Home Manager.

Maintainer CC

No response

System information

- system: `"x86_64-linux"`
 - host os: `Linux 5.4.0-1018-aws, Ubuntu, 20.04.4 LTS (Focal Fossa), nobuild`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.9.0`
 - channels(ubuntu): `"home-manager, nixpkgs"`
 - nixpkgs: `/home/ubuntu/.nix-defexpr/channels/nixpkgs`

benjaminfjones avatar Jun 04 '22 19:06 benjaminfjones

Explicitly setting the file priority one way or the other fixes the problem,

nix-env --set-flag priority 0 nix-2.9.0
nix-shell '<home-manager>' -A install
... 
<works!>

but I don't see anything about this issue in the user manual, the github issues, or google searching.

benjaminfjones avatar Jun 04 '22 19:06 benjaminfjones

I think this might be #2848

sullyj3 avatar Jul 16 '22 12:07 sullyj3

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

stale[bot] avatar Oct 14 '22 19:10 stale[bot]

Closing in favor of #2848

benjaminfjones avatar Oct 31 '22 05:10 benjaminfjones

#2848 has been resolved, but this bug still exists.

ameyp avatar Nov 10 '22 19:11 ameyp

Apparently nix works around this issue with this block

https://github.com/NixOS/nix/issues/5445#issuecomment-954273357

ameyp avatar Nov 11 '22 16:11 ameyp

A similar issue but with a different file happens for me on a pristine install (reproduced with the nixos/nix Docker image).

docker run --rm -i nixos/nix <<EOF
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
EOF

This fails with the following error:

error: files '/nix/store/bp0ibyzjlclkjhb0mr6n8mbamyfh5qpx-man-db-2.10.2/share/locale/ro/LC_MESSAGES/man-db.mo' and '/nix/store/58s0kcp3yp8720l33lk2i7nzjszz6qbk-home-manager-path/share/locale/ro/LC_MESSAGES/man-db.mo' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' or type 'nix profile install --help' if using 'nix profile' to find out howto change the priority of one of the conflicting packages (0 being the highest priority)
error: builder for '/nix/store/5n9043i7fwcpyfc8c7j4gqy7axgrvhq7-user-environment.drv' failed with exit code 1

Oops, Nix failed to install your new Home Manager profile!

Perhaps there is a conflict with a package that was installed using
"nix-env -i"? Try running

    nix-env -q

and if there is a conflicting package you can remove it with

    nix-env -e {package name}

Then try activating your Home Manager configuration again.
Uh oh, the installation failed! Please create an issue at

    https://github.com/nix-community/home-manager/issues

if the error seems to be the fault of Home Manager.

Docker image: nixos/nix@sha256:d8c6b97091d6944dd773c3c239899af047077dbf5411ef229bb50e5b21404b0d nixpkgs release: https://releases.nixos.org/nixpkgs/nixpkgs-22.11pre426729.dad4de1694c home-manager HEAD: https://github.com/nix-community/home-manager/commit/bc90de24d898655542589237cc0a6ada7564cb6c

sybereal avatar Nov 15 '22 01:11 sybereal

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

stale[bot] avatar Feb 13 '23 03:02 stale[bot]

I think this issue isn't stale since I'm facing the same problems when trying to install home manager in a Docker Container (nixos/nix) as described in the comment above.

tuxflo avatar Apr 23 '23 22:04 tuxflo

I am able to reproduce this in the official nixos/nix container as well.

Step 1: start fresh container

$ podman pull nixos/nix && podman run --rm -it nixos/nix

Step 2: follow website instructions

$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager \
&& nix-channel --update \
&& nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager && nix-channel --update \
&& nix-shell '<home-manager>' -A install

Error:

bash-5.1# nix-shell '<home-manager>' -A install
The file /root/.config/home-manager/home.nix already exists, leaving it unchanged...

Creating initial Home Manager generation...

trace: warning: lib.modules.defaultPriority is deprecated, please use lib.modules.defaultOverridePriority instead.
/nix/store/szp16zn35nfkcqyv3kqv9bxrsxndnrb3-home-manager-generation
Starting Home Manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
installing 'home-manager-path'
building '/nix/store/4b8mpn7yszcn0c0qy4vr3lwh6bcr3skv-user-environment.drv'...
error: Unable to build profile. There is a conflict for the following files:

         /nix/store/26g7nm0ps69xdyn1am9rmvrfg2zkkbmg-man-db-2.10.2/bin/accessdb
         /nix/store/ipg0hj6ma0qzqgp26067jynjbnx5lyfq-home-manager-path/bin/accessdb
error: builder for '/nix/store/4b8mpn7yszcn0c0qy4vr3lwh6bcr3skv-user-environment.drv' failed with exit code 1

Oops, Nix failed to install your new Home Manager profile!

Perhaps there is a conflict with a package that was installed using
"nix-env -i"? Try running

    nix-env -q

and if there is a conflicting package you can remove it with

    nix-env -e {package name}

Then try activating your Home Manager configuration again.
Uh oh, the installation failed! Please create an issue at

    https://github.com/nix-community/home-manager/issues

if the error seems to be the fault of Home Manager.

I don't get why man-db-2.10.2 conflicts with home-manager-path and not sure if I should remove man-db (which I did not install). Here is nix-env -q for reference:

bash-5.1# nix-env -q
bash-interactive-5.1-p16
coreutils-full-9.1
curl-7.86.0
findutils-4.9.0
git-2.38.1
gnugrep-3.7
gnutar-1.34
gzip-1.12
iana-etc-20220915
less-608
man-db-2.10.2
nix-2.16.1
nss-cacert-3.83
openssh-9.1p1
wget-1.21.3
which-2.21

And before running any home manager commands:

$ podman run --rm nixos/nix nix-env -q
bash-interactive-5.1-p16
coreutils-full-9.1
curl-7.86.0
findutils-4.9.0
git-2.38.1
gnugrep-3.7
gnutar-1.34
gzip-1.12
iana-etc-20220915
less-608
man-db-2.10.2
nix-2.16.1
nss-cacert-3.83
openssh-9.1p1
wget-1.21.3
which-2.21

osalbahr avatar Jul 13 '23 23:07 osalbahr

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

stale[bot] avatar Oct 12 '23 01:10 stale[bot]

This is still an issue. https://github.com/nix-community/home-manager/pull/4421 is my attempt at mitigating it by introducing a configuration option and a flag to set the priority of the packages installed by home-manager

e-nikolov avatar Oct 12 '23 01:10 e-nikolov

still occurring here

docker build --file .\dockerfile -t nix_controller .
36.12 installing 'home-manager-path'
36.13 building '/nix/store/ijndcnsr48m1pz04n9pnfdp56k45zr5k-user-environment.drv'...
36.22 error: Unable to build profile. There is a conflict for the following files:
36.22
36.22          /nix/store/g9sv3xrdasimd6xp4rd7pjli7xb70qr7-man-db-2.11.2/libexec/man-db/manconv
36.22          /nix/store/vr04ag53qddlr77886lq9mmssibbaz18-man-db-2.11.2/libexec/man-db/manconv
36.23 error: builder for '/nix/store/ijndcnsr48m1pz04n9pnfdp56k45zr5k-user-environment.drv' failed with exit code 1
36.24
36.24 Oops, Nix failed to install your new Home Manager profile!
36.24
36.24 Perhaps there is a conflict with a package that was installed using
36.24 "nix-env -i"? Try running
36.24
36.24     nix-env -q
36.24
36.24 and if there is a conflicting package you can remove it with
36.24
36.24     nix-env -e {package name}
36.24
36.24 Then try activating your Home Manager configuration again.
36.24 Uh oh, the installation failed! Please create an issue at
36.24
36.24     https://github.com/nix-community/home-manager/issues
36.24
36.24 if the error seems to be the fault of Home Manager.
bash-5.2# nix-env -q
bash-interactive-5.2-p15
coreutils-full-9.1
curl-8.1.1
findutils-4.9.0
git-2.40.1
gnugrep-3.7
gnutar-1.35
gzip-1.12
iana-etc-20230316
less-608
nix-2.18.1
nss-cacert-3.92
openssh-9.3p2
wget-1.21.4
which-2.21

the-nurk avatar Oct 20 '23 16:10 the-nurk

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

stale[bot] avatar Jan 19 '24 12:01 stale[bot]

Not stale

e-nikolov avatar Jan 19 '24 19:01 e-nikolov

Reproducer:

FROM nixos/nix

RUN nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
RUN nix-channel --update
RUN nix-shell '<home-manager>' -A install
RUN home-manager switch

Command: docker buildx build . -t nix:latest

Quick fix:

FROM nixos/nix

RUN nix-env --uninstall man-db
RUN nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
RUN nix-channel --update
RUN nix-shell '<home-manager>' -A install
RUN home-manager switch

drupol avatar Apr 08 '24 20:04 drupol

This can happen when you move/copy your home folder to a new computer, and prolly depends on how you install home-manager. Since I do it via /etc/nix/configuration.nix for me it happens every time.

The reason is that there will be a symlink /home/<username>/.nix-profile which points to a non-existant /nix/var/nix/profiles/per-user/<username> directory. To work around it, just create the non-existant directory and chown it to the <username>

The home-manager activation script should do a mkdir -p /nix/var/nix/profiles/per-user/<username> for this usecase.

devvythelopper avatar Apr 20 '24 16:04 devvythelopper