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
Fri Sep 24 20:11:26 BST 2021


Hi Michael,

Quoting Michael Biebl (2021-09-24 20:04:15)
> Am 24.09.2021 um 08:15 schrieb Johannes Schauer Marin Rodrigues:
> > Hi Martin, Felipe & Michael,
> > 
> > Quoting Johannes Schauer Marin Rodrigues (2021-08-20 21:33:00)
> >> 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.
> >>
> >> for your convenience, I have created a merge request on salsa which implements
> >> the changes that make DPKG_ROOT work in our testing environment.
> >>
> >> https://salsa.debian.org/debian/init-system-helpers/-/merge_requests/12
> > 
> > would you mind me applying the above merge request and doing an NMU of
> > init-system-helpers?
> Didn't have time yet to look at this. Sorry.  From a cursory glance it feels
> inelegant having to sprinkle env vars across everything.

indeed, our patch to init-system-helpers is the largest of all the changes.
The advantage of changing init-system-helpers is, that then we don't have to
touch many other maintainer scripts instead. On the up side, the $DPKG_ROOT
variable is empty during normal operation, so prepending $DPKG_ROOT in front of
all paths is unlikely to break anything without --force-script-chrootless
active.

Do you have ideas how the diff could be improved? I added the assertdpkgroot
and assertnotdpkgroot functions to make sure that I'm not accidentally working
on paths that have already been modified or should not be modified.

> This also feels like it could get easily broken when changes are made. So I'm
> not too enthusiastic tbh.

in case things break in the future, our CI job would catch that breakage and
then I'd send you another patch. I see this like other efforts like cross
building or reproducible builds. It's not your task to make sure it's not
breaking but we run a CI system and send you patches once we observe a
regression.

Needless to say, if something unrelated breaks because of this change, I'm also
here to work on fixing that.

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/20210924/5d66e31e/attachment-0001.sig>


More information about the Pkg-systemd-maintainers mailing list