nix-user-chroot
nix-user-chroot copied to clipboard
Invalid cross-device link
> mkdir -m 0755 ~/private/.nix
> ./private/nix-user-chroot ~/private/.nix bash -c "curl -L https://nixos.org/nix/install | bash"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 2490 100 2490 0 0 11690 0 --:--:-- --:--:-- --:--:-- 11690
downloading Nix 2.3.7 binary tarball for x86_64-linux from 'https://releases.nixos.org/nix/nix-2.3.7/nix-2.3.7-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.qU8sjaLWPz'...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 16.4M 100 16.4M 0 0 8935k 0 0:00:01 0:00:01 --:--:-- 8930k
Note: a multi-user installation is possible. See https://nixos.org/nix/manual/#sect-multi-user-installation
performing a single-user installation of Nix...
copying Nix to /nix/store......................................
installing 'nix-2.3.7'
error: linking '/nix/store/b64sdzfcc4wd2p656i9jskxdmhjkq0cv-user-environment.drv.chroot/nix/store/p8ij3l24f23kzcmfk1qd5kyzr4rp54w8-env-manifest.nix' to '/nix/store/p8ij3l24f23kzcmfk1qd5kyzr4rp54w8-env-manifest.nix': Invalid cross-device link
I'm not sure what /nix/store/b64sdzfcc4wd2p656i9jskxdmhjkq0cv-user-environment.drv.chroot/ is because it does not appear to exist
I think it is this here:
https://github.com/NixOS/nix/blob/8a945d6ddb0676b454458e6fe0e9ea6f8b4b5659/src/nix-env/buildenv.nix#L6
@Mic92 Is it supposed to be a directory?
@Mic92 Is it supposed to be a directory?
It is created by nix during the build I think.
The solution was to disable sandboxing by writing sandbox = false
to /nix/etc/nix/nix.conf
before installing nix
Ok. Maybe we should mention that in our installation guide:
export NIX_CONF_DIR=some-alternative-dir
should also work to provide a different configuration during installation.
This error also occurs during NixOS installation, when a script created using pkgs.writeShellApplication
fails the shellcheck
step. See MWE here.
The same error occurred for me when installing NixOS with configuration for kmonad NixOSmodule. It seemed to have an issue linking my .kbd file. So it's not only the SpellCheck that causes this.
The same error occurred for me when installing NixOS with configuration for kmonad NixOSmodule. It seemed to have an issue linking my .kbd file. So it's not only the SpellCheck that causes this.
You are right, I've also experienced it occasionally with other packages during NixOS installation. It seems that this "Invalid cross-device link" error usually masks the root cause, which can, however, be found out when only building the system config via
nix build <flake-path>#nixosConfigurations.<hostname>.config.system.build.toplevel
(when using Flakes and the new Nix command).