Package: anacron
Version: 2.3-52
Severity: normal
Tags: patch

After upgrading to anacron 2.3-52, a laptop on mains power took
2 min 31 s in userspace instead of 42.8 s on the preceding boot.
The laptop runs a Debian testing derivative with Debian's own anacron,
systemd and udev packages (262.2-1). Both boots pulled in
systemd-udev-settle.service through ZFS.

The ADP0 worker reported that "/usr/sbin/invoke-rc.d anacron start"
was taking longer than 59 seconds. udevadm settle timed out waiting
for the queue. anacron.service started after settle failed and
basic.target was reached.

With the patched package installed on the same laptop, the next boot
took 33.7 s in userspace: udev-settle finished in 2.7 s,
anacron.service started on mains at 32.9 s and no unit failed.

The start command in debian/anacron.udev waits for anacron.service.
The service's normal dependencies order it after basic.target. An
early consumer of the udev queue consequently waits for a worker
whose service job cannot run until that part of boot has finished.

I reproduced this in a Debian testing QEMU/KVM guest with an online
test_power mains supply and a unit that waits for udev-settle before
local-fs.target. All three stock boots had the worker warning and
settle timeout and reached multi-user.target at 179.8-179.9 s.
With the rule masked, settle completed and the same target was
reached at 17.2-17.3 s. With the stock rule and no settle consumer,
it was reached at 20.2-23.5 s, with no worker warning.

With the patch installed and the settle consumer enabled, settle
completed on all three boots and multi-user.target was reached at
16.5-16.8 s. Toggling mains off, on and off changed anacron.service
to inactive, active with a fresh PID, and inactive on each boot.

The patch queues both systemd actions with systemctl --no-block.
It retains the mains-only match requested in #1148276, the original
SysV dispatch, and the service's ConditionACPower setting.

I found this with AI assistance and checked it myself.

Description: Queue anacron jobs without waiting in systemd udev events
 A synchronous start can keep a mains power event in the udev queue until
 basic.target. A boot-time consumer of systemd-udev-settle then holds up
 the targets needed by anacron.service until the settle command times out.
 Submit both actions asynchronously on systemd. Retain the SysV actions.
Origin: vendor, Sparky Stereo OS
Author: Daniel Campos Ramos <[email protected]>
Forwarded: no
Last-Update: 2026-11-23
Thanks: Lance Lin for Debian's mains rule and Sam Bull for Debian #1148276.

--- a/debian/anacron.udev
+++ b/debian/anacron.udev
@@ -4,5 +4,9 @@
 #
 # Activate anacron service whenever power supply is online.
 
-SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", 
RUN+="/usr/sbin/invoke-rc.d anacron start"
-SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", 
RUN+="/usr/sbin/invoke-rc.d anacron stop"
+# Submit systemd jobs without holding the udev event open.
+SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", 
TEST=="/run/systemd/system", RUN+="/usr/bin/systemctl --no-block start 
anacron.service"
+SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", 
TEST=="/run/systemd/system", RUN+="/usr/bin/systemctl --no-block stop 
anacron.service"
+
+SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", 
TEST!="/run/systemd/system", RUN+="/usr/sbin/invoke-rc.d anacron start"
+SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", 
TEST!="/run/systemd/system", RUN+="/usr/sbin/invoke-rc.d anacron stop"

The system information below describes the container this report was
composed in. The measurements come from the laptop described above and
from the guest (Debian kernel 7.3.5+deb14-amd64, systemd 262.2-1).



-- System Information:
Debian Release: forky/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 7.3.4-stereo3d18 (SMP w/12 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=C, LC_CTYPE=C (charmap=UTF-8) (ignored: LC_ALL set to C.UTF-8), 
LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect

Versions of packages anacron depends on:
ii  libc6  2.43-7

Versions of packages anacron recommends:
ii  cron [cron-daemon]  3.0pl1-213

Versions of packages anacron suggests:
pn  default-mta | mail-transport-agent  <none>
pn  powermgmt-base                      <none>
pn  rsyslog | system-log-daemon         <none>

-- no debconf information

Reply via email to