chrootless initscripts
Johannes Schauer Marin Rodrigues
josch at debian.org
Fri Nov 17 18:44:11 GMT 2023
Hi,
I'm trying to write patches against init-system-helpers, insserv and sysvinit
to make them work in chrootless-mode. What is chrootless-mode? It's a means of
creating a chroot without ever running the chroot() call. Why is that
important? Because in certain situations, the binaries from the chroot cannot
get executed on the current host. This is for example the case in very early
architecture bootstraps where there is no or only very, very slow emulation
support for the architecture of the chroot. In that mode, maintainer scripts
are run from outside the chroot and get communicated the directory the tools
are supposed to work on using the DPKG_ROOT variable that is set by dpkg since
version 1.18.5. 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. Why is this useful?
That way it might for example be possible to create a Hurd chroot on Linux
because instead of executing the hurd binaries from the chroot, the Linux tools
from the outside are used. And Hurd does not support systemd, so I was looking
into making sysvinit ready for it.
My current patch against init-system-helpers looks like this:
https://salsa.debian.org/helmutg/dpkg-root-demo/-/blob/sysvinit/patches/init-system-helpers
The patch makes sure that if DPKG_ROOT is the non-empty string, insserv is run
with some custom options which (as is my hope) instruct it to use the files
inside the chroot instead of the files outside of it.
Unfortunately, this does not completely work yet. When creating a chroot with
init-system-helpers patched like that I get the following output multiple times
when running the postinst of initscripts:
insserv: warning: could not find all dependencies for $local_fs
insserv: warning: could not find all dependencies for $remote_fs
insserv: warning: could not find all dependencies for $local_fs
insserv: warning: could not find all dependencies for $remote_fs
insserv: warning: could not find all dependencies for $local_fs
insserv: warning: could not find all dependencies for $local_fs
insserv: warning: could not find all dependencies for $local_fs
insserv: warning: could not find all dependencies for $local_fs
insserv: warning: could not find all dependencies for $time
insserv: warning: could not find all dependencies for $local_fs
insserv: warning: could not find all dependencies for $local_fs
insserv: warning: could not find all dependencies for $local_fs
As a result, the files /etc/init.d/.depend.boot and /etc/init.d/.depend.stop
differ from the ones that would be created in a chroot created the normal way
like this:
├── ./etc/init.d/.depend.stop
│ @@ -1,6 +1,6 @@
│ -TARGETS = sendsigs hwclock.sh udev urandom brightness umountnfs.sh umountfs umountroot halt reboot
│ +TARGETS = sendsigs hwclock.sh urandom brightness udev umountnfs.sh umountfs umountroot halt reboot
│ umountnfs.sh: sendsigs
│ -umountfs: umountnfs.sh hwclock.sh urandom brightness
│ +umountfs: umountnfs.sh hwclock.sh
│ umountroot: umountfs udev
│ halt: umountroot
│ reboot: umountroot
The full log of package installation and diffoscope can be found here:
https://salsa.debian.org/helmutg/dpkg-root-demo/-/jobs/4933916
Does anybody have an idea if there is a way to make insserv find the
dependencies for $local_fs, $remote_fs and $time and as a result, generate
correct .depend.boot and .depend.stop files?
Since I have little to no knowledge of sysvinit my hope is to combine your
knowledge in that area with mine so that I can create a working set of patches.
Thank you!
cheers, josch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: signature
URL: <http://www.chiark.greenend.org.uk/pipermail/debian-init-diversity/attachments/20231117/e1a1b629/attachment.sig>
More information about the Debian-init-diversity
mailing list