the 'bwrap' mode does not work
During initial autobuilder development, I had intended to support different "modes" of operation, such as using chroot
or bwrap
or docker
as a backend for namespacing.
The bwrap
backend proved too difficult so the default was changed to chroot
, which has been working well.
This issue is to investigate the root cause of bwrap
failures, limitations, or usage errors.
For example:
>>> uucp: Building system/uucp 1.07-r0 (using abuild 3.4.2-r0) started Wed, 14 Jun 2023 13:19:04 +0000
>>> uucp: Checking sanity of /usr/src/packages/system/uucp/APKBUILD...
>>> uucp: Analyzing dependencies...
(1/2) Upgrading zlib (1.2.11-r1 -> 1.2.13-r0)
ERROR: Failed to set ownership on lib/.apk.3754b3db6a9f7c1694e504213709034c3b66729a9f81afe1: Invalid argument
ERROR: Failed to set ownership on lib/.apk.18f76108508a22199d34ce6cd480f511897ca79ad2b6d4eb: Invalid argument
(2/2) Installing .makedepends-uucp (20230614.131905)
1 error; 447 MiB in 94 packages
>>> ERROR: uucp: builddeps failed
>>> uucp: Uninstalling dependencies...
(1/1) Purging .makedepends-uucp (20230614.131905)
1 error; 447 MiB in 93 packages
A cursory search online yields:
- https://github.com/containers/bubblewrap/issues/395
- https://github.com/libarchive/libarchive/blob/master/tar/bsdtar.c#L246
A quick strace
suggests:
[pid 87] fchownat(3, "lib/.apk.3754b3db6a9f7c1694e504213709034c3b66729a9f81afe1", 0, 0, 0) = -1 EINVAL (Invalid argument)
However the outcome is successful:
...
>>> uucp: Build complete at Wed, 14 Jun 2023 13:24:59 +0000 elapsed time 0h 0m 28s
>>> uucp: Cleaning up srcdir
>>> uucp: Cleaning up pkgdir
>>> uucp: Uninstalling dependencies...
(1/1) Purging .makedepends-uucp (20230614.132431)
OK: 339 MiB in 93 packages
>>> uucp: Updating the system/armv7 repository index...
>>> uucp: Signing the index...
using this:
HOME=/usr/src setarch armv7l bwrap \
--uid 1000 --gid 300 --unshare-user \
--die-with-parent \
--bind /.autobuilder/armv7/rootfs / \
--bind /.autobuilder/armv7 /common \
--bind /.autobuilder/common/packages /packages \
--bind /.autobuilder/common/distfiles /var/cache/distfiles \
--dev /dev \
--proc /proc \
--tmpfs /tmp \
--unshare-ipc \
--unshare-pid \
--unshare-uts \
--unshare-cgroup /bin/sh -c 'cd; . /etc/profile; cd /usr/src/packages/system/uucp; abuild -r'
which is much closer to the bwraproot
function, whereas bwrapuser
is slightly different.