Bug 1498680 - dnf makecache timer is confused about batteries
Summary: dnf makecache timer is confused about batteries
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 29
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Jaroslav Mracek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-04 22:56 UTC by Jonathan Briggs
Modified: 2019-10-19 15:08 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-10-19 15:08:30 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jonathan Briggs 2017-10-04 22:56:50 UTC
Description of problem:
My home server which is definitely plugged in, gets this message from dnf makecache timer:
Metadata timer caching disabled when running on a battery.

While it is on a UPS, the UPS is not connected to the computer. Investigation with strace shows that it is this that causes the battery message:

open("/sys/class/power_supply/hidpp_battery_0/online", O_RDONLY) = 3

That "hidpp" device is a Logitech wireless keyboard and mouse.
$ cat /sys/class/power_supply/hidpp_battery_0/model_name 
Wireless Touch Keyboard K400

Version-Release number of selected component (if applicable):
dnf-2.6.3-12.fc26.noarch
unifying-receiver-udev-0.2-8.fc26.noarch

How reproducible:
Happens every hour.

Steps to Reproduce:
1. Have dnf and unifying-receiver-udev installed.
2. Connect a Logitech K400
3. Run "dnf makecache timer"

Actual results:
Metadata timer caching disabled when running on a battery.


Expected results:
DNF package cache updated.

Additional info:

The documentation and "dnf makecache --help" are both wrong about the timer option. Both claim it is "dnf makecache --timer" but that does not work. The systemd unit calls it as "dnf makecache timer" no double-dashes.

Comment 1 Fedora End Of Life 2018-05-03 08:54:42 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 2 Jan Kurik 2018-08-14 11:00:20 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 3 Jaroslav Mracek 2019-07-24 15:59:48 UTC
Please can anyone reproduce the issue with latest dnf (4.0.9)?

Comment 4 Jaroslav Mracek 2019-07-24 16:46:51 UTC
I create a patch that changed the detection - https://github.com/rpm-software-management/dnf/pull/1439.

The previous detection was based on call /usr/bin/on_ac_power that is not on the systems.

Comment 5 Jonathan Briggs 2019-07-24 17:00:40 UTC
Neither one of my two Linux desktop systems has a /sys/class/power_supply/AC directory. I don't think that this will work. Now, the laptop does have an AC directory. Perhaps if you assume AC power unless the AC directory is present AND set to 0?

Comment 6 Jaroslav Mracek 2019-08-20 07:02:00 UTC
I believe that the implementation is is correct. Def on_ac_power() returns True (on AC), False (on battery), None (Unable to detect). Then usage in code is like:
`dnf.util.on_ac_power() is False:`
It means that when None is returned it assumes that it is not on battery.

Comment 7 Jaroslav Mracek 2019-10-19 15:08:30 UTC
The patch was release in dnf-4.2.11 in Fedora 30


Note You need to log in before you can comment on or make changes to this bug.