• Bug#1087430: sbuild: expose underlying fs in unshare mode

    From Johannes Schauer Marin Rodrigues@21:1/5 to zeha@debian.org on Thu Apr 10 10:00:02 2025
    Hi,

    On Wed, 13 Nov 2024 15:05:58 +0100 Chris Hofstaedtler <zeha@debian.org> wrote:
    util-linux' upstream test suite tests very specific behaviours that
    involve the kernel and the underlying filesystem. To avoid broken
    tests, the testcases check for the filesystem they run on and skip
    tests if they are not prepared to run on a specific filesystem.

    The most problematic filesystem appears to be tmpfs, which is also
    the filesystem employed the Debian buildds.

    util-linux' test suite employs findmnt -T $PWD to check the
    filesystem. Unfortunately, in sbuild+unshare, this returns nothing. Apparently, this is because /proc/mounts has no entry for the
    directory in which the build runs.

    It would be good if we could a) not duplicate work done already
    upstream (f.e. by hunting for these test failures and disabling them
    in Debian), and b) not introduce strange cases into the upstream
    test suite (building in a directory that has no mount point in
    /proc/mounts is certainly "strange").

    Please see what can be done about this. I'll note that in schroot
    this "just works".

    This bug report was triggered by an IRC discussion in #debian-buildd involving aurel32, josch, jochensp and me. The specific instance
    started as https://github.com/util-linux/util-linux/issues/3266
    aka Debian bug #1086706. A previous instance of this is the
    "fadvise/count" test, which I've previously marked as known-failing
    in unshare, without realizing what the problem was - but it's the
    same problem really.

    it seems that util-linux worked around this issue in https://github.com/util-linux/util-linux/pull/3282

    Nevertheless, the situation is less than ideal. This is how findmnt output looks like inside sbuild unshare:

    TARGET SOURCE FSTYPE OPTIONS
    /dev/null udev[/null] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inod
    /dev/zero udev[/zero] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inod
    /dev/full udev[/full] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inod
    /dev/random udev[/random] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inod
    /dev/urandom udev[/urandom] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inod
    /dev/tty udev[/tty] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inod
    /dev/console udev[/console] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inod
    /dev/pts none devpts rw,nosuid,noexec,relatime,gid=100005,mode=620,ptmxmode=666
    /dev/shm tmpfs tmpfs rw,relatime,uid=100000,gid=100000,inode64
    /sys sysfs sysfs rw,nosuid,nodev,noexec,relatime ├─/sys/kernel/security
    │ securityfs securityfs rw,nosuid,nodev,noexec,relatime
    ├─/sys/fs/cgroup cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime
    ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime
    ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
    ├─/sys/kernel/debug debugfs debugfs rw,nosuid,nodev,noexec,relatime
    ├─/sys/kernel/tracing
    │ tracefs tracefs rw,nosuid,nodev,noexec,relatime
    ├─/sys/kernel/config configfs configfs rw,nosuid,nodev,noexec,relatime
    ├─/sys/fs/fuse/connections
    │ fusectl fusectl rw,nosuid,nodev,noexec,relatime
    └─/sys/kernel tmpfs tmpfs ro,relatime,size=4k,mode=000,uid=100000,gid=100000,inode64
    /proc proc proc rw,relatime


    And this is how it looks like in mmdebstrap in unshare mode:

    TARGET SOURCE FSTYPE OPTIONS
    / tmpfs[/mmdebstrap.CihrYkXMBA]
    │ tmpfs rw,nosuid,nodev,relatime,size=8388608k,inode64
    ├─/dev/console
    │ udev[/console] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inode64
    ├─/dev/full udev[/full] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inode64
    ├─/dev/null udev[/null] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inode64
    ├─/dev/pts none devpts rw,nosuid,noexec,relatime,uid=100005,mode=620,ptmxmode=666
    ├─/dev/random udev[/random] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inode64
    ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,inode64 ├─/dev/tty udev[/tty] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inode64
    ├─/dev/urandom
    │ udev[/urandom] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inode64
    ├─/dev/zero udev[/zero] devtmpfs rw,nosuid,relatime,size=1780476k,nr_inodes=445119,mode=755,inode64
    └─/proc proc proc rw,relatime

    It is very suboptimal that in sbuild, the root does not show up in /proc/mounts. I do not understand why there is a difference. Both implementations, mmdebstrap as well as sbuild, call this command to mount proc:

    mount -t proc proc $ROOTFS/proc

    I do not yet understand what these two implementations do different such that the root mount point is missing in sbuild but present in mmdebstrap...

    Thanks!

    cheers, josch
    --==============u88416877362685693=MIME-Version: 1.0
    Content-Transfer-Encoding: 7bit
    Content-Description: signature
    Content-Type: application/pgp-signature; name="signature.asc"; charset="us-ascii"

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEElFhU6KL81LF4wVq58sulx4+9g+EFAmf3d8oACgkQ8sulx4+9 g+HHwxAAtFymcoKW4MiHgn6Or/fdU6qRCS5MRGwsXxDvEhw3LmwHd35tQ61Hu62g qrEUKA0HmzdXKl0kgWKWQXHAH76fCt4rLiTiI4xdXyH1piVLzy4wTS/T1kiyftVe gTJ3yjeNmEoTe6L/vmKkfj/0G89Ouc3uvzx0b+cUj6TMLMrfVMfszK6dTk7E5kY/ isCA+eGxpoi/W9WeOV5EbU3Rni5QDjPZtPQiYoZxzxxl350CuizfzqpS02jw+Vc6 5sp2F7lrRxihYiP3Q/aZ2Mk0PCCTfDGU17uIKgr34k1Bxc3cb8+nccDVAU9BJ1yn gKsP6UsHJ4fwbe1AOIjP7lVp4p3yAV29tqdjf8CgCF1RF4auRQvSBSKljGL75MP0 0m/kAXBrDbxuoZqnlTVgPLG5cKGqj/lz+yt3OX1UgkkTdJtdajy8GE2gJ3ZaPupo EM3PPyo/Eb4QDKN/qV/VLZofvPafNlg+0nMkS/tsmKd5syKz46Rno/vNzyDRWKTO KGdIHPSbQPfWdpSNrNqsVAHLzjiBi5alO43ftH/vFScRLvnKcBnp6KUCOMZH7S6T vSZYqdkV8V2BpfHSvSygBoqPD2sdD8RW/gxFPEcHTC9GFqQksTULRkdZ3rmkiDi0 4+BT3HL7qhpXEIfFEuLgtXwyLGARst65vMIvovVm1J8LOqBoC/o=
    =eHCC
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)