RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2092033 - needs-restarting should require a reboot for the update of zlib
Summary: needs-restarting should require a reboot for the update of zlib
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf-plugins-core
Version: 8.6
Hardware: All
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Nicola Sella
QA Contact: Tomáš Bajer
Mariya Pershina
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-31 15:02 UTC by jcastran
Modified: 2023-11-14 18:06 UTC (History)
10 users (show)

Fixed In Version: dnf-plugins-core-4.0.21-23.el8
Doc Type: Bug Fix
Doc Text:
.The `needs-restarting` plug-in now correctly requires the system restart when a file owned by `dbus` is updated by `zlib` Previously, when you ran the YUM `needs-restarting` plug-in, it did not prompt to restart the system when a file owned by the `dbus` package was updated by the dependent `zlib` package. With this update, the issue has been fixed, and the `needs-restarting` plug-in now displays a message that you must restart `dbus` when `zlib` is updated.
Clone Of:
Environment:
Last Closed: 2023-11-14 15:49:47 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-123791 0 None None None 2022-05-31 15:24:04 UTC
Red Hat Product Errata RHBA-2023:7125 0 None None None 2023-11-14 15:49:58 UTC

Description jcastran 2022-05-31 15:02:37 UTC
Description of problem:


Version-Release number of selected component (if applicable):
yum-utils-4.0.21-11.el8.noarch



Steps to Reproduce:
1. yum update zlib
2. needs-restarting -s
3.

Actual results:
# needs-restarting -s
Updating Subscription Management repositories.
Failed to read PID 4813's smaps.
systemd-udevd.service
rsyslog.service
auditd.service
pmie.service
pmlogger.service
systemd-journald.service
sssd.service
dbus.service            <<<<<<<
pmcd.service
NetworkManager.service
firewalld.service
pmlogger_farm.service
rpcbind.service
sshd.service
gssproxy.service
pmie_farm.service
user
rngd.service
systemd-logind.service

Expected results:
If dbus must be restarted, the system should be rebooted. 

Additional info:

Comment 1 Pavla Kratochvilova 2022-06-06 12:51:51 UTC
The option `-s` only reports affected systemd services, but doesn't report whether a reboot is required. What does `dnf needs-restarting -r` report?

Comment 2 jcastran 2022-06-06 13:03:50 UTC
I should have included that at the start.

~~~~~~~~~~~~~~~~
[root@r8 ~]# needs-restarting -r
Updating Subscription Management repositories.
No core libraries or services have been updated since boot-up.
Reboot should not be necessary.

[root@r8 ~]# needs-restarting -s
Updating Subscription Management repositories.
rsyslog.service
sshd.service
pmlogger.service
gssproxy.service
rpcbind.service
firewalld.service
rngd.service
auditd.service
sssd.service
systemd-logind.service
NetworkManager.service
pmcd.service
systemd-journald.service
pmie_farm.service
pmlogger_farm.service
systemd-udevd.service
pmie.service
~~~~~~~~~~~~~~~~

The reboot will only show when certain packages are updated.

REBOOTPKGS = ['kernel', 'kernel-rt', 'glibc', 'linux-firmware', 'systemd', 'udev', 'openssl-libs', 'gnutls', 'dbus']

In this case, zlib is triggering a need to restart dbus, but not saying it needs to reboot.

Comment 3 Marek Blaha 2022-06-13 12:43:26 UTC
Reproduces (using expat instead ov zlib, though - unlike zlib, expat is direct dependency of dbus):

# dnf repoquery --requires dbus-daemon
Updating Subscription Management repositories.
Last metadata expiration check: 0:17:16 ago on Mon Jun 13 08:18:55 2022.
--------------------- 8< ----------------------
libexpat.so.1()(64bit)
--------------------- 8< ----------------------


# dnf downgrade expat
--------------------- 8< ----------------------
Downgraded:
  expat-2.2.5-4.el8_5.3.x86_64

# dnf needs-restarting -s
Updating Subscription Management repositories.
polkit.service
tuned.service
dbus.service

# dnf needs-restarting -r
Updating Subscription Management repositories.
No core libraries or services have been updated since boot-up.
Reboot should not be necessary.

# echo $?
0

Comment 4 Petr Pisar 2022-06-13 12:48:13 UTC
The binary package is built from dnf-plugins-core. Moving a component there.

Comment 5 Petr Pisar 2022-06-13 13:08:51 UTC
I think there is a flaw in a logic for the "-r" option in needs_restarting.py:

    def run(self):
        process_start = ProcessStart()
        owning_pkg_fn = functools.partial(owning_package, self.base.sack)
        owning_pkg_fn = memoize(owning_pkg_fn)

        opt = get_options_from_dir(os.path.join(
            self.base.conf.installroot,
            "etc/dnf/plugins/needs-restarting.d/"),
            self.base)
        NEED_REBOOT.extend(opt)
        if self.opts.reboothint:
            need_reboot = set()
            installed = self.base.sack.query().installed()
            for pkg in installed.filter(name=NEED_REBOOT):
→               if pkg.installtime > process_start.boot_time:
                    need_reboot.add(pkg.name)
            if need_reboot:
                print(_('Core libraries or services have been updated '
                        'since boot-up:'))
                for name in sorted(need_reboot):
                    print('  * %s' % name)
                print()
                print(_('Reboot is required to fully utilize these updates.'))
                print(_('More information:'),
                      'https://access.redhat.com/solutions/27943')
                raise dnf.exceptions.Error()  # Sets exit code 1
            else:
                print(_('No core libraries or services have been updated '
                        'since boot-up.'))

The current code ends up with "No core libraries or services have been updated since boot-up." message because all it does is checking an installation time of the very few packages listed in NEED_REBOOT array against uptime of the system.

In this case a library used by dbus program was updated. But that library is not part of dbus RPM package. It's comes from a different package (e.g. zlib) which is not on the list.

A proper fix needs to enumerate affected processes, locate their programs, map them to binary RPM package, consult the packages against the NEED_REBOOT array.

needs-restaring without options already locates the program ("needs-restarting | grep dbus"). All you need is query a sack for a package providing the program file and then match NEED_REBOOT without checking any installation times.

Comment 6 Petr Pisar 2022-06-13 15:41:16 UTC
Now I realize that replacing the original approach would introduce regressions like "I upgraded linux-firmware and it does report to reboot because on process holds open firmware file". I think we need to combine both approaches. Checking for open files and checking for installation time, do union on both sets.

Comment 8 Nicola Sella 2022-11-08 12:40:07 UTC
Hello, unfortunately, we are postponing this fix to 8.9. The risk of this bugfix having collateral side effects is high. Therefore, we would like to have more time to test it in Fedora.

Comment 23 errata-xmlrpc 2023-11-14 15:49:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (dnf-plugins-core bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:7125


Note You need to log in before you can comment on or make changes to this bug.