#988354 schroot: fails to enter zfs source chroots

Package:
schroot
Source:
schroot
Description:
Execute commands in a chroot environment
Submitter:
Sebastian Ramacher
Date:
2022-03-29 16:21:04 UTC
Severity:
normal
#988354#5
Date:
2021-05-11 08:48:00 UTC
From:
To:
Thanks for adding zfs support to schroot. While entering a zfs-backed
chroot works fine, i.e., schroot -c unstable-amd64-sbuild, trying to
enter the source chroot fails:

$ schroot -c source:unstable-amd64-sbuild
E: 10mount: filesystem 'tank/debian/schroot/unstable-amd64-sbuild' cannot be mounted using 'mount'.
E: 10mount: Use 'zfs set mountpoint=legacy' or 'zfs mount tank/debian/schroot/unstable-amd64-sbuild'.
E: 10mount: See zfs(8) for more information.
E: unstable-amd64-sbuild-74f80dc1-c405-4ec6-a7f5-b533ea723811: Chroot setup failed: stage=setup-start

Cheers

#988354#10
Date:
2022-03-29 16:19:56 UTC
From:
To:
Hello there,

FWIW, this works for me, so it might simply be that some additional
configuration is required. Thus the following just for reference:

My bash history tells me that I actually applied

# zfs set mountpoint=legacy zfspool/SYSTEM/srv/chroot/unstable-amd64-sbuild

when migrating to a ZFS-based schroot setup as per

# cat /etc/schroot/chroot.d/unstable-amd64-sbuild-*
[unstable-amd64-sbuild]
description=Debian unstable/amd64 autobuilder
groups=root,sbuild
root-groups=root,sbuild
profile=sbuild
type=zfs-snapshot
zfs-dataset=zfspool/SYSTEM/srv/chroot/unstable-amd64-sbuild
mount-options=-o relatime,async
command-prefix=/var/cache/pbuilder/ccache/sbuild-setup,eatmydata
aliases=UNRELEASED,sid,rc-buggy,experimental

and indeed it just works for me, cf. for illustration

$ schroot -c unstable-amd64-sbuild # normal access
(unstable-amd64-sbuild)fernst@fernst:~$ df -hT
Filesystem                                                                                                         Type   Size  Used Avail Use% Mounted on
zfspool/SYSTEM/srv/chroot/unstable-amd64-sbuild/schroot-unstable-amd64-sbuild-caeca563-8016-4209-a022-77f59f5d4058 zfs     65G  359M   64G   1% /
tmpfs                                                                                                              tmpfs   16G     0   16G   0% /dev/shm
zfspool/SYSTEM/var                                                                                                 zfs     50G   33G   18G  65% /build
zfspool/SYSTEM/home/fernst                                                                                         zfs    264G  201G   64G  76% /home/fernst/debian
/dev/mapper/lvmpool-root                                                                                           ext4    15G   11G  4.0G  73% /etc/sudoers.d/local-reprotest
(unstable-amd64-sbuild)fernst@fernst:~$ # CTRL+D here
exit
$ schroot -c source:unstable-amd64-sbuild # accessing the source chroot as a normal user
E: Access not authorised
I: You do not have permission to access the schroot service.
I: This failure will be reported.
$ sudo schroot -c source:unstable-amd64-sbuil # accessing the source chroot via sudo
(unstable-amd64-sbuild)root@fernst:/home/fernst# touch /blubber # apply some change
(unstable-amd64-sbuild)root@fernst:/home/fernst# # CTRL+D here
exit
$ schroot -c unstable-amd64-sbuild
(unstable-amd64-sbuild)fernst@fernst:~$ ls -al /blubber # check whether the above change persisted
-rw-r--r-- 1 root root 0 Mar 29 16:09 /blubber
(unstable-amd64-sbuild)fernst@fernst:~$ # CTRL+D here
exit

The only glitch I had so far with ZFS-based schroot I just reported in
<https://bugs.debian.org/1008616>, and there is a simple fix available.

Cheers,
Flo