I’m having trouble building packages with qemu binfmt emulation a non-NixOS machine with a multi-user Nix installation. I’m able to run cross-compiled software and downloads from hydra without issues, but local builds fail:
$ nix-build '<nixpkgs>' --argstr system aarch64-linux --extra-platforms aarch64-linux -A hello --check
checking outputs of '/nix/store/2mpxaab69rypxnxqrrz5hhjb5a3m1145-hello-2.10.drv'...
while setting up the build environment: executing '/nix/store/bxfqr7x48qfcm7cz2lm5lj3cs2rhqxn5-bash-4.4-p23/bin/bash': No such file or directory
builder for '/nix/store/2mpxaab69rypxnxqrrz5hhjb5a3m1145-hello-2.10.drv' failed with exit code 1
error: build of '/nix/store/2mpxaab69rypxnxqrrz5hhjb5a3m1145-hello-2.10.drv' failed
Oddly enough that bash executable seems correct and works fine for me interactively.
$ file /nix/store/bxfqr7x48qfcm7cz2lm5lj3cs2rhqxn5-bash-4.4-p23/bin/bash
/nix/store/bxfqr7x48qfcm7cz2lm5lj3cs2rhqxn5-bash-4.4-p23/bin/bash: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /nix/store/hp3hmiarz8giqa6958qrq4finl8cb07r-glibc-2.31/lib/ld-linux-aarch64.so.1, for GNU/Linux 2.6.32, not stripped
$ /nix/store/bxfqr7x48qfcm7cz2lm5lj3cs2rhqxn5-bash-4.4-p23/bin/bash -c "echo hello"
hello