Bug#1056176: insserv: please support DPKG_ROOT
Johannes Schauer Marin Rodrigues
josch at debian.org
Sat Nov 18 09:20:02 GMT 2023
Source: insserv
Severity: normal
Tags: patch
User: debian-dpkg at lists.debian.org
Usertags: dpkg-root-support
X-Debbugs-Cc: werdahias at riseup.net
Hi,
when creating chroots for architectures that are in the process of being
bootstrapped without yet having emulation support, it is not possible to run
maintainer scripts inside the foreign architecture chroot as the tools they
call cannot be executed. The solution to that problem is to run maintainer
scripts from the chroot directory without doing a chroot call first and instead
use the $DPKG_ROOT environment variable to communicate the location of the
chroot directory that the tools called by the maintainer script should operate
on. By default, for normal installations, that environment variable is set, but
empty. For more information see:
https://wiki.debian.org/Teams/Dpkg/Spec/InstallBootstrap
Support for this mode was already added to all packages in the essential set,
apt, systemd-sysv as well as build-essential. I'm now trying to add
support to the packages required to set up a system using sysv-init.
Having support DPKG_ROOT support for another init system than systemd is
useful to create chroots for architectures or kernels (like GNU Hurd)
that do not have systemd support.
Attached patch changes the insserv postinst so that if the $DPKG_ROOT
environment variable is not empty, the insserv tool is called with a bunch of
options which let it operate on the files inside the directory stored in
$DPKG_ROOT instead of /. Please review the patch to make sure that the insserv
command line arguments that the patch passes indeed make sense in this
scenario.
We tested it in our CI environment and it produces a bit-by-bit
identical chroot with DPKG_ROOT compared to a normal installation.
https://salsa.debian.org/helmutg/dpkg-root-demo/
Since the DPKG_ROOT variable is empty on normal installations, the patch
should have no effect in the normal case.
Thanks!
cheers, josch
diff -Nru insserv-1.24.0/debian/postinst insserv-1.24.0/debian/postinst
--- insserv-1.24.0/debian/postinst 2022-02-22 11:31:29.000000000 +0100
+++ insserv-1.24.0/debian/postinst 2023-11-17 01:55:47.000000000 +0100
@@ -7,5 +7,16 @@
# fix up the rc?.d priorities from the dumb update-rc.d fallback (which uses
# priority 01 for everything).
if [ "$1" = "configure" ] && [ -z "$2" ]; then
- insserv || true
+ if [ -z "$DPKG_ROOT" ] ; then
+ # normal operation
+ insserv || true
+ else
+ # in chrootless installation, provide the path to the chroot
+ insserv \
+ --path "$DPKG_ROOT/etc/init.d" \
+ --override "$DPKG_ROOT/etc/insserv/overrides/" \
+ --insserv-dir "$DPKG_ROOT/etc/init.d/" \
+ --config "$DPKG_ROOT/etc/insserv.conf" \
+ || true
+ fi
fi
More information about the Debian-init-diversity
mailing list