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_suggestedadvisory - any package configured in the
suggest-reboot.ddirectories (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-restartingexits 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,--processesoption, 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
.confextension 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_requiredset tofalse, an empty array ofpackages, 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 π
β Copyright β
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
- arch rolling: dnf5 5.4.6.0-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms