I believe the second test in the file is failing, which essentially compares the output of the following two commands
steve@deb:~$ df --out=source,target /tmp
Filesystem Mounted on
/dev/vda1 /tmp
steve@deb:~$ df --out=source,target /dev/vda1
Filesystem Mounted on
/dev/vda1 /opt
Even though the system only has one proper filesystem (/dev/vda1 mounted on /), nix-user-chroot is creating multiple new mountpoints for the chroot which confuses df. The restriction of the "test to systems with a 1:1 mapping between source and target" doesn't appear to work as intended. I believe this can be resolved by simply not creating the chrooted mountpoints for /tmp, /opt, /home etc. when there is no particular filesystem for them in the host env.
Reproduce
Under a non-nixos installation (Debian 11 in QEMU/KVM for me). No tmpfs on /tmp is essential I think,
Currently compiling
pkgs.coreutils
from source fails thedf-symlink.sh
test. The relevant output in the build log isI believe the second test in the file is failing, which essentially compares the output of the following two commands
Even though the system only has one proper filesystem (
/dev/vda1
mounted on/
),nix-user-chroot
is creating multiple new mountpoints for the chroot which confusesdf
. The restriction of the "test to systems with a 1:1 mapping between source and target" doesn't appear to work as intended. I believe this can be resolved by simply not creating the chrooted mountpoints for/tmp
,/opt
,/home
etc. when there is no particular filesystem for them in the host env.Reproduce
tmpfs
on/tmp
is essential I think,nix-user-chroot
Build
coreutils
Detailed outputs
Output of `nix-info -m`
- system: `"x86_64-linux"` - host os: `Linux 5.10.0-19-amd64, Debian GNU/Linux, 11 (bullseye), nobuild` - multi-user?: `no` - sandbox: `no` - version: `nix-env (Nix) 2.12.0` - channels(steve): `"nixpkgs"` - nixpkgs: `/home/steve/.nix-defexpr/channels/nixpkgs`Output of `df --out=source,target` in host env
Output of `df --out=source,target` under `nix-user-chroot`
``` Filesystem Mounted on /dev/vda1 /opt udev /dev tmpfs /dev/shm tmpfs /run tmpfs /run/lock tmpfs /run/user/1000 ```Contents of /proc/mounts without nix-user-chroot
``` sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0 proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 udev /dev devtmpfs rw,nosuid,relatime,size=4056728k,nr_inodes=1014182,mode=755 0 0 devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0 tmpfs /run tmpfs rw,nosuid,nodev,noexec,relatime,size=814708k,mode=755 0 0 /dev/vda1 / ext4 rw,relatime,errors=remount-ro 0 0 securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0 tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0 tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0 cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0 pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0 none /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0 systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=10650 0 0 hugetlbfs /dev/hugepages hugetlbfs rw,relatime,pagesize=2M 0 0 mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0 debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0 tracefs /sys/kernel/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0 configfs /sys/kernel/config configfs rw,nosuid,nodev,noexec,relatime 0 0 fusectl /sys/fs/fuse/connections fusectl rw,nosuid,nodev,noexec,relatime 0 0 tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=814704k,nr_inodes=203676,mode=700,uid=1000,gid=1000 0 0 ```Contents of /proc/mounts with nix-user-chroot
``` /dev/vda1 /opt ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /etc ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /media ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /var ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /mnt ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /home ext4 rw,relatime,errors=remount-ro 0 0 udev /dev devtmpfs rw,nosuid,relatime,size=4056728k,nr_inodes=1014182,mode=755 0 0 devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0 tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0 hugetlbfs /dev/hugepages hugetlbfs rw,relatime,pagesize=2M 0 0 mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0 sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0 securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0 cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0 pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0 none /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0 debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0 tracefs /sys/kernel/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0 configfs /sys/kernel/config configfs rw,nosuid,nodev,noexec,relatime 0 0 fusectl /sys/fs/fuse/connections fusectl rw,nosuid,nodev,noexec,relatime 0 0 /dev/vda1 /tmp ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /tmp/nix-chroot.eDJknc/opt ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /tmp/nix-chroot.eDJknc/etc ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /tmp/nix-chroot.eDJknc/media ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /tmp/nix-chroot.eDJknc/var ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /tmp/nix-chroot.eDJknc/mnt ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /tmp/nix-chroot.eDJknc/home ext4 rw,relatime,errors=remount-ro 0 0 udev /tmp/nix-chroot.eDJknc/dev devtmpfs rw,nosuid,relatime,size=4056728k,nr_inodes=1014182,mode=755 0 0 devpts /tmp/nix-chroot.eDJknc/dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0 tmpfs /tmp/nix-chroot.eDJknc/dev/shm tmpfs rw,nosuid,nodev 0 0 hugetlbfs /tmp/nix-chroot.eDJknc/dev/hugepages hugetlbfs rw,relatime,pagesize=2M 0 0 mqueue /tmp/nix-chroot.eDJknc/dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0 sysfs /tmp/nix-chroot.eDJknc/sys sysfs rw,nosuid,nodev,noexec,relatime 0 0 securityfs /tmp/nix-chroot.eDJknc/sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0 cgroup2 /tmp/nix-chroot.eDJknc/sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0 pstore /tmp/nix-chroot.eDJknc/sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0 none /tmp/nix-chroot.eDJknc/sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0 debugfs /tmp/nix-chroot.eDJknc/sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0 tracefs /tmp/nix-chroot.eDJknc/sys/kernel/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0 configfs /tmp/nix-chroot.eDJknc/sys/kernel/config configfs rw,nosuid,nodev,noexec,relatime 0 0 fusectl /tmp/nix-chroot.eDJknc/sys/fs/fuse/connections fusectl rw,nosuid,nodev,noexec,relatime 0 0 /dev/vda1 /lost+found ext4 rw,relatime,errors=remount-ro 0 0 proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=10650 0 0 /dev/vda1 /root ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /srv ext4 rw,relatime,errors=remount-ro 0 0 tmpfs /run tmpfs rw,nosuid,nodev,noexec,relatime,size=814708k,mode=755 0 0 tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0 tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=814704k,nr_inodes=203676,mode=700,uid=1000,gid=1000 0 0 /dev/vda1 /usr ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /boot ext4 rw,relatime,errors=remount-ro 0 0 /dev/vda1 /nix ext4 rw,relatime,errors=remount-ro 0 0 ```