#1040304 systemd-cron: apt-cacher-ng daily job fail with new no-run-parts mode

Package:
systemd-cron
Source:
systemd-cron
Description:
systemd units to provide cron daemon & anacron functionality
Submitter:
Alexandre Detiste
Date:
2024-09-14 15:36:02 UTC
Severity:
normal
#1040304#5
Date:
2023-07-04 09:34:03 UTC
From:
To:
Since the new version of systemd-cron that does not rely on run-parts
to run the hourly/daily/weekly job as as whole; the ACNG job
will fail most times.

Something with the environment must be a tiny different.

Greetings,


× cron-daily-apt-cacher-ng.service - [Cron] "/etc/cron.daily/apt-cacher-ng"
     Loaded: loaded (/etc/cron.daily/apt-cacher-ng; generated)
     Active: failed (Result: exit-code) since Tue 2023-07-04 10:50:57 CEST; 159ms ago
TriggeredBy: ● cron-daily-apt-cacher-ng.timer
       Docs: man:systemd-crontab-generator(8)
    Process: 16465 ExecStart=/etc/cron.daily/apt-cacher-ng (code=exited, status=1/FAILURE)
   Main PID: 16465 (code=exited, status=1/FAILURE)
        CPU: 94ms

jui 04 10:50:11 antec systemd[1]: Starting cron-daily-apt-cacher-ng.service - [Cron] "/etc/cron.daily/apt-cacher-ng"...
jui 04 10:50:57 antec apt-cacher-ng[16505]: Could not make a valid request to the server.
    Please visit http://UNIX-DOMAIN-SOCKET/acng-report.html?doExpire=Start+Expiration&abortOnErrors=aOe and check special conditions.
jui 04 10:50:57 antec systemd[1]: cron-daily-apt-cacher-ng.service: Main process exited, code=exited, status=1/FAILURE
jui 04 10:50:57 antec systemd[1]: cron-daily-apt-cacher-ng.service: Failed with result 'exit-code'.
jui 04 10:50:57 antec systemd[1]: Failed to start cron-daily-apt-cacher-ng.service - [Cron] "/etc/cron.daily/apt-cacher-ng".
jui 04 10:50:57 antec systemd[1]: cron-daily-apt-cacher-ng.service: Triggering OnFailure= dependencies.

#1040304#8
Date:
2024-09-14 13:00:15 UTC
From:
To:
I can't repro this on sd-cron 2.3.0-1~bpo12+1 but idk if my clean
installation of apt-cacher-ng runs the same thing as your full database.

Can you repro this on a modern sd-cron?

#1040304#13
Date:
2024-09-14 15:33:52 UTC
From:
To:
Hi,

Le sam. 14 sept. 2024 à 15:03, наб <nabijaczleweli@nabijaczleweli.xyz> a écrit :

Problem is still happening as of today, every day;
but this machine is seldomly powered on nowadays.

A second, manual, run of cron-daily-apt-cacher-ng.service will run
perfectly fine.

I inserted a "strace" in the cron job.

There's a complaint about /var/run/apt-cacher-ng/socket not existing _yet_ .

I think this looks like some kind of race condition between different
parts of apt-cacher-ng

I think that before the run-parts call was delayed with a
ExecStartPre=... boot_delay.sh to allow for a more staggered bootup sequence
and that was lost in the conversion; maybe even only for the "daily" jobs,
it's still there for the weekly ones:

root@antec:~# grep boot_delay /var/run -r
/var/run/systemd/generator/cron-monthly-check-dfsg-status.service:ExecStartPre=-/usr/libexec/systemd-cron/boot_delay
20
--- × cron-daily-apt-cacher-ng.service - [Cron] /etc/cron.daily/apt-cacher-ng Loaded: loaded (/etc/cron.daily/apt-cacher-ng; generated) Active: failed (Result: exit-code) since Sat 2024-09-14 17:04:13 CEST; 71ms ago Invocation: 8aab276f319b4d09ba09fa246ee124e7 TriggeredBy: ● cron-daily-apt-cacher-ng.timer Docs: man:systemd-crontab-generator(8) Process: 878 ExecStart=/etc/cron.daily/apt-cacher-ng (code=exited, status=1/FAILURE) Main PID: 878 (code=exited, status=1/FAILURE) Mem peak: 10.1M CPU: 62ms 2024-09-14T17:04:12+02:00 antec systemd[1]: Starting cron-daily-apt-cacher-ng.service - [Cron] /etc/cron.daily/apt-cacher-ng... 2024-09-14T17:04:12+02:00 antec apt-cacher-ng[983]: execve("/usr/lib/apt-cacher-ng/acngtool", ["/usr/lib/apt-cacher-ng/acngtool", "maint", "-c", "/etc/apt-cacher-ng", "SocketPath=/var/run/apt-cacher-n"...], 0x7ffc6d3ef3f0 /* 16 vars */) = 0 .... 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[983]: newfstatat(AT_FDCWD, "/var/run/apt-cacher-ng/socket", 0x7ffdd4f26590, 0) = -1 ENOENT (Aucun fichier ou dossier de ce nom) 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[983]: write(2, "This operation transmits credent"..., 53 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[996]: This operation transmits credentials but the socket ( 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[983]: ) = 53 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[983]: write(2, "/var/run/apt-cacher-ng/socket", 29 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[996]: /var/run/apt-cacher-ng/socket 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[983]: ) = 29 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[983]: write(2, ") is currently not accessible!", 30 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[996]: ) is currently not accessible! 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[983]: ) = 30 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[983]: write(2, "\n", 1 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[983]: ) = 1 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[983]: futex(0x7efed9d71d58, FUTEX_WAKE_PRIVATE, 2147483647) = 0 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[983]: exit_group(1) = ? 2024-09-14T17:04:13+02:00 antec apt-cacher-ng[983]: +++ exited with 1 +++ 2024-09-14T17:04:13+02:00 antec systemd[1]: cron-daily-apt-cacher-ng.service: Main process exited, code=exited, status=1/FAILURE 2024-09-14T17:04:13+02:00 antec systemd[1]: cron-daily-apt-cacher-ng.service: Failed with result 'exit-code'. 2024-09-14T17:04:13+02:00 antec systemd[1]: Failed to start cron-daily-apt-cacher-ng.service - [Cron] /etc/cron.daily/apt-cacher-ng. 2024-09-14T17:04:13+02:00 antec systemd[1]: cron-daily-apt-cacher-ng.service: Triggering OnFailure= dependencies.