Bug 1960437

Summary: needs-restarting calculating wrong boot time
Product: [Fedora] Fedora Reporter: David L. Crow <crow>
Component: dnf-plugins-coreAssignee: Nicola Sella <nsella>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 34CC: alex.j.kerzner, dmach, jmracek, mblaha, packaging-team-maint, pkratoch, praiskup, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-plugins-core-4.0.23-1.fc34 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-09-24 20:32:31 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:

Description David L. Crow 2021-05-13 20:44:37 UTC
Description of problem:

needs-restarting -r is calculating the wrong boot time, so it is not correctly detecting a need to restart.  I think this is a regression caused by the changes introduced in bug 1914251.


Version-Release number of selected component (if applicable): python3-dnf-plugins-core-4.0.19-1.fc34.noarch


How reproducible: every time


Steps to Reproduce:

These are steps that I ran just now after a new kernel was installed at 6:30a this morning.

# needs-restarting -r
No core libraries or services have been updated since boot-up.
Reboot should not be necessary.
# uptime
 15:35:25 up 8 days,  6:51,  2 users,  load average: 0.07, 0.07, 0.08
# ls -la /proc/1/cmdline
-r--r--r-- 1 root root 0 May 13 06:59 /proc/1/cmdline
# cat /proc/stat | grep btime
btime 1620222248
# uname -r
5.11.17-300.fc34.x86_64
# rpm -q kernel
kernel-5.11.17-300.fc34.x86_64
kernel-5.11.19-300.fc34.x86_64

Actual results:

Does not indicate that a restart is necessary.

Expected results:

Should indicate that a restart is necessary.

If I reverse apply the patch in bug 1914251 so that the boot time is calculated correctly, I receive the following output:

Core libraries or services have been updated since boot-up:
  * glibc
  * kernel
  * systemd


Additional info:

Comment 1 Nicola Sella 2021-07-26 13:51:13 UTC
Hello, after some investigation I created this copr build.[1]
Please, could you test it?

Just run:
dnf copr enable nsella/needs-restaring-bz1960437
dnf update dnf-plugins-core

[1] https://copr.fedorainfracloud.org/coprs/nsella/needs-restaring-bz1960437/

Comment 2 David L. Crow 2021-08-01 23:59:06 UTC
The needs-restarting changes in the copr build seemed to have worked correctly when the latest kernel was released around July 30.

Comment 3 Nicola Sella 2021-08-05 12:24:46 UTC
Thank you. Also, I forgot to post the PR: https://github.com/rpm-software-management/dnf-plugins-core/pull/432

Comment 4 Fedora Update System 2021-09-23 13:04:53 UTC
FEDORA-2021-a3a73697b8 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-a3a73697b8

Comment 5 Fedora Update System 2021-09-23 19:41:50 UTC
FEDORA-2021-a3a73697b8 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-a3a73697b8`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-a3a73697b8

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

Comment 6 Fedora Update System 2021-09-24 20:32:31 UTC
FEDORA-2021-a3a73697b8 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.