[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

creating Hurd chroots on Linux using DPKG_ROOT chrootless mode



Hi werdahias,

I hope you are the same person who recently asked in #debian-devel about using
mmdebstrap to create a Hurd chroot? If not, please ignore this mail.

I'm putting debian-hurd@lists.debian.org into CC for this mail as what I'm
writing here might be interesting for a wider audience.

The most important thing first: the mmdebstrap chrootless mode is called like
that because it runs all utilities without wrapping them in chroot(). This
means you must never run this mode as root or otherwise, packages that do not
yet have DPKG_ROOT support will modify the system you are running this on. If
you want to use chrootless mode, either do not run it as root or, even better,
run it in a throwaway chroot.

Indeed you want the chrootless mode because even with QEMU emulation you cannot
execute Hurd binaries on Linux. So instead, to create your Hurd chroot, you
want to run binaries from outside the chroot but let them operate on the
chroot. This is what dpkg --force-script-chrootless or chrootless mode is for.
It sets the $DPKG_ROOT environment variable so that maintainer scripts know
that they are not run on a real system or inside a chroot but instead the
chroot directory is located in a path pointed to by the $DPKG_ROOT environment
variable.

Support for this is already in all packages in the essential set, in apt,
systemd and build-essential in bookworm. One problem is, that so far, we only
added support to systemd-sys as a provider of "init" but on Hurd you don't have
systemd. I now have prepared patches for init-system-helpers, insserv and
sysvinit to make this work:

https://salsa.debian.org/helmutg/dpkg-root-demo/-/tree/sysvinit/patches

I submitted bug #1056176 to insserv for review already.

But even with those patches there is another blocker. The hurd package throws
the following error in its preinst maintainer script:

    ERROR: This version of the GNU Hurd requires kernel version
    1.8+git20210923 or later.
    Please upgrade your kernel and reboot before installing hurd.

So the hurd package must be patched so that this check is not done if
$DPKG_ROOT is a non-empty string. Can you take care of preparing that patch and
testing it?

The second problem is, that foreign architecture chrootless mode is currently
blocked on a dpkg bug which prevents installation of Architecture:all packages
that depend on Architecture:any packages. This is because dpkg implicitly
considers Architecture:all packages to be of the same architecture as itself
and that cannot yet be configured to be otherwise. One example for such a
dependency is the dependency of the initscripts package on "sysv-rc | file-rc |
openrc" which are all Architecture:any. The relevant dpkg bugs are #825385 and
#1020533.

Since usrmerge also does not work with chrootless mode, it would also be
tremendously helpful to have the usrmerge transition finished that Helmut is
currently working on. Until then, please use this when calling mmdebstrap to
prevent usrmerge to try operate on your system outside the chroot:

    --hook-dir=/usr/share/mmdebstrap/hooks/merged-usr

If you have any questions, please don't hesitate to contact me.

Thanks!

cheers, josch

Attachment: signature.asc
Description: signature


Reply to: