Bug 2203100 - needs-restarting -s fail with mysql container
Summary: needs-restarting -s fail with mysql container
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: dnf-plugins-core
Version: 9.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jan Kolarik
QA Contact: Jan Blazek
URL:
Whiteboard:
Depends On: 2122587
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-05-11 09:14 UTC by Jan Kolarik
Modified: 2023-08-15 07:56 UTC (History)
7 users (show)

Fixed In Version: dnf-plugins-core-4.3.0-8.el9
Doc Type: Bug Fix
Doc Text:
.The `dnf needs-restarting -s` command now correctly displays the list of systemd services Previously, when you used the `needs-restarting` command with the `-s` or `--services` option, an error occurred when a non-systemd or malfunctioning process was detected. With this update, the `dnf needs-restarting -s`command ignores such processes and displays a warning instead with the list of affected systemd services.
Clone Of: 2122587
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-157085 0 None None None 2023-05-12 06:56:21 UTC

Description Jan Kolarik 2023-05-11 09:14:51 UTC
+++ This bug was initially created as a clone of Bug #2122587 +++

Description of problem:
The "dnf needs-restarting -s" command fail when a mysql container is running in the same host and a "systemd-libs" update has been donwloaded by dnf-automatic.

The command seems to identify the MySQL container like a service.

Steps to Reproduce:
1. Deploy a MySQL container mapping the /var/lib/mysql to a volume.
2. dnf-automatic donwloads a new version of "systemd-libs" package.
3. Execute "dnf needs-restarting -s".

Actual results:
[root@xxxxxxx ~]# dnf needs-restarting -s
Traceback (most recent call last):
  File "/usr/bin/dnf", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 201, in user_main
    errcode = main(args)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 67, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 106, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 122, in cli_run
    cli.run()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 1055, in run
    return self.command.run()
  File "/usr/lib/python3.6/site-packages/dnf-plugins/needs_restarting.py", line 278, in run
    names = set([get_service_dbus(pid) for pid in sorted(stale_pids)])
  File "/usr/lib/python3.6/site-packages/dnf-plugins/needs_restarting.py", line 278, in <listcomp>
    names = set([get_service_dbus(pid) for pid in sorted(stale_pids)])
  File "/usr/lib/python3.6/site-packages/dnf-plugins/needs_restarting.py", line 142, in get_service_dbus
    systemd_manager_interface.GetUnitByPID(pid)
  File "/usr/lib64/python3.6/site-packages/dbus/proxies.py", line 70, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib64/python3.6/site-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib64/python3.6/site-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.systemd1.NoUnitForPID: PID 1456 does not belong to any loaded unit.

Expected results:


Additional info:
"dnf needs-restarting -r" shows the following result:

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

Reboot is required to fully utilize these updates.
More information: https://access.redhat.com/solutions/27943

--- Additional comment from Jaroslav Mracek on 2023-03-21 15:32:22 CET ---

We should investigate what we can do with it.

--- Additional comment from Todd Rinaldo on 2023-04-28 22:39:59 CEST ---

There's a proposed patch for this at https://github.com/cpanel/elevate/pull/245

--- Additional comment from Todd Rinaldo on 2023-04-28 22:41:18 CEST ---

Sorry, bad link. There's a proposed fix at https://github.com/rpm-software-management/dnf-plugins-core/pull/487

Comment 1 Jan Kolarik 2023-05-11 09:16:26 UTC
Cloned from the RHEL 8 bug: https://bugzilla.redhat.com/show_bug.cgi?id=2122587.


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