DNF5-NEEDS-RESTARTING(8) dnf5 DNF5-NEEDS-RESTARTING(8)

dnf5-needs-restarting - Needs-restarting Command

dnf5 needs-restarting [-p | --processes [-e | --exclude-services]] [-s | --services] [-r | --reboothint] [--json]

The needs-restarting command determines whether the system should be rebooted to fully apply changes from package installations and upgrades. Without any options, dnf5 needs-restarting will report whether any important packages were installed or upgraded since boot. This set of important packages includes the kernel, systemd, each package listed here: https://access.redhat.com/solutions/27943, any package marked with a reboot_suggested advisory, and any package configured in the suggest-reboot.d directories described below.

The needs-restarting command will exit with code 1 if a reboot is recommended, or, when invoked with --services, if any systemd service needs restarting. If no action is recommended, needs-restarting will exit with code 0.

List processes that need restarting. If the package that provides the executable running, or any of its dependencies, have been updated since the process started, then restarting the process will be recommended.
Used with the -p, --processes option and will filter out any processes that are handled by systemd services.
List systemd services that need restarting. If the package that provides the service, or any of its dependencies, have been updated since the service started, then restarting the service will be recommended. Note that this approach is quite aggressive to recommend a restart when one may not be strictly necessary. Services defined by core packages whose update requires a reboot (the same set the reboot hint checks) are not recommended for restart; they are listed on standard error with a warning instead.
Has no effect, kept for compatibility with DNF 4. "dnf4 needs-restarting -r" provides the same functionality as "dnf5 needs-restarting".
Request JSON output format for machine-readable results.

The set of packages whose installation or upgrade suggests a reboot is provided by libdnf5 and is shared with every consumer of that information, not just this command. It contains a built-in list covering the kernel, systemd and other core packages, extended by any names found in *.conf drop-in files in the following directories:

/etc/dnf/suggest-reboot.d/
Local administrator configuration.
/usr/share/dnf5/suggest-reboot.d/
Additions shipped by packages.

Drop-in files can only add to the built-in list, never remove from it. Files with different names are merged. A file in the local directory overrides a file with the same name in the packaged additions directory, so an administrator can replace a package-supplied file by creating one with the same name.

Only files with the .conf extension are read. Each file contains one package name per line. Leading and trailing whitespace is ignored, and empty lines and lines beginning with # are treated as comments. Package names that are not installed are ignored, so a single file may list packages that are not present on the system.

For example, to also suggest a reboot after the NVIDIA driver is updated, create /etc/dnf/suggest-reboot.d/nvidia.conf containing:

# Reboot after the out-of-tree driver is rebuilt
nvidia-driver
kmod-nvidia-open-dkms

The configured packages are honoured both by the default reboot hint and by --services, where services provided by such packages are reported as requiring a reboot rather than a restart.

Note:

The DNF 4 needs-restarting plugin read this configuration from /etc/dnf/plugins/needs-restarting.d/. That location is not used by DNF 5; move any existing files to /etc/dnf/suggest-reboot.d/.

•
dnf5 needs-restarting --json

The command returns a JSON array containing a single object with the reboot hint information. The object contains the following fields:

  • type (string) - Type of output, always "reboot".
  • reboot_required (boolean) - Whether a reboot is required.
  • packages (array of strings) - List of packages that were updated since boot-up.
  • documentation (string) - Link to documentation explaining the reboot requirement.
•
dnf5 needs-restarting --services --json

The command returns a JSON array of objects, each describing a systemd service that needs restarting. Each object contains the following fields:

  • type (string) - Type of output, always "unit".
  • unit (string) - Name of the systemd service.
•
dnf5 needs-restarting --processes --json

The command returns a JSON array of objects, each describing a running process that needs restarting. Each object contains the following fields:

  • type (string) - Type of output, always "process".
  • pid (integer) - Process ID.
  • cmdline (array of strings) - Command line of the process.
  • package (string) - Package providing the executable.

The --json option can be combined with --exclude-services when using --processes to filter out processes managed by systemd services (e.g. dnf5 needs-restarting --processes --exclude-services --json).

For empty results for services or processes, the commands return []. For reboot hints, even if no reboot is recommended, the command returns a JSON array containing a single object with reboot_required set to false, an empty array of packages, and the documentation link.

See AUTHORS.md in dnf5 source distribution.

Contributors to the dnf5 project.

September 26, 2026