Horje
systemctl: command not found on ubuntu

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.

Error: systemctl: command not found

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

FAQs on systemctl: command not found on ubuntu

What does the “systemctl: command not found” error mean?

This error indicates that the systemctl utility, which is used for managing system services, is not available on your system. It usually means that your system is not using systemd or the systemd package is not installed.

How can I check if my system is using systemd?

You can check if your system is using systemd by running the command ps -p 1 -o comm=. If the output is systemd, then your system is using systemd.

What are the alternatives to systemctl if it is not available?

If systemctl is not available, you can use the service command as an alternative to manage system services. For example, sudo service <service-name> <action>.

How do I install systemd on Ubuntu?

To install systemd on Ubuntu, you can use the following command: sudo apt-get install systemd. This will install systemd and the systemctl utility.

Why does Ubuntu not have systemctl installed by default?

Some versions of Ubuntu, especially those designed for containers or certain minimal installations, might not have systemd installed by default. These versions often use other init systems like Upstart or SysVinit, which do not include systemctl.

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




Reffered: https://www.geeksforgeeks.org


Linux Unix

Related
How to Fix - rm: Cannot Remove Directory/: Permission Denied How to Fix - rm: Cannot Remove Directory/: Permission Denied
How to Use Google Drive in Linux How to Use Google Drive in Linux
Parrot Operating System Parrot Operating System
How to generate SSH Key Fingerprint in Linux? How to generate SSH Key Fingerprint in Linux?
How To Fix Bash Syntax Error Near Unexpected Token In Linux How To Fix Bash Syntax Error Near Unexpected Token In Linux

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
19