NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.13k stars 1.47k forks source link

Install fails on SUSE Tumbleweed #1500

Open ToxicFrog opened 7 years ago

ToxicFrog commented 7 years ago
$ wget -O https://nixos.org/nix/install
$ /tmp/install
downloading Nix 1.11.13 binary tarball for x86_64-linux from 'https://nixos.org/releases/nix/nix-1.11.13/nix-1.11.13-x86_64-linux.tar.bz2' to '/tmp/nix-binary-tarball-unpack.2RMJDh9cHz'...
performing a single-user installation of Nix...
directory /nix does not exist; creating it by running ‘mkdir -m 0755 /nix && chown ben /nix’ using sudo
[sudo] password for root:
copying Nix to /nix/store.................................
initialising Nix database...
installing ‘nix-1.11.13’
building path(s) ‘/nix/store/qxng2qbahcf6dz19llqb4ivxw0bar57l-user-environment’
created 6 symlinks in user environment
error: opening lock file ‘/nix/var/nix/profiles/per-user/ben/profile.lock’: No such file or directory
/tmp/nix-binary-tarball-unpack.2RMJDh9cHz/unpack/nix-1.11.13-x86_64-linux/install: unable to install Nix into your default profile

$ ls /nix/var/nix/profiles                      
$
ToxicFrog commented 7 years ago

It looks like the cause was some .nix-foo files left in ~ from when this homedir was on NixOS. Rather than deleting/recreating them, the installer took the existing contents and had a bad time.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

0cjs commented 8 months ago

I'm also experiencing this on Debian 12 with a single-user install. With a /nix/ directory owned my me:

c$ chmod -R u+w /nix && rm -rf /nix/* && bash ./install 
downloading Nix 2.18.1 binary tarball for x86_64-linux from 'https://releases.nixos.org/nix/nix-2.18.1/nix-2.18.1-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.tc9noQI8mf'...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 20.6M  100 20.6M    0     0  10.3M      0  0:00:01  0:00:01 --:--:-- 10.3M
Note: a multi-user installation is possible. See https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation
performing a single-user installation of Nix...
copying Nix to /nix/store.................................................
installing 'nix-2.18.1'
building '/nix/store/hzx954rnda4k348rb4wvqbdzp9z0ynjy-user-environment.drv'...
error: opening lock file '/nix/var/nix/profiles/per-user/cjs/profile.lock': No such file or directory
/tmp/nix-binary-tarball-unpack.tc9noQI8mf/unpack/nix-2.18.1-x86_64-linux/install: unable to install Nix into your default profile
1 c$ mkdir /nix/var/nix/profiles/per-user/cjs
c$ bash ./install 
downloading Nix 2.18.1 binary tarball for x86_64-linux from 'https://releases.nixos.org/nix/nix-2.18.1/nix-2.18.1-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.oYLAsGnIJH'...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 20.6M  100 20.6M    0     0  10.6M      0  0:00:01  0:00:01 --:--:-- 10.6M
Note: a multi-user installation is possible. See https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation
performing a single-user installation of Nix...
copying Nix to /nix/store.................................................
installing 'nix-2.18.1'
unpacking channels...
modifying /home/cjs/.bash_profile...

Installation finished!  To ensure that the necessary environment
variables are set, either log in again, or type

  . /home/cjs/.nix-profile/etc/profile.d/nix.sh

in your shell.

Simply creating the directory and re-running seems to fix it, but that's both annoying and breaks the Devbox auto-install.

0cjs commented 8 months ago

I just found another work-around: rm -rf ~/.nix-* before running the install also fixes the issue, and let's a fresh install from an empty /nix/ work. I'm not clear on where the ~/.nix-* files came from, but they could have been left over from a previous install of the Nix system package from Debian.