Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-14900

"needs-restarting -r" reports no reboot required if RTC is not in UTC

    • dnf-plugins-core-4.3.0-14.el9
    • Normal
    • sst_cs_software_management
    • ssg_core_services
    • 10
    • 12
    • 3
    • False
    • Hide

      None

      Show
      None
    • Yes
    • Red Hat Enterprise Linux
    • None
    • Bug Fix
    • Hide
      Cause: Updating a package which requires a system reboot to fully apply on a system with a real time clock not running in UTC.
      Consequence: "dnf needs-restarting --reboothint" might not report that the reboot was needed.
      Fix: systemd's UnitsLoadStartTimestamp property was added as a preferred source of a boot time.
      Result: "dnf needs-restarting --reboothint" is now more reliable outside of containers on systems with a real time clock running in local time.
      Show
      Cause: Updating a package which requires a system reboot to fully apply on a system with a real time clock not running in UTC. Consequence: "dnf needs-restarting --reboothint" might not report that the reboot was needed. Fix: systemd's UnitsLoadStartTimestamp property was added as a preferred source of a boot time. Result: "dnf needs-restarting --reboothint" is now more reliable outside of containers on systems with a real time clock running in local time.
    • Proposed
    • None

      What were you trying to do that didn't work?

      After installing a critical component such as systemd or the kernel, "needs-restarting -r" still reports no reboot is necessary:

      # yum -y reinstall systemd
      [...]
      # needs-restarting -r
      [...]
      No core libraries or services have been updated since boot-up.
      Reboot should not be necessary.

      The issue happens if RTC is in local timezone, which is not recommended but supported anyway.

      This is because internally the tool checks the boot time through using "stat -c %Y /proc/1" python equivalent, then compares installed packages with the boot timestamp.

      Unfortunately this doesn't work because "stat -c %Y /proc/1"  gets somehow adjusted by the kernel because of RTC being in local timezone.

      When timezone is +something, e.g. Europe/Paris, the boot time gets computed in the future:

      # date
      Fri Oct 27 15:15:04 CEST 2023
      
      # stat -c %y /proc/1
      2023-10-27 17:07:50.352000000 +0200
      
      # stat -c %Y /proc/1
      1698419270

      The solution is to instead rely on btime field found in /proc/stat, which seems always correct:

      # grep ^btime /proc/stat 
      btime 1698412068 

      Please provide the package NVR for which bug is seen:

      python3-dnf-plugins-core-4.0.21-19.el8_8.noarch

      How reproducible:

      Always

      Steps to reproduce

      1. Assuming TZ is >UTC (e.g. Europe/Paris) configure the system with local RTC
        # timedatectl set-local-rtc 1
      2. Reboot
        # reboot
      3. Reinstall systemd package
        # yum -y reinstall systemd
      4. Execute needs-restarting -r
        # needs-restarting -r

      Expected results

      Core libraries or services have been updated since boot-up:
        * systemd
      
      Reboot is required to fully utilize these updates.

      Actual results

      No core libraries or services have been updated since boot-up.
      Reboot should not be necessary.

            rh-ee-egoode Evan Goode
            rhn-support-rmetrich Renaud Métrich
            packaging-team-maint packaging-team-maint
            Eva Mrakova Eva Mrakova
            Mariya Pershina Mariya Pershina
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: