Hi, I sat down with Jochen in Hamburg to try and fix this.
On Sun, May 14, 2023 at 03:21:24PM -0400, Theodore Ts'o wrote: > Can someone send the instructions on how to fix this? We wish we could give you. Instead, we document our findings, so maybe the next one looking into this bug has a better idea, but for now we give up as it is too late for bookworm anyway. As Michael pointed out, i-s-h does not support removing a WantedBy from a unit. Arguably, this is a bug in i-s-h, but we wouldn't be changing i-s-h at this time of the freeze. In the upgrade scenario, debhelper inserts code that becomes d-s-h unmask; d-s-h was-enabled; d-s-h enable. None of that code is able to clean up the old link (in default.target). When working in a chroot, it is sufficient to do: d-s-h unmkas if d-s-h was-enabled d-s-h disable # added d-s-h update-state # added d-s-h enable else d-s-h update-state The disable would remove the old link from /etc. The update-state would clean it from /var and then things would just work. However, when running this in a VM with systemd running, the unit would then end up as disabled, which is not what we want. Comparing the debug output from d-s-h, we could not figure out why it ends up disabling the unit. So all we can do now, is document this and attach the dysfunctional patch (please don't apply). Helmut and Jochen
diff -Nru e2fsprogs-1.47.0/debian/changelog e2fsprogs-1.47.0/debian/changelog --- e2fsprogs-1.47.0/debian/changelog 2023-03-05 04:16:08.000000000 +0100 +++ e2fsprogs-1.47.0/debian/changelog 2023-05-27 16:11:40.000000000 +0200 @@ -1,3 +1,10 @@ +e2fsprogs (1.47.0-2.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * This fix does not work. Do not apply it. + + -- Helmut Grohne <hel...@subdivi.de> Sat, 27 May 2023 16:11:40 +0200 + e2fsprogs (1.47.0-2) unstable; urgency=medium * Don't enable metadata_csum_seed and orhpan_file by default (Closes: diff -Nru e2fsprogs-1.47.0/debian/e2fsprogs.postinst e2fsprogs-1.47.0/debian/e2fsprogs.postinst --- e2fsprogs-1.47.0/debian/e2fsprogs.postinst 2023-03-05 04:16:08.000000000 +0100 +++ e2fsprogs-1.47.0/debian/e2fsprogs.postinst 2023-05-27 16:09:56.000000000 +0200 @@ -10,4 +10,25 @@ #DEBHELPER# +# Manually added instead of the stuff that dh_installsystemd would have added +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + # This will only remove masks created by d-s-h on package removal. + deb-systemd-helper unmask 'e2scrub_reap.service' >/dev/null || true + + # was-enabled defaults to true, so new installations run enable. + if deb-systemd-helper --quiet was-enabled 'e2scrub_reap.service'; then + # Since we remove a WantedBy, we disable and update-state first + deb-systemd-helper disable e2scrub_reap.service >/dev/null || true + deb-systemd-helper update-state e2scrub_reap.service >/dev/null || true + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable 'e2scrub_reap.service' >/dev/null || true + else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state 'e2scrub_reap.service' >/dev/null || true + fi +fi +# End of what should have worked automatically + exit 0 diff -Nru e2fsprogs-1.47.0/debian/e2fsprogs.postrm e2fsprogs-1.47.0/debian/e2fsprogs.postrm --- e2fsprogs-1.47.0/debian/e2fsprogs.postrm 1970-01-01 01:00:00.000000000 +0100 +++ e2fsprogs-1.47.0/debian/e2fsprogs.postrm 2023-05-27 16:11:23.000000000 +0200 @@ -0,0 +1,23 @@ +#!/bin/sh + +# Abort on error. +set -e + +#DEBHELPER# + +# Manually added instead of the stuff that dh_installsystemd would have added +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask e2scrub_reap.service >/dev/null || true + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge e2scrub_reap.service >/dev/null || true + deb-systemd-helper unmask e2scrub_reap.service >/dev/null || true + fi +fi +# End of what should have worked automatically + +exit 0 diff -Nru e2fsprogs-1.47.0/debian/e2fsprogs.prerm e2fsprogs-1.47.0/debian/e2fsprogs.prerm --- e2fsprogs-1.47.0/debian/e2fsprogs.prerm 1970-01-01 01:00:00.000000000 +0100 +++ e2fsprogs-1.47.0/debian/e2fsprogs.prerm 2023-05-27 16:11:07.000000000 +0200 @@ -0,0 +1,14 @@ +#!/bin/sh + +# Abort on error. +set -e + +#DEBHELPER# + +# Manually added instead of the stuff that dh_installsystemd would have added +if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -d /run/systemd/system ] ; then + deb-systemd-invoke stop e2scrub_reap.service >/dev/null || true +fi +# End of what should have worked automatically + +exit 0 diff -Nru e2fsprogs-1.47.0/debian/rules e2fsprogs-1.47.0/debian/rules --- e2fsprogs-1.47.0/debian/rules 2023-03-05 04:16:08.000000000 +0100 +++ e2fsprogs-1.47.0/debian/rules 2023-05-27 16:11:40.000000000 +0200 @@ -172,6 +172,12 @@ endif dh_shlibdeps --remaining-packages -l${stdbuilddir}/lib +override_dh_installsystemd: + # Work around deb-systemd-helper not removing e2scrub_reap.service from + # default.target. + dh_installsystemd -pe2fsprogs e2scrub_all.timer e2scrub_all.service + dh_installsystemd -Ne2fsprogs + override_dh_gencontrol: dh_gencontrol -pcomerr-dev -- -v${COMERR_VERSION}-${DEB_VERSION} -VmainBinary=${DEB_VERSION} dh_gencontrol -pss-dev -- -v${SS_VERSION}-${DEB_VERSION} -VmainBinary=${DEB_VERSION}