I’m trying to install an aarch64-linux system (rpi 4), mounted at /mnt/tmp2
, from an x86_64 NixOS host. I have configured boot.binfmt.emulatedSystems = ["aarch64-linux"];
and can successfully build and run nixpkgs#legacyPackages.aarch64-linux.hello
.
Whenever I try to nixos-install
or subsequently nixos-enter
this system, I get an error about /nix/var/nix/profiles/system/activate
not existing:
# nixos-install --root /mnt/tmp2 --flake /mnt/tmp2/home/n8henrie/git/nixos#homeslice --show-trace -vvv
building the flake in git+file:///mnt/tmp2/home/n8henrie/git/nixos...
evaluating derivation 'git+file:///mnt/tmp2/home/n8henrie/git/nixos#nixosConfigurations."homeslice".config.system.build.toplevel'...
evaluating file '/mnt/tmp2/nix/store/27cfxv8m4n5nn2f2l31s9hg36mkx6xi9-source/flake.nix'
querying info about missing paths...
starting pool of 24 threads
substitution of '/nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e': created
substitution of '/nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e': woken up
querying info about missing paths...
starting pool of 24 threads
entered goal loop
substitution of '/nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e': init
acquiring write lock on '/mnt/tmp2/nix/var/nix/temproots/598998'
substitution of '/nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e': done
substitution of '/nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e': goal destroyed
switching to new user environment
installing the boot loader...
chroot: failed to run command ‘/nix/var/nix/profiles/system/activate’: No such file or directory
chroot: failed to run command ‘/nix/var/nix/profiles/system/sw/bin/bash’: No such file or directory
Not sure if there is something wrong with the symlinks?
# ls -l /mnt/tmp2/nix/var/nix/profiles/system/activate
ls: cannot access '/mnt/tmp2/nix/var/nix/profiles/system/activate': No such file or directory
# ls -l /mnt/tmp2/nix/var/nix/profiles/system/activate
ls: cannot access '/mnt/tmp2/nix/var/nix/profiles/system/activate': No such file or directory
#
# # the `system` link seems broken?
# stat /mnt/tmp2$(readlink -f /mnt/tmp2/nix/var/nix/profiles/system)/activate
File: /mnt/tmp2/nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e/activate
Size: 28654 Blocks: 18 IO Block: 28672 regular file
Device: 0,70 Inode: 904760 Links: 2
Access: (0555/-r-xr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2023-08-22 15:24:50.932883329 -0600
Modify: 1969-12-31 17:00:01.000000000 -0700
Change: 2023-08-22 15:24:50.806876264 -0600
Birth: 2023-08-22 15:24:50.798875815 -0600
Installing without the bootloader still produced those errors but looked a little more promising:
# nixos-install --root /mnt/tmp2 --flake /mnt/tmp2/home/n8henrie/git/nixos#homeslice --no-bootloader
warning: Git tree '/mnt/tmp2/home/n8henrie/git/nixos' is dirty
building the flake in git+file:///mnt/tmp2/home/n8henrie/git/nixos...
warning: Git tree '/mnt/tmp2/home/n8henrie/git/nixos' is dirty
chroot: failed to run command ‘/nix/var/nix/profiles/system/activate’: No such file or directory
chroot: failed to run command ‘/nix/var/nix/profiles/system/sw/bin/bash’: No such file or directory
installation finished!
I thought perhaps I could nixos-enter
since the installation seemed to have gotten pretty far:
# nixos-enter --root /mnt/tmp2
chroot: failed to run command ‘/nix/var/nix/profiles/system/activate’: No such file or directory
chroot: failed to run command ‘/nix/var/nix/profiles/system/sw/bin/bash’: No such file or directory
Then I thought maybe I could manually follow the symlinks and specify the full path to system
:
# nixos-enter --root /mnt/tmp2 --system /mnt/tmp2//nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e
chroot: failed to run command '/mnt/tmp2//nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e/activate': No such file or directory
chroot: failed to run command ‘/nix/var/nix/profiles/system/sw/bin/bash’: No such file or directory
#
# ls -l /mnt/tmp2//nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e/activate
-r-xr-xr-x 2 root root 28654 Dec 31 1969 /mnt/tmp2//nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e/activate
#
# # or maybe without the `/mnt/tmp2` prefix?
# nixos-enter --root /mnt/tmp2 --system /nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e
chroot: failed to run command '/nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e/activate': No such file or directory
chroot: failed to run command ‘/nix/var/nix/profiles/system/sw/bin/bash’: No such file or directory
# ls -ld /mnt/tmp2/nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e
dr-xr-xr-x 4 root root 23 Dec 31 1969 /mnt/tmp2/nix/store/aa0cyxj9719kd044x7wn1k5pqmaf6hls-nixos-system-homeslice-23.05.20230820.52e3c9e
I am going nuts here.
The device passes a smartctl test and zfs scrub is normal.
It’s mounted at /mnt/tmp2
because I read an old / resolved issue where people were required to manually create /mnt/tmp
(my original mountpoint), so I thought perhaps it was problematic to use that mountpoint.
I’ve tried using --max-jobs 0
with an Arch Linux substituter that regularly does my aarch64-linux
builds, no luck.
I tried a rm -rf /mnt/tmp2/nix/*
to force it to rebuild everything, resulted in the same error.
Tried from a nix shell nixpkgs/master#nixos-install-tools
(since I’m pinned to release-23.05), same error.
Any ideas? This one has me stumped.
The host:
$ nix-info -m
- system: `"x86_64-linux"`
- host os: `Linux 6.3.13, NixOS, 23.05 (Stoat), 23.05.20230822.26260b1`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.13.5`
- channels(root): `""`
- nixpkgs: `/nix/store/mnrrmipim9qabwy89c1pbx28nrcxrf6y-source`