The systemctl command not found error usually occurs when you are running a Linux operating system which uses another init system like runit, SystemV etc. SystemV init system is usually used in the older Linux operating systems, mainly in versions of Ubuntu before 15.04. Although, there are some modern Linux operating systems that use init systems other than systemd i.e artix Linux which is based on Arch Linux but uses other init systems like runit, dinit etc instead of systemd.
What’s an init system?
Init system is the first process that runs after your kernel boots up. There are more than one init systems out there for Linux but the most popular one is systemd, and it is used in many of the major Linux operating systems. Systemd is a set of daemons and libraries which controls all the other daemons and libraries e.g. starting or stopping a daemon, enabling or disabling a daemon. A daemon in Linux is equal to a service in Windows which runs in the background.
How you can fix systemctl command not found in Linux distributions:
In order to fix this error, you have two choices.
- Install systemd and replace your current init system with systemd. Since systemctl command not found error comes because you don’t have systemd installed on your system.
- Use the init system your linux distribution has to manage different daemons/services. This solution is for those of you who don’t have systemd installed but don’t want to install systemd on their machine or if systemd is not available in your distribution’s repositories.
1. Install systemd (if not installed):
If you are using a Debian/Ubuntu based operating system, you can type a command to do a search that whether systemd is installed or not.
Type this command if you are using Ubuntu or Debian based operating systems and press enter.
sudo dpkg -l | grep systemd.
For arch linux based distributions, use this command:
pacman -Qs systemd
If you see some text as output of this command, then it means systemd is installed on your system and it might be corrupted.
You then need to reinstall systemd for the systemctl command to work.
To do that type this command in a terminal and press Enter.
sudo apt-get install --reinstall systemd.
This will reinstall systemd with apt package manager that’s used by Debian/Ubuntu based distributions.
For arch linux or its derivatives, use this command:
sudo pacman -S systemd
If you didn’t get any output from the sudo dpkg -l | grep systemd command above, then it means systemd is not installed on your distribution.
In such a scenario, you can either use the init system your distribution has or install systemd.
To install systemd on debian/Ubuntu based distributions, type this command in a terminal and press Enter:
sudo apt-get install systemd
For arch linux, type pacman -S systemd as root user or using sudo.
This will install systemd on your operating system. You will now be able to use the systemctl command without any errors.
2. Use the init system of your distribution:
Another, and preferably the best solution for this error is to use the init system your Linux distribution already has to manage dameons/services.
To see which init system your computer has, you can type this command in a terminal and press enter.
ls -l /sbin/init
The /sbin/init is a symlink to the init system your linux distribution uses. If you see the symlink of /sbin/init to /lib/sysvinit/init , then it means that your distribution uses sysv init system and you will have to use the service command instead of systemctl to manage services or daemons.
The syntax of sysv init system to manage services is also pretty simple:
service [service_name] [action]
You can thus start a service by typing service [service_name] start
If you want to start the bluetooth daemon/service you can type the command:
sudo service bluetooth start
Then to check whether it is running without any errors, you can type the command
sudo service bluetooth status
If you want to restart or stop a service, you can use the commands “service [service-name] restart” and “service [service-name] stop” respectively.
For example, if you want to stop the bluetooth service, you can type:
sudo service bluetooth stop
It is possible that your init system might not be sysvinit either and some other init system. For that, you just need to do a simple Google search on the output of the symlink of /sbin/init. Then you can use the commands that are applicable to the init system your machine has.
Many init systems usually have the same commands as start, stop, restart but the commands to run them are different as sysvinit has service command to start or stop services and the systemd has systemctl command for it.
If the above solutions didn’t work for you, keep following the article as the solution listed below might work for you.
How to fix systemd-resolve command not found?
Another error related to systemctl status command not found is the systemd-resolve command not found. Users can be mistaken that they don’t have systemd installed and that’s why, systemd-resolve is not working. But instead, in versions of systemd 239 and above, the systemd-resolve command has been changed to resolvectl.
You can thus use “resolvectl ” to interact with the systemd-resolve utility in your linux distributions.