Bug 1941337

Summary: anacron does not run if battery-backed HID devices are connected
Product: [Fedora] Fedora Reporter: Philippe Troin <phil>
Component: cronieAssignee: Matej Mužila <mmuzila>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 33CC: dimitris.on.linux, mmaslano, mmuzila, tm
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cronie-1.5.7-1.fc34 cronie-1.5.7-1.fc33 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-31 00:17:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to exclude HID devices based upon the battery name. none

Description Philippe Troin 2021-03-21 17:13:04 UTC
Created attachment 1765088 [details]
Patch to exclude HID devices based upon the battery name.

Description of problem:
The anacron jobs are not ran if any battery-backed devices (eg. wireless mice) are connected to the computer running anacron.

Version-Release number of selected component (if applicable):
cronie-anacron-1.5.6-1.fc33.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. Connect a wireless mouse (eg. Logitech M705) to the computer

Actual results:
Anacron jobs are not ran:
journalctl -b | grep 'Anacron started' is empty

Expected results:
Anacron should run.

Additional info:
1.5.6 changed /etc/cron.hourly/0anacron and is now considering the online status of the mouse's battery.  Mice and possibly other HID devices should be ignored, while ensuring that UPS devices (which can be HID devices as well) are not.

I've attached a crude patch for that file.

Comment 1 Tomáš Mráz 2021-03-22 07:58:24 UTC
Could you please show me the output of `ls -lR /sys/class/power_supply` ? Also I'd like to see contents of type and online files of each of the power_supply devices.

Unless the script is severally broken it should be sufficient to have one online power supply device to run anacron. There must be something else wrong with the script.

Comment 2 Philippe Troin 2021-03-22 15:38:49 UTC
# ls -lR /sys/class/power_supply
/sys/class/power_supply:
total 0
lrwxrwxrwx 1 root root 0 Mar 22 08:37 hidpp_battery_1 -> ../../devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10.1/3-10.1:1.2/0003:046D:C52B.000A/0003:046D:406D.000B/power_supply/hidpp_battery_1/

This is a desktop with a Logitech M705 mouse connected.

Comment 3 Tomáš Mráz 2021-03-22 15:46:54 UTC
Ah, ok. So desktops do not have an entry for their power supply device.

Comment 4 Fedora Update System 2021-03-29 13:46:49 UTC
FEDORA-2021-5bacc64924 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-5bacc64924

Comment 5 Fedora Update System 2021-03-29 13:46:49 UTC
FEDORA-2021-f92af23794 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-f92af23794

Comment 6 Fedora Update System 2021-03-30 14:38:07 UTC
FEDORA-2021-f92af23794 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-f92af23794`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-f92af23794

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2021-03-30 15:21:11 UTC
FEDORA-2021-5bacc64924 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-5bacc64924`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-5bacc64924

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2021-03-31 00:17:04 UTC
FEDORA-2021-f92af23794 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Dimitris 2021-03-31 18:25:55 UTC
This still seems to be here on F33 with 1.5.7-1.fc33

$ sudo cat /var/spool/anacron/cron.daily
cat: /var/spool/anacron/cron.daily: No such file or directory

$ journalctl -b | grep 'Anacron started'
$

$ journalctl -b | grep 'Anacron'
$

I'm using a Logitech MX Master 3 with bluetooth:

$ cat /sys/class/power_supply/hidpp_battery_0/online 
1

Comment 10 Dimitris 2021-04-01 03:03:27 UTC
Never mind, I was impatient, once :01 rolled around the cron entry was run as expected.

Comment 11 Fedora Update System 2021-04-02 01:21:13 UTC
FEDORA-2021-5bacc64924 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.