An easy fix to solve the issue using the’systemctl command, and the introduction of some effective alternatives to it
systemctl as a vital tool in this part of the Linux ecosystem, it’s quite common to run into a “systemctl: command not found” error when trying to execute the
systemctl command. It may not happen for all distributions of Linux however, you could likely encounter this issue if you’re using an earlier version of Linux distribution that does not provide support for systemctl.
The issue that you are experiencing is not uncommon and is easily fixable. Therefore, don’t worry about it and simply read the entire guide to discover a simple and simple solution.
We’ll try to figure out the issue first, and then solve it.
Table of Contents
the systemctl and
Since the error has an underlying reference to
systemctl command It is recommended to understand the fundamentals of this command in order to comprehend the solution to this issue more clearly.
systemctl is a command-line tool Linux provides, and can be used to control and monitor another command-line tool called ‘
systemd‘. It also monitors and controls the system manager, as well as systemd, which is the
The general syntax:
systemctl"option" name systemctl [option] [name
systemd is a collection of libraries, daemons and utilities that control the software that runs during the initial boot of your system.
systemd can also perform the essential task of creating a journal for the system’s activities.
This program functions as the central management tool for the majority, if not all of the Operating Systems based on Linux.
The root cause of the error
The most likely cause of this error could be that you are running an earlier version of Linux distribution. A lot of older versions utilize SysV init instead of
SysV Init rather than systemd.
the systemd utility.
systemd utility is not present in previous Linux versions because it’s an newest addition to the list of utilities offered by Linux. systemctl can function and monitor the systemd utility, but it is not compatible with previous configurations such as SysV Init and Upstart.
If you don’t have
systemd and this error is normal. It’s as easy and easy as that.
This error could be encountered in the following manner.
Gaurav@ubuntu:$ sudo systemctl begin ufw [sudopassword for gaurav: sudo systemctl: command cannot be found for gaurav@ubuntu.
We tried to launch with the Ubuntu Fire Wall (
UFW) by using the
systemctl command, but encountered an error message that reads “systemctl: command not found” error.
What do you do now in the event that you don’t want to switch the current Linux distribution that is running another central management tool that is not
the systemd? We have a simple solution to help you to continue using the current Linux distribution and repair your issue within a matter of minutes.
Let’s observe the solution right now.
Repairing “systemctl: command not found” error
Let us now examine the solution to the issue after having analyzed the root cause and the fundamental facts regarding the issue.
Solution 1: Replace
the systemctl by
the service command
An easy fix for the issue is to make use of service command
command service option instead of using the error-causing
the systemctl command.
service command assists to run the
SystemV init script, which is utilized by older Linux distributions. If you don’t want installing systemd as a
systemd tool to your computer, then this solution is sure to be a good choice for you.
You can restart, start or shut down any service and daemons running on your Linux distribution by using service commands.
command service. command.
It is important to note that the
command service command as well as the
systemctl command work in the same manner, the only difference here is that the commands are compatible with tools that ensure the smooth operation on your computer.
Let’s look at how to use the
command of the service command in a diagram.
sudo service [service_name] [action]
In the syntax above the space [action] could include actions such as the start, stop or restart, as well as status.
The same command will be used to begin the
UFW service by using service command.
command service command.
sudo service ufw start
gaurav@ubuntu:~$ sudo service ufw start gaurav@ubuntu:~$ sudo service ufw status * ufw.service - Uncomplicated firewall Loaded: loaded (/lib/systemd/system/ufw.service; enabled; vendor preset: enab Active: active (exited) since Mon 2020-09-28 11:22:34 IST; 1h 5min ago Docs: man:ufw(8) Process: 333 ExecStart=/lib/ufw/ufw-init start quiet (code=exited, status=0/SU Main PID: 333 (code=exited, status=0/SUCCESS) Sep 28 11:22:34 ubuntu systemd: Started Uncomplicated firewall. Warn: Journal has been rotated since the unit was first started. Log output is not compatible.
In this case is where it is the
service command is utilized in place of
systemctl command, and it worked perfectly.
Let’s look at another illustration that illustrates this
command service command to gain a an understanding of the service command.
sudo service apache2 start
gaurav@ubuntu:~$ sudo service apache2 status * apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: Drop-In: /lib/systemd/system/apache2.service.d +-apache2-systemd.conf Active: active (running) since Mon 2020-09-28 11:22:47 IST; 1h 16min ago Process: 1172 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCE Main PID: 1248 (apache2) Tasks: 55 (limit: 4456) CGroup: /system.slice/apache2.service +-1248 /usr/sbin/apache2 -k start +-1249 /usr/sbin/apache2 -k start +-1250 /usr/sbin/apache2 -k start Sep 28 11:22:43 ubuntu systemd: Starting The Apache HTTP Server... Sep 28 11:22:47 ubuntu apachectl: AH00112: Warning: DocumentRoot [/var/www Sep 28 11:22:47 ubuntu apachectl: AH00558: apache2: Could not reliably det Sep 28 11:22:47 ubuntu systemd: Started The Apache HTTP Server. gaurav@ubuntu:~$
We’ve utilized to use the
service command to begin the apache2 program. The
option status option of the
service command will show what the status is of the server. We will be able to determine whether the service is operating or dead (inactive).
We can now apply stop as a
stop action to stop the apache2 server by using service commands.
command service. command.
gaurav@ubuntu:~$ sudo service apache2 stop gaurav@ubuntu:~$ sudo service apache2 status lines 1--1...skipping... * apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d +-apache2-systemd.conf Active: inactive (dead) since Mon 2020-09-28 12:42:06 IST; 1s ago Process: 4928 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS) Process: 1172 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 1248 (code=exited, status=0/SUCCESS) Sep 28 11:22:43 ubuntu systemd: Starting The Apache HTTP Server... Sep 28 11:22:47 ubuntu apachectl: AH00112: Warning: DocumentRoot [/var/www/html] does not exist Sep 28 11:22:47 ubuntu apachectl: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'S' on Sep 28 11:22:47 Ubuntu Systemd: Begin to Start The Apache HTTP Server.
Based on the specific examples given in the previous paragraphs we can conclude that we could use this option instead of
systemctl command to manage the other daemons as well as services that are part of the Linux distribution.
2. Verifying for
the systemd package
Sometimes, it could be the case that an
systemd package installation can solve the issue. The first step is to verify the status of installation for systemd.
systemd package on your system.
Follow the below command to verify the installation for your particular system.
sudo dpkg -l | grep systemd
In the event that
the systemd utilty is installed, you will see the same output as below.
Gaurav@ubuntu:$ sudo dpkg grep systemd [sudo] for password for gaurav: ii dbus user-session 1.12.2-1ubuntu1.2 amd64 simple messaging system that is interprocess (systemd user integration) II libnss-systemd:amd64 237-3ubuntu10.42 amd64 nss module that provides dynamic group and user name resolution ii libpam systemd:amd64 237-3ubuntu10.42 amd64 service and system manager PAM module ii libsystemd0 :amd64 237-3ubuntu10.42 Amd64 Systemd Utility Library ii libsystemd0 :i386 237-3ubuntu10.42 I386 Systemd Utility Library ii Networkd Dispatcher 1.7-0ubuntu3.3 All Dispatcher services for networkd-connected status changes in the system 234-1build1 Python 3 amd64 Python 3 bindings to systemd II systemd 237-3ubuntu10.42 amd64 System and Service Manager II systemd-sysv 237-3ubuntu10.42 amd64 system and service manager SysV links gaurav@ubuntu$
If you see an error similar to this is a sign you have
the systemd is running on your system.
In the event that it’s not yet installed, set it up it using the following method.
sudo apt-get update
sudo the apt-get installer systemd
If it’s installed but it is still failing Try installing it again with this command.
sudo apt-get install and reinstall systemd
This solution will resolve your issue through the installation of this
We learned how to solve the issue of “systemctl: command not found” in this tutorial. It is safe to conclude to use this
command service option instead of the
systemctl command is a great idea and solves the issue efficiently. It is easy to utilize this
command service command once we have mastered the examples illustrated within the instructional.