Skip to content

dnf needs-restarting reports a service restart is needed even if it was already restarted in the package %post script #590

@RomanSoloweow

Description

@RomanSoloweow

Problem description
The dnf needs-restarting command reports that some services need a restart even if they were already restarted in the package %post script.

The reason is that needs-restarting compares the package installtime with the service process boot_time. If installtime > boot_time, the service is marked as outdated. However, in cases where the %post script explicitly starts or restarts the service, the process boot_time is still older than the installtime, which causes a false positive.

Relevant code snippet (from needs-restarting.py):

if self.opts.reboothint:
    need_reboot = set()
    installed = self.base.sack.query().installed()
    for pkg in installed.filter(provides=NEED_REBOOT):
        if pkg.installtime > process_start.boot_time:
            need_reboot.add(pkg.name)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions