#1148276 anacron: restore udev trigger on AC connect, with a device match that avoids #914795

Package:
anacron
Source:
anacron
Description:
cron-like program that doesn't go by time
Submitter:
Sam Bull
Date:
2026-09-18 16:03:03 UTC
Severity:
normal
Tags:
#1148276#5
Date:
2026-09-18 15:51:34 UTC
From:
To:
Hi,

It appears that #914795 was resolved by removing the udev rule introduced to fix a
previous issue (with anacron not running reliably). It appears both can be fixed by simply
adding a filter to the udev rule so it only checks mains power, instead of being triggered
by device power. (Note that README.debian still claims the udev rule is in use)

I can see on my machine, I have Type=Mains/Scope= and for a connected mouse, I have
Type=Battery/Scope=Device. So, adding a Type==Mains and/or a Scope!=Device should make the
udev rule work as initially intended.

So, I think the updated udev rule that can be re-added to make anacron reliable again
could look like:

   SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", TAG+="systemd", ENV{SYSTEMD_WANTS}+="anacron.service"

Thanks,
Sam