Your message dated Wed, 04 Nov 2026 15:05:28 +0000
with message-id <[email protected]>
and subject line Bug#1121344: fixed in mmdebstrap 1.7.0-1
has caused the Debian Bug report #1121344,
regarding mmdebstrap: start-stop-daemon replacement does not work / resulting 
images may fail dpkg --verify
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1121344: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1121344
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: mmdebstrap
Version: 1.5.7-3
Severity: normal
Tags: upstream fixed-upstream
X-Debbugs-Cc: [email protected]

Hi Josch,

During use of Debusine, I was faced with a very strange piuparts error.  
The relevant workrequest sadly is private, but the gist is that debsums 
was complaining about a checksum error for start-stop-daemon. After a 
while, I investigated the base image passed to piuparts and ran dpkg 
--verify there. It was also unhappy about start-stop-daemon. This image 
was created using mmdebstrap and this is where we get into the problem I 
am trying to report.

The distribution at hand was Ubuntu xenial. It is a bit special in that 
it presently has a dpkg security update. What happened here is roughly 
this:
 * All essential packages are extracted (without the security update).
 * mmdebstrap replaces start-stop-daemon.
 * Remaining packages are installed and this includes the dpkg security 
   update.
 * mmdebstrap moves back the replaced start-stop-daemon.

A relatively simple way to reproduce this is simulating a dist-upgrade.

mmdebstrap --variant=apt bookworm /tmp/upgraded.tar 
--chrooted-customize-hook='sed -i -e s/bookworm/trixie/ /etc/apt/sources.list 
&& apt-get update && apt-get dist-upgrade'

The problem happens after the customization stage, so we actually need 
to emit some image and run dpkg --verify inside to see the problem.

Beyond this, I don't think the replacement of start-stop-daemon ever 
worked as intended, because start-stop-daemon is being replaced before 
the essential packages unpacked, so dpkg overwrites it.

| mmdebstrap --variant=essential sid /dev/null --chrooted-customize-hook='ls 
-la /sbin/start-stop-daemon*'
...
| I: running --chrooted-customize-hook in shell: sh -c 'ls -la 
/sbin/start-stop-daemon*'
| -rwxr-xr-x 1 root root 44464 Jun 30 23:32 /sbin/start-stop-daemon
| -rwxr-xr-x 1 root root 44464 Jun 30 23:32 /sbin/start-stop-daemon.REAL

As far as I can see, the proper solution here is using dpkg-divert and 
creating local diversions, no?

Of course this code is cargo culted from debootstrap and likely exists 
to maximize compatibility with it. deboostrap cannot easily use 
diversions, so there is that.

Replacing start-stop-daemon is also something we haven't needed in a 
long time. Since moving to systemd, we aren't using start-stop-daemon 
much at all and even before, sysvinit was already using invoke-rc.d and 
policy-rc.d for a long time. Is this code actually needed still?

My impression is that you would like to retain compatibility with very 
old releases where this is still needed and diversions should work 
there.

We've discussed this on IRC now and you've already applied the attached
patch to your develop upstream branch despite it failing the salsa-ci
pipeline for bsdutils having become non-essential. Thank you. I'm
attaching a copy for reference.

Helmut
>From de180f97e354fdda3ead4657eb82d8ce611da485 Mon Sep 17 00:00:00 2001
From: Helmut Grohne <[email protected]>
Date: Sat, 22 Nov 2025 08:09:37 +0100
Subject: [PATCH] Divert start-stop-daemon

If we just replace it with something else, a later unpack operation of
dpkg may overwrite our replacement. Our cleanup may then destroy
intended changes.
---
 mmdebstrap | 59 +++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 45 insertions(+), 14 deletions(-)

diff --git a/mmdebstrap b/mmdebstrap
index 075582e..8fe5874 100755
--- a/mmdebstrap
+++ b/mmdebstrap
@@ -2601,34 +2601,64 @@ sub setup_mounts {
         # the file might not exist if it was removed in a hook
         if (any { $_ eq 'chroot/start-stop-daemon' } @{ $options->{skip} }) {
             info "skipping chroot/start-stop-daemon as requested";
+        } elsif ($options->{dryrun}) {
+            info "skipping start-stop-daemon because of --dryrun";
         } else {
             # $options->{root} must not be part of $ssdloc but must instead be
             # evaluated at the time the cleanup is run or otherwise, when
             # performing a pivot-root, the ssd location will still be prefixed
             # with the chroot path even though we changed root
+            #
+            # On merged-/usr, it can exist in both places. We still want the
+            # location according to the dpkg-database. At this time, neither
+            # usrmerge.postinst nor the merged-usr hook's post-merging
+            # extract hook have been run, so /sbin can only be a link if it is
+            # a file in base-files at that point, ssd must be below /usr.
             my $ssdloc;
-            if (-f "$options->{root}/sbin/start-stop-daemon") {
+            if (-f "$options->{root}/sbin/start-stop-daemon"
+                && !-l "$options->{root}/sbin") {
                 $ssdloc = "/sbin/start-stop-daemon";
             } elsif (-f "$options->{root}/usr/sbin/start-stop-daemon") {
                 $ssdloc = "/usr/sbin/start-stop-daemon";
             }
+            my @ssd_diversions = ([
+                    "/usr/sbin/start-stop-daemon",
+                    "/usr/sbin/start-stop-daemon.REAL"
+                ],
+                [
+                    "/sbin/start-stop-daemon",
+                    "/sbin/start-stop-daemon.REAL.usr-is-merged",
+                ],
+            );
+            if ($ssdloc eq "/sbin/start-stop-daemon") {
+                @ssd_diversions = reverse @ssd_diversions;
+            }
+            for my $pair (@ssd_diversions) {
+                my ($diverted, $divertto) = @$pair;
+                0 == system(
+                    "dpkg-divert", "--root",   $options->{root},
+                    "--local",     "--rename", "--divert",
+                    $divertto,     "--add",    $diverted
+                ) or die "failed to divert $diverted: $?";
+            }
+            # Remove diversions in reverse order;
+            @ssd_diversions = reverse @ssd_diversions;
+
             push @cleanup_tasks, sub {
-                return unless length $ssdloc;
-                if (-e "$options->{root}/$ssdloc.REAL") {
-                    move(
-                        "$options->{root}/$ssdloc.REAL",
-                        "$options->{root}/$ssdloc"
-                    ) or error "cannot move start-stop-daemon: $!";
+                if (length $ssdloc and -e "$options->{root}/$ssdloc") {
+                    unlink "$options->{root}/$ssdloc"
+                      or error "cannot remove start-stop-daemon: $!";
+                }
+                for my $pair (@ssd_diversions) {
+                    my ($diverted, $divertto) = @$pair;
+                    0 == system(
+                        "dpkg-divert", "--root",   $options->{root},
+                        "--local",     "--rename", "--divert",
+                        $divertto,     "--remove", $diverted
+                    ) or die "failed to divert $diverted: $?";
                 }
             };
             if (length $ssdloc) {
-                if (-e "$options->{root}/$ssdloc.REAL") {
-                    error "$options->{root}/$ssdloc.REAL already exists";
-                }
-                move(
-                    "$options->{root}/$ssdloc",
-                    "$options->{root}/$ssdloc.REAL"
-                ) or error "cannot move start-stop-daemon: $!";
                 open my $fh, '>', "$options->{root}/$ssdloc"
                   or error "cannot open start-stop-daemon: $!";
                 print $fh "#!/bin/sh\n";
-- 
2.50.1


--- End Message ---
--- Begin Message ---
Source: mmdebstrap
Source-Version: 1.7.0-1
Done: Johannes Schauer Marin Rodrigues <[email protected]>

We believe that the bug you reported is fixed in the latest version of
mmdebstrap, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Johannes Schauer Marin Rodrigues <[email protected]> (supplier of updated 
mmdebstrap package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Wed, 04 Nov 2026 15:51:39 +0100
Source: mmdebstrap
Architecture: source
Version: 1.7.0-1
Distribution: unstable
Urgency: medium
Maintainer: Johannes Schauer Marin Rodrigues <[email protected]>
Changed-By: Johannes Schauer Marin Rodrigues <[email protected]>
Closes: 1036151 1082899 1091442 1106755 1121344 1124822 1129567 1131026 1132514 
1135727 1139592 1140780
Changes:
 mmdebstrap (1.7.0-1) unstable; urgency=medium
 .
   * New upstream version 1.7.0
   * debian/tests/control:
      - document autopkgtest triggers on systemd, procps, manpages and passwd
      - add autopkgtest trigger on libarchive-tools and tar
      - add dependency on erofs-utils and libarchive-tools for erofs and cpio
        output formats
      - remove isc-dhcp-client which got removed from Debian, see #1143544
   * Cleanup dpkg and debconf *-old backup files (Closes: #1082899)
   * place DPkg::Pre-Install-Pkgs workaround into a new config file (Closes:
     #1091442)
   * Better honor TMPDIR without relying on Perl's File::Spec->tmpdir fallback
     to /tmp
     Thanks to Leo (Meng Hsi) Li (Closes: #1135727)
   * Fix Acquire::Languages example (Closes: #1131026)
   * Also mention the abbreviation --hook-dir (Closes: #1140780)
   * mmdebstrap-autopkgtest-build-qemu: add sshkey to user
     Thanks to Jochen Sprickerhof (Closes: #1106755)
   * Create pax tar archives with --sparse (Closes: #1129567)
   * Also cleanup /etc/hostid (Closes: #1036151)
   * Check if keyring can be read from inside the unshared user namespace
     (Closes: #1139592)
   * Fix handling of files in --dpkgopt and --aptopt if no trailing newline
     Thanks to Josh Triplett (Closes: #1132514)
   * Divert start-stop-daemon
     Thanks to Helmut Grohne (Closes: #1121344)
   * Support subid delegation via nsswitch
     Thanks to Simone Caronni (Closes: #1124822)
   * Fix(cleanup/reproducible/machine-id): preserve permissions of machine-id
     Thanks to Elkhan Mammadli
   * Accept SHA512 from apt in eatmydata hook
     Thanks to May Durst
   * Explain bad or missing TMPDIR
     Thanks to Tj
   * Prefer keyrings with .pgp extension over .gpg
     Thanks to Guillem Jover
   * debian/patches: drop all patches (applied upstream)
   * tests/skip-tar-in-mknod: cherry-pick upstream fix
   * README.md: strongly worded exclusion of contributions not created by humans
Checksums-Sha1:
 12663bd68e28758b6a55abe82da1dbe68492add8 2648 mmdebstrap_1.7.0-1.dsc
 80d08f908933545208fcddf27df2b739d45f1b27 183982 mmdebstrap_1.7.0.orig.tar.gz
 3c84e315deffe7e83799ed08a2b4707ea8a3bd29 21096 mmdebstrap_1.7.0-1.debian.tar.xz
Checksums-Sha256:
 7229edcc2e60d4ade71dc636a925032938cf5daa56d39183b916263bd04d773f 2648 
mmdebstrap_1.7.0-1.dsc
 af4d10d87f71d5b94ad5272a002231150c7817e21fa3deda9f67775f43005327 183982 
mmdebstrap_1.7.0.orig.tar.gz
 0d537d1efbf2db027d1ca24349ca91d53959ec948907644b3995065030d9b8e8 21096 
mmdebstrap_1.7.0-1.debian.tar.xz
Files:
 e71f55140f31d656231ab79cb44f0f08 2648 admin optional mmdebstrap_1.7.0-1.dsc
 a868a4fb345da21e0be1790336fcde6f 183982 admin optional 
mmdebstrap_1.7.0.orig.tar.gz
 89d8b70df548ec26d36694419ef52177 21096 admin optional 
mmdebstrap_1.7.0-1.debian.tar.xz

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEElFhU6KL81LF4wVq58sulx4+9g+EFAmrrRqIACgkQ8sulx4+9
g+HRPw/+NMh+AHeWsQ16SLcQnReoMGksE6msYwvmDve5xoEAkmz2e7tfSwvdzmnF
0GFiOu2yT9qJjUlHHsQ1bRQNNazUDsjHTQd/bqw2c1RfPNYH+RhzjV4QOWTK8CAY
k+VAsvexlwPp4nWfTHjH2zdERAyrSoumu6gdNl5cvekDhdSsSBN32ZhleUjN7wrW
iGx53aliCzUFdn9G8XmUWev6JVaeJ2BeHiUhnXqR+Eylt58HprXsBI9u36nSuNrg
Si+QHRVo0mSo1rr2D2moRiRhmvOF3fdbn/o9h144SMPUsKmOJAltt1RgJKLdLxNE
Ptagacbe3NhJyLY2H4WRfx5Z/k3jjs1YE/Ifq1Ekoaakmj13dhilaYo04+5axKk5
g00b3nckHM/zSciwxQu9Lv41MyCdQjPiYeOLZDWTAyl2LKjwQSCTzlh+0xnH6lkV
dwHirUky5hFfUAdRQsiMtpd7geMu6mgkgGZtXIHXSvA90amGT96p3IPGufBlCMc0
dhLRTf8uNTZ//obhEExNAaHJMCD1HZ8f1o38mPSmZsy7KvLTkKsSy05hAM692j8c
bGLrmXAtMjonPSj39NJVor6PVVBmGf3TsSKubCc0vrE3hNWtIOt3Mz2MDPjVG+PF
+jNnW2FNBdWv/7qMFpf910rbR+NNKuO/xwrRTpMQtopf5UpE5Uk=
=2gNa
-----END PGP SIGNATURE-----

Attachment: pgpWAKJzvvWcg.pgp
Description: PGP signature


--- End Message ---

Reply via email to