Linux is the only other viable operating system option right now if you don’t want to use Windows or macOS. The OS is lightweight and runs on just about anything from a powerful computer to a small credit card-sized one.
However, that doesn’t mean it’s problem-free. In this article, we’re looking at the “sudo: systemctl: command not found” error and figuring out how to fix the problem.
Why does this happen?
Systemctl is a command-line tool used to monitor and control systemd in addition to controlling the system manager. This error is mainly caused by an older version of Linux, which uses the SysV init tool instead of systemd.
How to fix this?
Here are a few simple solutions you can try out.
The first thing you should do is try and install systemd. You can do this by using the following command.
sudo apt-get install systemd
Once the installation is done, try running the systemctl command again to see if that solves your problem.
Also read: How to run a Cron Job every 15 minutes?
Use the service command
Another simple fix for the problem is to replace the systemctl command with the service command instead. The service command runs the SystemV init script used by older Linux distros.
Similar to systemctl, the service command can start, restart or stop any service running on your machine. Here’s the general syntax
service [service name] [action]
Locate the systemd package
Another possible reason for systemctl not working could be because the package is installed elsewhere and is not added to the $PATH variable. You can check whether or not systemd is installed by using the following command.
sudo dpkg -L systemd
If the package is installed, you can update your $PATH variable to include its path, and you’ll be good to go.
Also read: What does ./ mean in Linux?