Open In App

systemctl: command not found on ubuntu

Last Updated : 12 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

In Ubuntu, while working with the 'systemctl' command, users typically manage system services, view their status, start or stop them, and enable or disable them at system startup. However, encountering the "systemctl: command not found" error suggests that the 'systemctl' utility is not available or accessible in the current environment. This issue commonly arises in 'non-systemd' environments or if the 'systemd' package is not installed on the system. Resolving this error involves either replacing 'systemctl' commands with service commands or ensuring that the 'systemd' package is installed to enable 'systemctl' functionality.

Understanding the "systemctl: command not found" Error

The "systemctl: command not found" error typically occurs when:

  • Your system is not using 'systemd' as its init system.
  • The systemd package, which includes the 'systemctl' utility, is not installed on your system.
Screenshot-(1410)-min
Error

How to Fix "systemctl: command not found"?

Below are the solutions to resolve the “systemctl: command not found” problem in the Ubuntu Operating System.

Solution 1: Replacing systemctl with service command

This solution involves using the service command instead of systemctl to manage services on Ubuntu. The service command provides similar functionality for starting, stopping, and restarting services, making it a viable alternative when systemctl is not available or not working.

Syntax:

sudo service <service-name> <action>

Example:

sudo service nginx restart

Output

Replacing systemctl with service command
Replacing systemctl with the service command

Solution 2: Installing the systemd package

This solution consists of installing the systemd package on Ubuntu using the sudo apt-get install systemd command. Installing systemd provides the necessary tools and utilities, including systemctl, for managing services on the system, and resolving the "systemctl: command not found" issue.

Syntax:

sudo apt-get install <package-name>

Example:

sudo apt-get install systemd

Output

Installing systemd package
Installing systemd package

Once the package is been installed, we can verify the installation by checking the version of the systemd service.

systemd --version
Screenshot-(1415)-min
Verifying Installation

Conclusion

In conclusion, encountering the "systemctl: command not found" error on Ubuntu often indicates a missing or unavailable systemctl utility, typically due to a lack of the systemd package. By either installing systemd or using alternative commands like service, users can effectively manage system services and resolve this issue to ensure smooth system operation.


Next Article
Article Tags :

Similar Reads