Bug 2164835 - [RFE] Request method to inspect RPM package if it requires a system reboot before install
Summary: [RFE] Request method to inspect RPM package if it requires a system reboot be...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: dnf
Version: 9.4
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Evan Goode
QA Contact: swm-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-26 15:56 UTC by Hakyong Do
Modified: 2023-07-12 19:11 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-07-12 19:11:22 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-146581 0 None None None 2023-02-13 15:39:56 UTC

Comment 5 Evan Goode 2023-02-13 15:38:09 UTC
Hi, thank you for your request. Could you please elaborate on what you are proposing? Do you need this functionality available in the command-line interface, something like a `dnf --would-need-restarting install kernel`? Or are you asking for API functionality only?

Currently, to determine whether a reboot is necessary after installing a package (e.g. for `dnf needs-restarting`), DNF checks the package name against a hardcoded list of "core" packages, which includes systemd, kernel, and dbus, among others. We could certainly expose this functionality through the API, but the logic there is not very sophisticated; I'm not sure how well it would meet your needs.

Evan

Comment 6 Hakyong Do 2023-02-28 14:58:29 UTC
Hi,

Thank you for your response. What customer want is they need method to identify packages which will require a reboot before installing it. The CU doesn't matter the functionality available in the command-line or API.

The reason why they need this functionality is they want postpone installing packages that require system reboot later and keep their service online to meet their SLA. If they are able to identify those packages, they will schedule another maintenance window to rebooting systems.

Thank you

Hakyong Do

Comment 7 Evan Goode 2023-03-10 21:44:50 UTC
As I understand it, the change which adds this functionality has already been merged due to https://bugzilla.redhat.com/show_bug.cgi?id=2124793, but it is not yet documented. I just opened https://github.com/rpm-software-management/dnf/pull/1906 to document it.

Once the changes land in RHEL, the customer should be able to use something like this Python snippet to detect whether installing a package will require a reboot:

```
import dnf

package = "glibc"

base = dnf.Base()
base.read_all_repos()
base.fill_sack()

base.install_specs([package])
base.resolve()

# Is reboot needed?
if base.reboot_needed():
    print("Reboot is recommended")
elif:
    print("Reboot should not be necessary")
```

We still need to decide an expected target version of arrival in RHEL.

Comment 8 Jaroslav Mracek 2023-03-21 11:59:17 UTC
I have another suggestion. The method `reboot_needed()` uses static list of packages that might require reboot, but this is not the best approach that we can use. In advisory there is a suggestion field that could propose a reboot - `<reboot_suggested>True</reboot_suggested>`. We might use that information to provide a suggestion. It is also a cheap in comparison to scanning file content of rpms and guessing based on that.

What do you think?

Comment 9 Jaroslav Mracek 2023-03-21 12:01:13 UTC
        <package name="pcp-pmda-redis" version="6.0.1" release="2.fc36" epoch="0" arch="armv7hl" src="https://download.fedoraproject.org/pub/fedora/linux/updates/36/armv7hl/p/pcp-pmda-redis-6.0.1-2.fc36.armv7hl.rpm">
          <filename>pcp-pmda-redis-6.0.1-2.fc36.armv7hl.rpm</filename>
          <reboot_suggested>True</reboot_suggested>
        </package>

Comment 10 Evan Goode 2023-07-12 19:11:22 UTC
We now have https://github.com/rpm-software-management/dnf5/issues/587 to track this use case in DNF 5, the upcoming package manager that will replace DNF in future versions of RHEL. We'll be thinking about it when we implement the needs-restarting plugin for DNF 5.

More advanced logic for "reboot needed" is probably not worth implementing in DNF 4 this late in its life cycle, and the existing logic isn't really something users should rely on, so I have decided to close https://github.com/rpm-software-management/dnf/pull/1906 and leave `base.reboot_needed()` undocumented. Closing this bug.


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