DNF5-NEEDS-RESTARTING(8)

πŸ’… dnf5-needs-restarting β€” the "do I need to reboot" bestie

okay so this is the dnf5-needs-restarting man page from the dnf5 manual, and honestly? it's such a useful little icon. let me walk you through it fr fr 🫢


✨ NAME ✨

dnf5-needs-restarting β€” the Needs-restarting Command. yeah that's it, that's the name, she's simple and she's iconic πŸŽ€


🌸 SYNOPSIS 🌸

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

πŸ¦‹ DESCRIPTION πŸ¦‹

so bestie, here's the vibe: needs-restarting figures out whether your system should be rebooted so that allll the changes from package installations and upgrades actually get fully applied. no cap, that's the whole point.

if you run dnf5 needs-restarting with no options at all, it reports whether any important packages got installed or upgraded since boot. and like, what counts as "important"? good question, here's the list:

  • the kernel πŸ’€
  • systemd
  • each package listed here: <https://access.redhat.com/solutions/27943>
  • any package marked with a reboot_suggested advisory
  • any package configured in the suggest-reboot.d directories (described below, don't worry, we get there πŸ‘‡)

Now the exit codes, because these matter and the vibes would be off if I skipped them:

needs-restarting exits with code 1 if a reboot is recommended β€” OR, when you invoked it with --services, if any systemd service needs restarting. If no action is recommended, it exits with code 0. periodt.

πŸ’– OPTIONS πŸ’–

  • -p, --processes β€” lists the processes that need restarting. the logic is: if the package providing the executable that's running (or any of its dependencies) has been updated since the process started, then restarting that process gets recommended. it's giving "your binary moved on without you" energy 😭
  • -e, --exclude-services β€” this one ONLY makes sense with the -p, --processes option, and what it does is filter out any processes that are handled by systemd services. so like, systemd's got those, we don't need them in the list πŸ’…
  • -s, --services β€” lists the systemd services that need restarting. same idea as processes: if the package providing the service (or any of its dependencies) has been updated since the service started, restarting that service gets recommended. heads up though β€” this approach is quite aggressive, like it'll recommend a restart even when one may not be strictly necessary 🫠. also, services defined by core packages whose update requires a reboot (same set the reboot hint checks, iykyk) are not recommended for restart; instead they're listed on standard error with a warning. so check your stderr bestie, don't ignore her.
  • -r, --reboothint β€” has no effect, it's kept purely for compatibility with DNF 4. "dnf4 needs-restarting -r" provides the same functionality as "dnf5 needs-restarting". so it's a legacy queen, we keep her around out of respect πŸ‘‘
  • --json β€” requests JSON output format for machine-readable results. for when a script is the one asking the questions πŸ€–βœ¨

🧚 CONFIGURATION 🧚

okay this section is lowkey the most interesting one, stay with me.

the set of packages whose installation or upgrade suggests a reboot is provided by libdnf5, and it's shared with every consumer of that information β€” not just this command. like, she's communal property, we all share her 🌈.

it contains a built-in list covering the kernel, systemd and other core packages, and it gets extended by any names found in *.conf drop-in files in these directories:

  • /etc/dnf/suggest-reboot.d/ β€” local administrator configuration. this is YOUR house, your rules πŸ’œ
  • /usr/share/dnf5/suggest-reboot.d/ β€” additions shipped by packages. this is the packagers' house 🏠

Rules of the drop-in game:

  • Drop-in files can only add to the built-in list, never remove from it. no takebacksies πŸ™…
  • 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 just creating one with the same name. that's the loophole, use it wisely πŸŽ€
  • Only files with the .conf extension are read. anything else? ignored, not invited to the party.
  • 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. clean it up, comment it up, it's fine.
  • Package names that are not installed are ignored, so a single file may list packages that aren't even present on the system. super convenient, no errors, no drama ✨

Example time, because this one's actually cute. 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

and 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. two moods, one config πŸ¦‹

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 β€” so move any existing files to /etc/dnf/suggest-reboot.d/. don't get caught out, bestie 😭

πŸŽ€ JSON OUTPUT πŸŽ€

πŸ’… dnf5 needs-restarting --json

the command returns a JSON array containing a single object with the reboot hint information. that object contains these 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

returns a JSON array of objects, each one describing a systemd service that needs restarting. each object contains:

  • type (string) β€” Type of output, always "unit".
  • unit (string) β€” Name of the systemd service.

πŸ’… dnf5 needs-restarting --processes --json

returns a JSON array of objects, each one describing a running process that needs restarting. each object contains:

  • 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.

and here's a combo move for you: the --json option can be combined with --exclude-services when using --processes to filter out processes managed by systemd services. like this:

dnf5 needs-restarting --processes --exclude-services --json

see? slay πŸ”₯

Empty results, because edge cases are still cases:

  • for services or processes, empty results give you [].
  • 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. she always shows up, even when there's nothing to report 🫢

πŸ‘‘ Author πŸ‘‘

See AUTHORS.md in dnf5 source distribution. the legends are documented, go pay respects πŸ’œ


Contributors to the dnf5 project. 🫑


okay that's the whole thing!! this page is dated Oct 17, 2026, from the dnf5 manual, page DNF5-NEEDS-RESTARTING(8) β€” and honestly? she ate. now go reboot your system, or don't, that's literally what this command is for πŸ’…βœ¨πŸŒˆ

πŸ“¦ where this page comes from