Bug#983421: init-system-helpers: please respect DPKG_ROOT when checking for /usr/sbin/policy-rc.d

Johannes Schauer Marin Rodrigues josch at debian.org
Mon Jun 21 09:46:05 BST 2021


Quoting Johannes 'josch' Schauer (2021-02-24 00:14:16)
> if dpkg (since 1.18.5) is run with --force-script-chrootless, it sets
> the variable DPKG_ROOT to the directory into which dpkg will install the
> requested packages. This is useful for bootstrapping, creating chroots
> for foreign architectures where utilities from inside the chroot cannot
> be executed, avoiding dependency loops between postinst scripts,
> installation without requiring superuser privileges and for creating
> installations that do not even contain dpkg. See
> https://wiki.debian.org/Teams/Dpkg/Spec/InstallBootstrap for more
> information.
> 
> Currently, when maintainer scripts are run, /usr/sbin/policy-rc.d is
> checked to avoid starting services. But instead, the scripts should
> check "$DPKG_ROOT/usr/sbin/policy-rc.d". In normal situations, the
> $DPKG_ROOT variable is empty, so this will work as usual. But if dpkg is
> run with --root and --force-script-chrootless then /usr/sbin/policy-rc.d
> from the new root directory will be used.
> 
> Please consider applying the following patch:

Helmut Grohne and me now maintain a script that applies the $DPKG_ROOT patches
that we wrote against various source packages and verifies that a chroot
created with --force-script-chrootless is bit-by-bit identical to a chroot
created the normal way.

We discovered that deb-systemd-helper also requires support for the $DPKG_ROOT
environment variable, so that it operates on the path given by $DPKG_ROOT
instead of /. You can find the patch to init-system-helpers that makes all of
this work here:

https://salsa.debian.org/helmutg/dpkg-root-demo/-/blob/master/patches/init-system-helpers

The patch includes the function assertdpkgroot() and assertnotdpkgroot() to
catch problems early on. If you prefer, I can remove these functions.

Thanks!

cheers, josch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20210621/ce53b1a9/attachment.sig>


More information about the Pkg-systemd-maintainers mailing list