Description of problem: This change: https://github.com/rpm-software-management/dnf-plugins-core/commit/ece8e77155919409d344d405ec4ed19d16a522aa 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): python3-dnf-plugins-core-4.0.21-4.el8_5.noarch 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.
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.
> 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: https://github.com/rpm-software-management/dnf-plugins-core/blob/master/plugins/needs_restarting.py#L202 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*?
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: https://bugzilla.redhat.com/show_bug.cgi?id=1914251 https://bugzilla.redhat.com/show_bug.cgi?id=1960437 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.
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: https://gitlab.com/redhat/centos-stream/rpms/dnf-plugins-core/-/blob/c9s/0006-Fix-boot-time-derivation-for-systems-with-no-rtc.patch?ref_type=heads , but not in EL8. So if anyone finds this by googling, likely updating to EL9 solves the issue.