--tsk7wjjmdncrewbw
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Control: reassign -1 anacron 2.3-42
Control: tags -1 + patch
Control: forwarded -1
https://salsa.debian.org/debian/anacron/-/merge_requests/8
Can repro this on
a fresh trixie install
+ apt install anacron
+ apt install systemd-cron [this removes cron anacron]
$ systemctl list-timers | grep cron
Sun 2025-05-18 21:30:00 CEST 45min - - cron-anacron-root-0.timer cron-anacron-root-0.service
Mon 2025-05-19 00:15:00 CEST 3h 30min - - systemd-cron-cleaner.timer systemd-cron-cleaner.service
$ cat /run/systemd/generator/cron-anacron-root-0.sh
[ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi
when it's triggered (I did it manually)
$ systemctl status cron-anacron-root-0.service
Loaded: loaded (/etc/cron.d/anacron; generated)
Active: failed (Result: exit-code) since Sun 2025-05-18 20:46:21 CEST; 25s ago
Invocation: a5fb0a030354471cba6e865266d87858
TriggeredBy: ● cron-anacron-root-0.timer
Docs: man:systemd-crontab-generator(8)
Process: 1220 ExecStart=/bin/sh /run/systemd/generator/cron-anacron-root-0.sh (code=exited, status=1/FAILURE)
Main PID: 1220 (code=exited, status=1/FAILURE)
Mem peak: 1.7M
CPU: 20ms
May 18 20:46:21 trixie systemd[1]: Starting cron-anacron-root-0.service - [Cron] "30 7-23 * * * root [ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi"...
May 18 20:46:21 trixie systemd[1]: cron-anacron-root-0.service: Main process exited, code=exited, status=1/FAILURE
May 18 20:46:21 trixie systemd[1]: cron-anacron-root-0.service: Failed with result 'exit-code'.
May 18 20:46:21 trixie systemd[1]: Failed to start cron-anacron-root-0.service - [Cron] "30 7-23 * * * root [ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi".
I put it to you that this is actually an anacron bug in the cronjob,
since this would happen with /any/ cron implementation when anacron=rc,
and the cronjob needs to check for if anacron actually exists
(or ignore the error stronger, or change the logic some other way?).
...or apparently /etc/init.d/anacron (and /cron)
becomes 644 instead of 755 on removal?
So it wants to put the [ -x condition into the if, which will mean that
the program won't fail if the [ -x condition fails.
I've validated this to hold.
--tsk7wjjmdncrewbw
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
From 41ea7552528138a7ae93dac2ec345e16a6f42bef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= <
nabijaczleweli@nabijaczleweli.xyz>
Date: Sun, 18 May 2025 21:31:06 +0200
Subject: [PATCH] d/cron.d: move [ -x test into if so it doesn't fail the job
if it fails (Closes: #1106000)
X-Mutt-PGP: OS
Also add an exec (NFC except skipping a fork) and move a \! outside [ ] (NFC) ---
debian/changelog | 5 ++++-
debian/cron.d | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 6d7b3c0..e88f1bc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,7 +9,10 @@ anacron (2.3-43) UNRELEASED; urgency=medium
updates to single-debian-patch
* d/control: Update standards version to 4.7.2
- -- Lance Lin <
lq27267@gmail.com> Wed, 23 Apr 2025 20:47:24 +0700
+ [ наб ]
+ * d/cron.d: move [ -x test into if so it doesn't fail the job if it fails (Closes: #1106000)
+
+ -- наб <
nabijaczleweli@nabijaczleweli.xyz> Sun, 18 May 2025 21:31:24 +0200
anacron (2.3-42) unstable; urgency=medium
diff --git a/debian/cron.d b/debian/cron.d
index ce75db8..57b33c5 100644
--- a/debian/cron.d
+++ b/debian/cron.d
@@ -3,4 +3,4 @@
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-30 7-23 * * * root [ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /u