- The systemctl package is not correctly installed.
- The system isn’t running a systemd-based init system on Linux.
- The PATH environment variable is not properly set.
Fix: Systemctl Command Not Found Error on Linux
Try these below troubleshooting strategies to fix the systemctl command not found error on Linux system. Make sure to pay attention to each and every solution as one missed step can’t help to fix the problem.
Fix 1: Install the Systemctl Package
The first thing you have to do is install the systemctl package on your Linux operating system. You can easily install the systemctl package by using Linux package manager. By installing the systemd package, you may easily resolve the problem, however it’s not a guaranteed solution. However, make sure to check whether the systemd package is already installed on your Linux system.
Run following command to check whether the systemctl packages is installed or not on your Linux system:
sudo dpkg -l | grep systemd
In case if the systemd package is not correctly installed on your Linux system, you will have to install it by using the below mentioned steps. For instance, to install it on Ubuntu and Debian-based systems, then follow the below command to install the systemctl package.
First update packages:
sudo apt update
Run below command to install systemd:
sudo apt install systemd
On Red Hat-based systems use command:
sudo yum install systemd
In case if you are still encountering a command error despite having Installed systemd, you can try to reinstall the systemctl package by following the below commands.
sudo apt install –reinstall systemd
Fix 2: Check the PATH Environment Variable
The other most common reason why the systemctl command not found error on Linux is the incorrect set of PATH Environment variables. However, if the PATH environment variable is not set correctly, the Linux system can’t find the systemctl command. Well, you can easily check the PATH environment variable by running the following command.
echo $PATH
The output should contain the above path to the directory where the systemctl command is located. If it’s not visible, you may easily add the directory to the PATH environment variable by following the below command:
export PATH=$PATH:/usr/bin/systemctl
Fix 3: Check the Init System
One of the common reasons why systemctl command is not working, so if your system is not running a systemd-based init system on Linux, you may experience the “systemctl Command Not Found” error. Make sure to check whether your Linux system is running a systemd-based init system. You can easily check this by running the below command:
ps -p 1 -o comm=
If the output is “systemd”, your Linux system is running a systemd-based init system. But if the output is not “systemd”, you will have to switch to a systemd-based init system to access the systemctl command on your Linux system.
Conclusion
The “systemctl Command Not Found” error is a common error in Linux operating system. Generally, it can be caused by numerous reasons, including the systemctl package not being installed, the PATH environment variable not being correctly set, and the system not running a systemd-based init system. Fortunately, you can easily fix the error by attempting the effective solutions we have mentioned in this article. Make sure to follow each steps carefully on your Linux system. We hope that this guide helps you in fixing the error you are facing on Linux.