From ad9bb7ce11373266990be087c8275e42fd21c70d Mon Sep 17 00:00:00 2001 From: Funzi Date: Tue, 1 Aug 2023 21:09:53 +0200 Subject: [PATCH] Add solution for `dnf needs-restarting -f` issue --- docs/RPi/solutions/solutions.md | 97 +++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 docs/RPi/solutions/solutions.md diff --git a/docs/RPi/solutions/solutions.md b/docs/RPi/solutions/solutions.md new file mode 100644 index 0000000..54ba7cb --- /dev/null +++ b/docs/RPi/solutions/solutions.md @@ -0,0 +1,97 @@ +--- +title: Solutions +author: Funzi +--- + +# Solutions and Troubleshooting + +## `dnf` always claims to require a restart + +### Symptom + +Even though the system has been restarted recently, e.g., after a Kernel update, `dnf needs-restarting -r` always +returns with exit code `1`. + +``` +# dnf needs-restarting -r +Core libraries or services have been updated since boot-up: + * dbus + * dbus-daemon + * glibc + * linux-firmware + * systemd + +Reboot is required to fully utilize these updates. +More information: https://access.redhat.com/solutions/27943 +``` + +**This affects both Rocky Linux 8 and 9.** However, +a [patch for 9.3 is to be released soon](https://github.com/rpm-software-management/dnf-plugins-core/pull/468). + +### Cause + +The `dnf` plugin uses the `mtime` of `/proc/1` which is set to start of epoch due to lack of RTC on Raspberry Pi. The +correct system time is set later at boot once network connectivity is established and an NTP server is reachable. +Compared to 1970, every package update is after the last reboot which causes the wrong result. + +### Solution + +Until 9.3 is released, or if the system is still on +8.x, [the patch](https://github.com/rpm-software-management/dnf-plugins-core/pull/468/commits/b8132e1e04fb44c9ef8ab7dbcea2d2b3b920be2c) +can be manually applied to all versions. + +``` +# patch /usr/lib/python3.6/site-packages/dnf-plugins/needs_restarting.py <