Hi,

Quoting Ian Jackson (2026-04-14 12:30:11)
> Johannes Schauer Marin Rodrigues writes ("Bug#1132024: Add insserv-bin binary 
> package with /usr/libexec/insserv for easily creating Hurd chroots"):
> > I suppose to try this out I would have to install some packages
> > which ship sysv scripts? Do you have a suggestion for a small/simple
> > package which would be a good candidate?
> 
> Hi.  (I've just been lurking in this thread.)

thank you for chiming in. :)

> I think my package "userv" may be a good candidate.  It has both an init
> script and a systemd unit.  It has some autopkgtests if those are helpful.

I changed my patch to this:

--- a/script/update-rc.d
+++ b/script/update-rc.d
@@ -192,6 +192,10 @@ sub create_sequence {
     $insserv = "/sbin/insserv" if ( -x "$dpkg_root/sbin/insserv");
     # If insserv is not configured it is not fully installed
     my $insserv_installed = -x "$dpkg_root$insserv" && -e 
"$dpkg_root/etc/insserv.conf";
+    # Ignore the presence of insserv if this system is using systemd as init
+    if ($insserv_installed && readlink "$dpkg_root/usr/sbin/init" eq 
"../lib/systemd/systemd") {
+        $insserv_installed = 0;
+    }
     my @opts;
     push(@opts, '-f') if $force;
     # Add force flag if initscripts is not installed

I don't think it would be correct to check /run/systemd/system as I proposed
earlier because that would allow us to find out whether systemd is the init
system currently running but we want to find out which init system the system
is going to use. The distinction is important because we want equal behaviour
when working inside a chroot (no systemd running) and also with $DPKG_ROOT
(without a chroot). Maybe there is a better check. I'm open for ideas.

I've changed src:insserv to create the binary package insserv-cheat which is
identical to insserv except the name. This is so that I can install insserv and
systemd-sysv at the same time despite the Conflict. I put my patched
src:insserv and src:init-system-helps in a local repo and then ran:

SOURCE_DATE_EPOCH=1776164211 mmdebstrap --include=systemd-sysv,insserv-cheat \
    --chrooted-customize-hook='apt install --yes console-setup-linux userv' \
    unstable chroot.tar http://deb.debian.org/debian \
    "deb [trusted=yes] http://127.0.0.1:8080 ./"

Without above patch, installing console-setup-linux produces the message:

insserv: FATAL: service mountkernfs has to be enabled to use service 
keyboard-setup.sh

Though for some reason the exit code is not propagated out of the maintainer
script so the "apt install" will still succeed despite this message. The
resulting chroot will have /etc/init.d/.depend.boot, /etc/init.d/.depend.start
and /etc/init.d/.depend.stop populated with the various targets including
userv, keyboard-setup.sh and console-setup.sh.

With above patch, the error message from console-setup-linux is gone and
/etc/init.d/.depend.boot, /etc/init.d/.depend.start and
/etc/init.d/.depend.stop will remain empty.

What else do I have to check? It is a bit unfortunate that console-setup-linux
from bug #1072562 does not result in a non-zero exit. That makes automatically
testing this a bit more tricky.

Thanks!

cheers, josch

Attachment: signature.asc
Description: signature

Reply via email to