keepcalculator

06 Numbers and Powers

Systemctl Command Not Found? Fix It

Card No. 06·55431 · Updated · Standard formula, shown below

If you see “systemctl: command not found,” it usually means you are on a system that does not use systemd as its init system, or systemd is not installed. The fix depends on your operating system: use service or /etc/init.d/ commands on SysV init systems, or install systemd on distributions that support it. This article explains why the error happens, how to check your init system, and what to do on various Linux distributions and WSL.

What Is systemctl and Why Is It Missing?

systemctl is the central management tool for systemd, the init system and service manager used by most modern Linux distributions. It controls services, targets (runlevels), and system state. The error appears when the systemctl binary is not in your PATH or not installed at all. Common reasons include:

  • You are using a distribution that uses SysV init, such as older Debian or Ubuntu releases, or Alpine Linux (which uses OpenRC).
  • You are inside a container or a minimal chroot that lacks systemd.
  • You are using Windows Subsystem for Linux (WSL) version 1, which does not run systemd.
  • systemd is installed but not in your PATH (rare, but possible if you built it manually).

How to Check What Init System You Have

Before trying any fix, confirm which init system your system uses. Run this command in your terminal:

ps -p 1 -o comm=

This prints the name of the process with PID 1 (the first process started by the kernel). If it outputs systemd, then systemd is your init system and systemctl should be present—if not, your PATH may be broken. If it outputs init, openrc, or runit, you are not using systemd.

You can also check if systemd is installed but not running:

which systemctl
ls /usr/bin/systemctl

If the file exists but the command fails, the issue is your PATH environment variable. If the file does not exist, systemd is not installed.

If You Are on a SysV Init or OpenRC System

If your system uses SysV init (common on older Debian/Ubuntu, Slackware, or Gentoo without systemd) or OpenRC (Alpine, Artix), you do not need systemctl. Use the traditional service commands instead:

  • Start a service: service <name> start or /etc/init.d/<name> start
  • Stop a service: service <name> stop
  • Check status: service <name> status
  • Enable at boot: update-rc.d <name> defaults (Debian/Ubuntu) or rc-update add <name> default (OpenRC)

For example, to restart Apache on an old Debian system, you would run service apache2 restart instead of systemctl restart apache2.

If You Are on a systemd Distribution but systemctl Is Missing

Some minimal installations (e.g., Docker containers, Arch Linux base without systemd) might not have systemd installed. On Arch, you can install it with:

pacman -S systemd

On Debian/Ubuntu:

apt install systemd

On Fedora/RHEL/CentOS:

dnf install systemd

After installation, you may need to reboot for systemd to take over as PID 1. However, in a container that does not have systemd as its init, installing the package will not make systemctl work—it needs to run as PID 1. In that case, you should manage services with the container’s native tools.

Special Case: Windows Subsystem for Linux (WSL)

WSL version 1 does not support systemd, so systemctl is not available. WSL 2 does support systemd, but only if you enable it. If you are on WSL 2 and get “systemctl command not found,” you can enable systemd by editing /etc/wsl.conf:

[boot]
systemd=true

Save the file, then restart WSL by running wsl --shutdown in PowerShell and reopening your WSL terminal. After that, systemctl should work. On WSL 1, you cannot use systemd—use service instead.

Common Misconception: systemctl vs. service

Many users think systemctl and service are interchangeable. They are not. service is a wrapper that works with both SysV init scripts and systemd (it translates to systemctl if systemd is present). However, systemctl only works with systemd. If you run systemctl on a non-systemd system, you get the “command not found” error. Conversely, on a systemd system, service still works, but it may not show all the detailed status information that systemctl status provides.

Frequently Asked Questions

Why does systemctl work on one Linux machine but not another?

Because different distributions and versions use different init systems. Most modern mainstream distributions (Ubuntu 15.04+, Fedora, RHEL 7+, Debian 8+) use systemd. Older releases or lightweight distributions (Alpine, Void) use alternatives like OpenRC or runit. Check the documentation for your specific distribution.

Can I install systemctl on Alpine Linux?

Alpine Linux uses OpenRC by default and does not have systemd in its official repositories. You can install systemd from the community repository (apk add systemd), but it is not recommended because it may conflict with OpenRC and is not fully supported. Use rc-service instead.

What is the difference between systemctl and service?

service is a higher-level command that works with both SysV init scripts and systemd. systemctl is the native systemd control tool. On a systemd system, service is a wrapper around systemctl; on a SysV system, it runs the init script directly.

Why does systemctl work in a Docker container?

If your container image is based on a systemd distribution and systemd is installed, systemctl may work, but it often fails because systemd needs to be PID 1 and have access to cgroups. Most containers do not run systemd; they run a single process. In that case, use the container’s native service management or run the service directly.

I get “Failed to connect to bus” when using systemctl. What does that mean?

This error means systemd is installed but the system bus (dbus) is not running, or you are in a chroot/container without systemd running as PID 1. It is different from “command not found.” To fix it, ensure systemd is running (check with ps -p 1) and that dbus is active. In a container, you may need to run with --privileged or use a different service manager.

Can I use systemctl on macOS?

No. macOS uses launchd, not systemd. The equivalent commands are launchctl for managing services and brew services for Homebrew-installed services. systemctl is Linux-specific.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →