Your message dated Tue, 06 Sep 2022 13:49:34 +0000
with message-id <e1ovyxk-00emk4...@fasolo.debian.org>
and subject line Bug#1019035: fixed in systemd-cron 1.15.19-2
has caused the Debian Bug report #1019035,
regarding systemd-cron: prerm fails in unbooted systems
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 ow...@bugs.debian.org
immediately.)


-- 
1019035: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019035
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: systemd-cron
Version: 1.15.19-1
Severity: minor
Tags: patch

The package fails to remove when the system is not booted. I think this
is a bug; I think any package should be removable, regardless of the
boot status of the system.

#v+
Spawning container 220903 on /backup/220903.
Press ^] three times within 1s to kill container.
root@220903:~# apt remove systemd-cron
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  cron-daemon-common* systemd-cron*
0 upgraded, 0 newly installed, 2 to remove and 1 not upgraded.
After this operation, 211 kB disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 58695 files and directories currently installed.)
Removing systemd-cron (1.15.19-1) ...
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
dpkg: error processing package systemd-cron (--remove):
 installed systemd-cron package pre-removal script subprocess returned error 
exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 systemd-cron
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
#v-

Now as you can see in the above reproduction transcript that when I
experienced the error I was nspawn'ed into a copy of the live system.
This was to perform some "trial surgery" on the copy without fear of
breaking the real one. But please consider also the case of performing
maintenance in rescue or emergency mode. I think packages should remain
removable even in such instances.

The fix is simple: do not call deb-systemd-invoke without first checking
for /run/systemd/system. This allows the package to be removed as
expected. It is worth noting the automatically added debhelper section
has the same check.

#v+
--- prerm.orig  2022-07-16 20:42:24.000000000 +0100
+++ prerm       2022-09-03 10:06:10.254464031 +0100
@@ -1,7 +1,7 @@
 #!/bin/sh
 set -e
 
-if [ "$1" = "remove" ]; then
+if [ "$1" = "remove" ] && [ -d /run/systemd/system ]; then
     deb-systemd-invoke stop cron-update.path
 fi
 
#v-

Thus, the package may now be removed as expected.

#v+
root@220903:~# apt remove systemd-cron
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  cron-daemon-common* systemd-cron*
0 upgraded, 0 newly installed, 2 to remove and 1 not upgraded.
After this operation, 211 kB disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 58695 files and directories currently installed.)
Removing systemd-cron (1.15.19-1) ...
Removing cron-daemon-common (3.0pl1-149) ...
Processing triggers for man-db (2.10.2-2) ...
(Reading database ... 58652 files and directories currently installed.)
Purging configuration files for systemd-cron (1.15.19-1) ...
Purging configuration files for cron-daemon-common (3.0pl1-149) ...
#v-

Thank you in advance for your consideration. I hope you will agree this
is a bug and apply the (trivial) patch, not send me away with an
admonishment that this is user error. :)

-- 
https://rjy.org.uk/
--- prerm.orig  2022-07-16 20:42:24.000000000 +0100
+++ prerm       2022-09-03 10:06:10.254464031 +0100
@@ -1,7 +1,7 @@
 #!/bin/sh
 set -e
 
-if [ "$1" = "remove" ]; then
+if [ "$1" = "remove" ] && [ -d /run/systemd/system ]; then
     deb-systemd-invoke stop cron-update.path
 fi
 

--- End Message ---
--- Begin Message ---
Source: systemd-cron
Source-Version: 1.15.19-2
Done: Alexandre Detiste <alexandre.deti...@gmail.com>

We believe that the bug you reported is fixed in the latest version of
systemd-cron, 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 1019...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Alexandre Detiste <alexandre.deti...@gmail.com> (supplier of updated 
systemd-cron 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 ftpmas...@ftp-master.debian.org)


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

Format: 1.8
Date: Tue, 06 Sep 2022 15:36:20 +0200
Source: systemd-cron
Architecture: source
Version: 1.15.19-2
Distribution: unstable
Urgency: low
Maintainer: Debian Systemd Maintainers 
<pkg-systemd-maintain...@lists.alioth.debian.org>
Changed-By: Alexandre Detiste <alexandre.deti...@gmail.com>
Closes: 1019035
Changes:
 systemd-cron (1.15.19-2) unstable; urgency=low
 .
   * Enable removal in an unbooted filesystem (Closes: #1019035).
     Thanks RjY.
Checksums-Sha1:
 af5eb09383934b8f65f1d0bbe6a9ee632a7d8d20 2035 systemd-cron_1.15.19-2.dsc
 928eb732906c8a9062d10b74de8602e03d63422f 7244 
systemd-cron_1.15.19-2.debian.tar.xz
 d345a3626220446553a76e8086f5a96164b4c9b4 7149 
systemd-cron_1.15.19-2_source.buildinfo
Checksums-Sha256:
 d5030f33686fc97cf902f3819e41695f3b24a74f889f0bb19f3e8d679bbd8ddc 2035 
systemd-cron_1.15.19-2.dsc
 d512a0cc7584a84b119f89d2f9b75b9533ebf3f3a7fd974762e74526553f7a25 7244 
systemd-cron_1.15.19-2.debian.tar.xz
 78c8166387e742d2addbc81cbb5ca01e6132f4b3e8d0d8dd6936c165b3d8d3a3 7149 
systemd-cron_1.15.19-2_source.buildinfo
Files:
 20db4ce75a2f2c447b4811ccce0dba69 2035 admin optional systemd-cron_1.15.19-2.dsc
 49b14d872babe077edf7b9ff5a12cd3b 7244 admin optional 
systemd-cron_1.15.19-2.debian.tar.xz
 32b3eb4985c7575bc596a9e03ac0fb5f 7149 admin optional 
systemd-cron_1.15.19-2_source.buildinfo

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

iQIzBAEBCgAdFiEEj23hBDd/OxHnQXSHMfMURUShdBoFAmMXTQoACgkQMfMURUSh
dBrdpg/+I3LmkpXLR1ZX63Ud9N2S+fazBmIikOyk/FSiMJITHlJwRLpAFZ+tKVK/
lfFOtX6wXPAnKAWg5qPn2kLKjZtXxeX3OUPGlSRkI6L8vJRRGtcuUx2YUT3TYwvV
XZDppY/oEewjcMJ5k0LPhMWKjLbgdBn0C1zwBPZE9CZ7nNrGakYw6aXuIGZd0ArY
NTga7JM7qpDB8vA0ZM8FluVVAAwtTA2RLvsHMOFggYHZUe+Ia3DBu/c6Wz8osUQ3
Q6qkzURVoCx5bUaZJdLrxK850jBGJw4jqD3SlAn2pGi63AZm4oEKa4Aw42oWTSyY
5+zaGZF36Pm/6vbEuyOFbVmLZSutat40oJU079mcva8pwT2yZBrUORi5nwvYQKh5
LA8eVTY55CZZ0qS6+1yiiE5zX/Jiqr6pwKZikanCsB/xWXpstxBY1J5JwJVQev+a
JoPvR5htT6d58oa3zTZROCnziEi+qFOoFRDLzaf/cQRz9mMIvsOriqsBaTeBel31
oSaD3s47H32H2RqdtHWm2a55o8T3YUSYVhjVHviCeNm5o7DzyMy8aD/bUuWrjmAg
9gjkwM9vSlXZEOrXbGhbcjdK7eJD7oijX8o5CmNxLO6Auxrx8Xw6A4EOXwEGYTkW
CR/MGdSYcJzAWR+ushAXblZetfJQjwnN2ZOAO2UPn8DdN/D8BeE=
=9a71
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to