Browse Source

xbps-src: remove proot chroot-style

proot is broken and result in random hard to debug issues,
this is the best way to not have new users use it.
master
Duncaen 4 months ago
committed by Michael Aldridge
parent
commit
3eed75216c
  1. 14
      README.md
  2. 30
      common/chroot-style/proot.sh
  3. 3
      common/xbps-src/libexec/build.sh
  4. 3
      etc/defaults.conf
  5. 4
      xbps-src

14
README.md

@ -51,7 +51,6 @@ multiple utilities to accomplish this task:
- `ethereal` - only useful for one-shot containers, i.e docker (used with CI).
- `xbps-uunshare(1)` - XBPS utility that uses `user_namespaces(7)` (part of xbps, default).
- `xbps-uchroot(1)` - XBPS utility that uses `namespaces` and must be `setgid` (part of xbps).
- `proot(1)` - utility that implements chroot/bind mounts in user space, see https://proot-me.github.io/.
> NOTE: `xbps-src` does not allow building as root anymore. Use one of the chroot
methods shown above.
@ -136,17 +135,6 @@ If for some reason it's erroring out as `ERROR clone (Operation not permitted)`,
your user is a member of the required `group` and that `xbps-uchroot(1)` utility has the
proper permissions and owner/group as explained above.
#### proot(1)
The `proot(1)` utility implements chroot and bind mounts support completely in user space,
and can be used if your Linux kernel does not have support for namespaces. See https://proot-me.github.io/.
for more information.
To enable it:
$ cd void-packages
$ echo XBPS_CHROOT_CMD=proot >> etc/conf
<a name="install-bootstrap"></a>
### Install the bootstrap packages
@ -404,7 +392,7 @@ checksum of the downloaded file matches the one specified in the template.
Ultimately, if no mirror carries the distfile, or in case all downloads failed the
checksum verification, the original download location is used.
If you use `proot` or `uchroot` for your XBPS_CHROOT_CMD, you may also specify a local path
If you use `uchroot` for your XBPS_CHROOT_CMD, you may also specify a local path
using the `file://` prefix or simply an absolute path on your build host (e.g. /mnt/distfiles).
Mirror locations specified this way are bind mounted inside the chroot environment
under $XBPS_MASTERDIR and searched for distfiles just the same as remote locations.

30
common/chroot-style/proot.sh

@ -1,30 +0,0 @@
#!/bin/sh
#
# This chroot script uses proot (see http://proot.me)
#
readonly MASTERDIR="$1"
readonly DISTDIR="$2"
readonly HOSTDIR="$3"
readonly EXTRA_ARGS="$4"
shift 4
if ! command -v proot >/dev/null 2>&1; then
exit 1
fi
if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
echo "$0 MASTERDIR/DISTDIR not set"
exit 1
fi
# proot does not properly return the resultcode. Workaround this
RESULT=$(mktemp) || exit 1
PROOT_NO_SECCOMP=1 proot -r $MASTERDIR -w / -b "$RESULT:/.result" -b $DISTDIR:/void-packages \
${HOSTDIR:+-b $HOSTDIR:/host} -b /proc:/proc -b /dev:/dev \
-b /sys:/sys $EXTRA_ARGS /bin/sh -c '$@; echo $? > /.result' $0 $@
rv=$(cat "$RESULT")
rm "$RESULT"
exit $rv

3
common/xbps-src/libexec/build.sh

@ -41,9 +41,6 @@ check_pkg_arch $XBPS_CROSS_BUILD
if [ -z "$XBPS_CROSS_PREPARE" ]; then
prepare_cross_sysroot $XBPS_CROSS_BUILD || exit $?
fi
if [ -z "$XBPS_DEPENDENCY" -a -z "$XBPS_TEMP_MASTERDIR" -a -n "$XBPS_KEEP_ALL" -a "$XBPS_CHROOT_CMD" = "proot" ]; then
remove_pkg_autodeps
fi
# Install dependencies from binary packages
if [ "$PKGNAME" != "$XBPS_TARGET_PKG" -o -z "$XBPS_SKIP_DEPS" ]; then
install_pkg_deps $PKGNAME $XBPS_TARGET_PKG pkg $XBPS_CROSS_BUILD $XBPS_CROSS_PREPARE || exit $?

3
etc/defaults.conf

@ -120,14 +120,13 @@ XBPS_SUCMD="sudo /bin/sh -c"
#
# - uunshare (uses xbps-uunshare(1), user namespaces)
# - uchroot (uses xbps-uchroot(1), namespaces, setgid)
# - proot (uses proot, external, does not need special permissions)
# - bwrap (uses bwrap, external, does not need special permissions)
# - ethereal (uses root, needs no permissions, for disposable containers)
#
# The order is already set as shown above, but can be overriden below.
# Additional arguments to the chroot style can be passed in via XBPS_CHROOT_CMD_ARGS.
#
#XBPS_CHROOT_CMD=proot
#XBPS_CHROOT_CMD=uchroot
#XBPS_CHROOT_CMD_ARGS=""
# [OPTIONAL]

4
xbps-src

@ -319,7 +319,7 @@ read_pkg() {
setup_distfiles_mirror() {
local mirror scheme path
# Scheme file:// mirror locations only work with uchroot or proot
# Scheme file:// mirror locations only work with uchroot
for mirror in $XBPS_DISTFILES_MIRROR; do
scheme="file"
if [[ "$mirror" == *://* ]]; then
@ -329,7 +329,7 @@ setup_distfiles_mirror() {
path="$mirror"
fi
[ "$scheme" != "file" ] && continue
if [ "$XBPS_CHROOT_CMD" == "uchroot" -o "$XBPS_CHROOT_CMD" == "proot" ]; then
if [ "$XBPS_CHROOT_CMD" == "uchroot" ]; then
if [ ! -d "$path" ]; then
msg_warn "xbps-src: Invalid path in XBPS_DISTFILES_MIRROR ($mirror)\n"
continue

Loading…
Cancel
Save