How to Fix systemctl Command Not Found Error in Linux

Estimated reading: 3 minutes 337 views

What is systemctl Command

systemctl is a command-line utility in Linux that controls system’s services. It is an essential tool that enables system administrators to manage the system’s services and resources. The systemctl command allows users to begin, end, enable, disable, and restart services on the Linux system.

Linux has several different commands to perform different tasks. However, sometimes users encounter errors while running commands. One of the common errors is “systemctl command not found”. This error occurs when the system finds the systemctl command missing. This article covers the systemctl command not found error in detail.

Here is list of possible reasons due to which it occurs:

  • The systemctl package is not installed
  • The PATH environment variable is not set correctly
  • The systemctl command is not executable
  • The system is not running a systemd-based init system

How to Fix the “systemctl Command Not Found” Error

Method 1: Install the systemctl Package

If the systemctl package is not installed on the system, the first step is to install it. You can install the systemctl package using Linux package manager.

Installing the systemd package may solve the problem, but it is not a guaranteed solution. It is necessary to first check whether the systemd package is already installed on your system.

Run following command to check if systemctl packages is installed or not:

dpkg -l | grep systemd

In case if the packages are not installed, we can install it using the below steps.

On Centos systems use the command:

yum install systemd
On Ubuntu and Debian systems use the command:
apt install systemd
If you are still encountering an error despite having installed systemd, you may want to consider reinstalling it using the following command.
apt install --reinstall systemd

By installing the systemd utility, this should resolve the issue.

Method 2:  Make the systemctl Command Executable

If the systemctl command is not executable, make it executable using chmod. Use below command to make systemctl command executable:

chmod +x /usr/bin/systemctl

Method 3: Replacing systemctl with the service Command

An easy solution to fix the “systemctl: command not found” error is to use the service command in place of systemctl. The service command can be used to run the System V init script

In case you don’t want to install systemd utility, then this fix is a simple and effective solution. By using the service command, you can manage system services with ease, without needing to use the systemctl command.

Note that the service command may not be available for all services, and some services may require the use of systemctl.

Following syntax will be followed by service command:

service [service_name] [action]

For example, to run same command with the ufw service use:

service ufw start
service ufw status

Conclusion

The “systemctl Command Not Found” error is a common error in Linux. It can be caused by several reasons, including the systemctl package not being installed, the PATH environment variable not being set correctly, the systemctl command not being executable, and the system not running a systemd-based init system. The use of service command in place of the systemctl command we can easily fix this error. Good luck!

Share this Doc

How to Fix systemctl Command Not Found Error in Linux

Or copy link

CONTENTS