Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

needs_restarting: Fix boot time derivation for systems without RTC #468

Merged

Conversation

utoddl
Copy link

@utoddl utoddl commented Nov 16, 2022

This PR contains the implementation of the idea from Fedora bugzilla Comment #12. See discussion also #466 (comment)

@jan-kolarik jan-kolarik self-assigned this Nov 16, 2022
@jan-kolarik
Copy link
Member

jan-kolarik commented Nov 23, 2022

Hi Todd, thanks for working on this. I was testing that in the container and it seems working fine! I don't see any issue regarding your solution now and tests are passing, so I am for the merge.

Just to sum it up. We have two sources for the boot time which is now used in the implementation:

  • /proc/1
    • Time of the first process that was run after booting
    • This was the solution so far
    • Not working for machines without RTC - there zero epoch time is returned
  • /proc/uptime
    • Current time subtracted from the seconds output of this uptime file
    • Not working on containers which shares the kernel with the host - there the host kernel uptime is returned

Please could you add comments/docstrings with the explanation of this change into the code? Also please mention the bugzilla ticket inside the commit description (look f.e. here) + choose better title e.g. needs_restarting: Fix calculating boot time for systems without RTC or something like that.

@utoddl utoddl changed the title get_boot_time for systems with no rtc needs_restarting: Fix boot time derivation for systems without RTC Nov 23, 2022
@jan-kolarik jan-kolarik merged commit eb0a223 into rpm-software-management:master Nov 23, 2022
dcantrell added a commit to dcantrell/dnf-plugins-core that referenced this pull request Mar 27, 2023
This problem was reported on RHEL-8 for ppc64le.  I confirmed the
reproducer does work.  It also affects RHEL-9.  Fortunately, this
problem was reported and addressed in Fedora.  I confirmed the fix
works for at least RHEL-8 on ppc64le.

The Fedora issue was reported here, along with the proposed fix:

rpm-software-management#468

Signed-off-by: David Cantrell <dcantrell@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants