needrestart command not found

In this troubleshooting guide we learn how to fix needrestart command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

needrestart: command not found

or when using sudo you get the following error message

sudo: needrestart: command not found

Solutions to needrestart: command not found

How To Fix needrestart: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu needrestart is provided by needrestart package.

needrestart is:

needrestart checks which daemons need to be restarted after library upgrades. It is inspired by checkrestart from the debian-goodies package.

Features:

  • supports (but does not require) systemd
  • binary blacklisting (i.e. display managers)
  • tries to detect required restarts of interpreter based daemons (supports Java, Perl, Python, Ruby)
  • tries to detect required restarts of containers (docker, LXC)
  • tries to detect pending kernel upgrades
  • tries to detect pending microcode upgrades for Intel CPUs
  • could be used as nagios check_command
  • fully integrated into apt/dpkg using hooks

To fix this problem, we can install more using the command below.

sudo apt-get -y install needrestart

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install needrestart.

sudo apt -y install needrestart

Or if you have aptitude installed you can use the following command.

sudo aptitude install needrestart

Summary

In this tutorial we learn how to fix needrestart command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.