RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2082295 - dnf needs-restart does not work well on systems without a hardware clock
Summary: dnf needs-restart does not work well on systems without a hardware clock
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf-plugins-core
Version: CentOS Stream
Hardware: aarch64
OS: Linux
Target Milestone: rc
: ---
Assignee: Nicola Sella
QA Contact: swm-qe
Depends On:
TreeView+ depends on / blocked
Reported: 2022-05-05 18:18 UTC by alex
Modified: 2023-08-10 18:15 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2022-05-18 14:56:16 UTC
Type: Bug
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-121198 0 None None None 2022-05-05 18:30:03 UTC

Description alex 2022-05-05 18:18:50 UTC
Description of problem:

This change:


Broke dnf-needs-restart on systems without a hardware clock, such as a Raspberry Pi 4. On such systems, the clock is 1970-01-01 on boot until time synchronizes over the network, and /proc/1 gets that date.

I would suggest mirroring what procps-ng/uptime does? That seems to work correctly on a Raspberry.

Version-Release number of selected component (if applicable):


How reproducible:

Run sudo dnf needs-restarting -r on any system without a hardware clock.

Actual results:

You are always prompted to reboot, because boot time

Expected results:

You are only prompted to reboot when needed.

Additional info:

See discussion at https://bugs.rockylinux.org/view.php?id=82 . Initially I thought this was an issue specific to Rocky Linux 8 on Raspberry Pi, but I believe this is really a DNF issue.

Comment 1 Nicola Sella 2022-05-18 14:56:16 UTC
Hello, the issue seems too specific.

To solve it, my suggestion would be to create a specific patch
in downstream RockyLinux or releasing a dnf plugin that fixes it.

Currently, the team will not have enough capacity to target a
case like this, so, I will close it.

However, if you have a patch and would like to make a change
upstream, please don't hesitate to submit a PR, and we will be
more than happy to include the fix upstream.

Thank you.

Comment 2 alex 2022-05-18 15:08:54 UTC
> However, if you have a patch and would like to make a change upstream, please don't hesitate to submit a PR, and we will be more than happy to include the fix upstream.

Just to be clear on this, if I submit a PR on GH to this file:


Changing it so that it calculates the boot time in a different way (my intention could be to look at how uptime does it, which works correctly)...

Would it be feasible for such PR to make it to RHEL 8? Could I know what should happen in order for this to reach RHEL *8*?

Comment 3 Nicola Sella 2022-05-18 15:32:55 UTC
Unfortunately, uptime does not work well with containers and virtual machines.
Generally, I would say that the first IF with needs-restarting code, is to 
understand where dnf is running, and that's not an easy task. If you are outside
a vm, that's easy and uptime works. Inside a vm... eeh.
That's why I believe that a plugin would be more appropriate. It can solve a
specific case without impacting on all RHEL customers (this line broke quite
some stuff).

Other bugs that are targeting similar issues are:

The line is correct, and if you want more details about it and work on a PR,
I could also help you on dnf's IRC.

Comment 4 alex 2023-08-10 18:15:50 UTC
BTW, if anyone is curious, it seems this was solved later here https://bugzilla.redhat.com/show_bug.cgi?id=2137935 , and it has been included in EL9:


, but not in EL8.

So if anyone finds this by googling, likely updating to EL9 solves the issue.

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