How to Install Needrestart on Fedora 44

Install needrestart on Fedora 44 using DNF. Covers configuration, usage modes, systemd automation, troubleshooting, and removal.

UpdatedPublished AuthorJoshua JamesRead time8 minGuide typeFedora

Post-update maintenance gets awkward when Fedora has patched libraries but long-running processes are still using the old copies. Needrestart closes that gap by scanning services, user sessions, kernels, containers, and microcode state after package changes, then showing what needs a restart or reboot. Use the Fedora repository package to install needrestart on Fedora 44 Linux, then decide whether it should only report issues, prompt interactively, or restart eligible services automatically.

Fedora packages needrestart as a normal DNF package and also ships an enabled DNF plugin that can run needrestart after package transactions. The upstream needrestart GitHub project remains useful for release notes and deeper configuration details, while the Fedora package keeps the tool integrated with the system package workflow.

Install Needrestart on Fedora Linux

Needrestart is available from Fedora’s default repositories. Refresh package metadata and apply pending updates before installing it, especially on servers where a kernel or service update may already be waiting:

sudo dnf upgrade --refresh

These commands use sudo for package installation, systemd units, and root-owned configuration files. If your account cannot run administrative commands yet, follow the guide to add a user to sudoers on Fedora before continuing.

Install the package with DNF:

sudo dnf install needrestart

DNF installs needrestart along with the Perl and Debconf components it uses for process scanning and user-interface handling. Current Fedora package metadata also includes a DNF plugin configuration file at /etc/dnf/plugins/needrestart.conf.

Verify the installed command and version:

command -v needrestart
needrestart --version | head -n 1

Expected output uses the Fedora binary path:

/usr/bin/needrestart
needrestart 3.8 - Restart daemons after library updates.

Older examples sometimes point systemd units at /usr/sbin/needrestart. Fedora installs the executable at /usr/bin/needrestart, so use that path in custom units and scripts.

Use Needrestart on Fedora Linux

Needrestart supports a few different operating modes. The safest first run is list-only mode, because it shows restart recommendations without changing any services.

List Restart Recommendations with Needrestart

Use restart mode l to list affected services, sessions, containers, and kernel state without restarting anything:

sudo needrestart -r l

The -r l option means list-only restart mode. Do not confuse it with the separate -l option, which limits needrestart to obsolete-library checks only.

When needrestart finds work to do, output can include sections such as Pending kernel upgrade!, Services to be restarted:, Service restarts being deferred:, and User sessions running outdated binaries:. Lines under Services to be restarted: show restart commands that needrestart can run or suggest, while deferred services are intentionally held back by default safety rules.

Understand User Sessions Running Outdated Binaries

User sessions running outdated binaries means a login session, desktop session, or user service still has one or more processes mapped to older files after an update. Needrestart cannot refresh those processes by restarting a system service; the normal fix is to log out and back in, restart the affected user service, or disconnect and reconnect an SSH session.

This message is common after updates to shells, desktop libraries, browsers, developer tools, and long-running terminal sessions. It does not mean the update failed. It means the updated files are on disk, but at least one process from that user session is still running the old code in memory.

Run Needrestart Interactively

Run needrestart without a restart-mode flag when you want an interactive prompt for eligible service restarts:

sudo needrestart

Interactive mode is useful on systems where you want to review restart candidates one by one. It is usually a better fit for servers than automatic mode, because database, web, and remote-access services may briefly interrupt active work when restarted.

Use Needrestart Batch Mode

Batch mode prints parseable records instead of interactive prompts, which makes it useful for scripts and monitoring:

sudo needrestart -b

Batch output uses record names such as NEEDRESTART-KSTA for kernel status, NEEDRESTART-SVC for services, and NEEDRESTART-SESS for user sessions. Needrestart documents the kernel status values as 0 for unknown or detection failure, 1 for no pending kernel upgrade, 2 for an ABI-compatible kernel upgrade, and 3 for a versioned kernel upgrade that needs a reboot.

Restart Services Automatically with Needrestart

Automatic restart mode restarts eligible services without prompting:

sudo needrestart -r a

Automatic mode can restart services immediately. Use it only after you have reviewed list-only output and confirmed that brief service interruptions are acceptable for the system you are maintaining.

Run Component-Specific Needrestart Checks

Needrestart can restrict a run to one check type. Use these when you only need kernel, library, or microcode status:

sudo needrestart -k
sudo needrestart -l
sudo needrestart -w
  • -k checks whether the running kernel matches the expected installed kernel.
  • -l checks obsolete shared libraries only.
  • -w checks CPU microcode status when that check is available.

For normal post-update maintenance, sudo needrestart -r l is the clearer starting point because it keeps the full report but prevents service restarts.

Configure Needrestart on Fedora Linux

Needrestart reads its main configuration from /etc/needrestart/needrestart.conf. Fedora also loads custom .conf snippets from /etc/needrestart/conf.d/, which lets you keep local policy separate from the packaged file.

Open the main configuration file when you want to review every documented option:

sudo nano /etc/needrestart/needrestart.conf

For local changes, prefer a drop-in file under /etc/needrestart/conf.d/. Needrestart uses Perl syntax, so syntax errors can stop the tool from running cleanly.

Set the Default Needrestart Restart Mode

The restart setting controls the default restart behavior. Create a drop-in that keeps normal runs in list-only mode:

printf '%s\n' "\$nrconf{restart} = 'l';" | sudo tee /etc/needrestart/conf.d/restart-mode.conf > /dev/null

Supported restart modes are l for list only, i for interactive prompts, and a for automatic restarts. List-only mode is the safest default on production servers because it reports stale services without restarting them during an unattended run.

Adjust Needrestart Verbosity

Use the verbosity setting when you need quieter logs or more detail while troubleshooting scans:

printf '%s\n' "\$nrconf{verbosity} = 2;" | sudo tee /etc/needrestart/conf.d/verbosity.conf > /dev/null

A value of 0 is quiet, 1 is normal, and 2 is verbose. Use verbose mode temporarily when you need to see more detail about what needrestart scans.

Override Needrestart Service Restart Behavior

The override_rc hash controls whether matching services are selected for restart. Fedora’s default configuration already excludes sensitive services such as display managers, DBus, and networking-related units. Add local overrides with a drop-in so you extend the packaged policy instead of replacing it:

printf '%s\n' "\$nrconf{override_rc}->{qr(^postgresql)} = 0;" | sudo tee /etc/needrestart/conf.d/postgresql-override.conf > /dev/null

The pattern uses Perl regular expressions. For example, qr(^postgresql) matches service names that start with postgresql. The value 0 means needrestart should not select matching services for restart.

Exclude Binaries from Needrestart Scans

The $nrconf{blacklist} array prevents needrestart from flagging specific binaries. This is useful for helper processes that are not service daemons and do not need restart tracking. Add entries with push so Fedora’s packaged blacklist remains intact:

printf '%s\n' "push(@{\$nrconf{blacklist}}, qr(^/opt/myapp/worker$));" | sudo tee /etc/needrestart/conf.d/myapp-blacklist.conf > /dev/null

Each entry is a Perl regular expression that matches the full binary path.

Disable Needrestart Kernel or Microcode Hints

Disable kernel or CPU microcode hints only when another maintenance process already tracks those restarts for you:

printf '%s\n' "\$nrconf{kernelhints} = 0;" "\$nrconf{ucodehints} = 0;" | sudo tee /etc/needrestart/conf.d/no-kernel-microcode-hints.conf > /dev/null

Setting either option to 0 disables that check. The packaged configuration also documents -1 for kernel hints when you want hints sent to standard error instead of the main interactive output.

Disable Needrestart User Session Notifications

Needrestart can notify users when their sessions are running outdated binaries. Disable notifications when the report is enough and desktop alerts would be noisy:

printf '%s\n' "\$nrconf{sendnotify} = 0;" | sudo tee /etc/needrestart/conf.d/no-user-notify.conf > /dev/null

This setting stops user notification scripts from running. It does not hide user sessions from needrestart output, because reporting and notifying are separate behaviors.

Validate Needrestart Configuration Syntax

Check the main configuration file syntax first:

perl -c /etc/needrestart/needrestart.conf

A clean configuration reports:

/etc/needrestart/needrestart.conf syntax OK

Then run a list-only scan to make needrestart evaluate any /etc/needrestart/conf.d/*.conf drop-ins. A bad drop-in produces an Error parsing message here even when the main file passes perl -c:

sudo needrestart -r l

Automate Needrestart on Fedora Linux

Fedora’s needrestart package already integrates with DNF. You only need a custom systemd timer if you want independent scheduled reports beyond DNF’s transaction hook.

Check the Needrestart DNF Plugin

The Fedora package installs a DNF plugin and enables it by default. Confirm the plugin configuration with:

cat /etc/dnf/plugins/needrestart.conf

Expected output:

[main]
enabled=1

When enabled, the plugin calls needrestart after DNF install or remove transactions. If a transaction runs with automatic yes confirmation, needrestart runs non-interactively and falls back to list-only behavior instead of opening prompts. For scheduled update policy, pair this with DNF Automatic on Fedora rather than creating a second package updater.

Create an Optional Needrestart systemd Service

Create a small oneshot service when you want a periodic list-only report in the journal:

sudo nano /etc/systemd/system/needrestart-check.service

Use Fedora’s verified binary path in the unit:

[Unit]
Description=Check for services needing restart
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/bin/needrestart -r l

[Install]
WantedBy=multi-user.target

Create an Optional Needrestart systemd Timer

Create the matching timer unit:

sudo nano /etc/systemd/system/needrestart-check.timer

A daily timer is enough for most monitoring use cases:

[Unit]
Description=Run needrestart check periodically

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target

Enable the timer after both units are in place:

sudo systemctl daemon-reload
sudo systemctl enable --now needrestart-check.timer

Confirm systemd accepted and started the timer:

systemctl is-enabled needrestart-check.timer
systemctl is-active needrestart-check.timer

Expected output:

enabled
active

Run the check manually and inspect the latest journal entries:

sudo systemctl start needrestart-check.service
sudo journalctl -u needrestart-check.service --no-pager -n 50

Troubleshoot Needrestart on Fedora Linux

Needrestart Reports User Sessions Running Outdated Binaries

This message is expected after package updates that replace libraries or programs used by an active login. Use list-only mode to see which sessions are affected:

sudo needrestart -r l

If the affected session is your current SSH connection, disconnect and reconnect after your maintenance window. If it is a desktop login, log out and back in. If the line names a user service, restart that user service or sign out the affected account.

Needrestart Shows a Pending Kernel Upgrade

A pending kernel message means Fedora has installed a newer kernel than the one currently running. Needrestart cannot load the new kernel for you:

sudo needrestart -k

Schedule a reboot when the system can tolerate it. If kernel package names, headers, or module builds are part of your maintenance task, the guide to install Linux kernel headers on Fedora explains the related kernel-devel and kernel-headers split.

Needrestart Cannot Find the Command in /usr/sbin

On Fedora, the needrestart package owns /usr/bin/needrestart. If an older script or unit file uses /usr/sbin/needrestart, update it to the Fedora path and verify the command again:

command -v needrestart
rpm -qf /usr/bin/needrestart

The first command should print /usr/bin/needrestart. The second command should return the installed Fedora package name for that path.

Service Still Appears After Restarting

If a service remains in needrestart output after a restart, replace service-name.service with the exact unit from the report and check whether related child processes are still active:

sudo systemctl status service-name.service --no-pager
sudo systemctl restart service-name.service
sudo needrestart -r l

Services with worker processes sometimes need a full stop and start instead of a restart. For high-traffic services, do that inside a maintenance window so active connections are not interrupted unexpectedly.

Remove Needrestart from Fedora Linux

Remove any custom timer you created before removing the package, because the service unit depends on the needrestart binary:

sudo systemctl disable --now needrestart-check.timer
sudo rm -f /etc/systemd/system/needrestart-check.service
sudo rm -f /etc/systemd/system/needrestart-check.timer
sudo systemctl daemon-reload

Then remove needrestart with DNF:

sudo dnf remove needrestart

Review the transaction before confirming. DNF removes needrestart and may also remove automatically installed dependencies that no longer have another package keeping them installed. Package-owned files such as /etc/dnf/plugins/needrestart.conf are removed with the package.

If you created local drop-ins under /etc/needrestart/conf.d/, review them before deleting the remaining configuration directory:

The cleanup command deletes local needrestart configuration files. Keep a copy first if those files document restart policy you may need later.

sudo rm -rf /etc/needrestart/

Confirm the package is gone:

rpm -q --quiet needrestart || echo "needrestart not installed"

Expected output:

needrestart not installed

Conclusion

Needrestart is ready to show which Fedora services, sessions, and kernel state need attention after updates. Start with list-only output, use automatic restarts only on systems where brief interruptions are acceptable, and let Fedora’s DNF plugin handle normal post-transaction checks. For broader package work, keep the DNF5 install examples on Fedora handy.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: