
The error systemctl: command not found (or sudo: systemctl: command not found) means the system you're on isn't running systemd, the init system that systemctl belongs to. It usually happens in Docker containers, WSL, Alpine and other lightweight distributions, or on macOS. The fix is either to use the right command for that system, or to enable systemd where it's supported.
Quick answerFind out what your system uses, then use its command:
ps -p 1 -o comm=
systemd: systemd is running, so the problem is yourPATH(see Fix 5).initoropenrc-init: useservice/rc-serviceinstead (Fix 2).runit: usesv(Fix 2).bash,sh,node,pythonetc.: you're in a container with no init system (Fix 3).
Why "systemctl not found" happens
- Docker containers run a single process, not a full init system, so systemd isn't there.
- WSL doesn't start systemd unless you enable it.
- Alpine, Gentoo and Devuan use OpenRC or SysVinit; Void Linux uses runit.
- macOS doesn't use systemd at all. It uses
launchd. - Occasionally systemd is installed but
/usr/binis missing from yourPATH.
Fix 1: WSL (Windows Subsystem for Linux): enable systemd
Current WSL versions support systemd, but it's off by default in some setups. Inside your WSL distribution:
sudo nano /etc/wsl.conf
[boot]
systemd=true
Save the file, then in Windows PowerShell restart WSL:
wsl --shutdown
Open your distro again. systemctl list-units --type=service should now work.
Fix 2: Use the right command for your init system
| Task | systemd | SysVinit / service | OpenRC (Alpine) | runit (Void) |
|---|---|---|---|---|
| Start | systemctl start nginx | service nginx start | rc-service nginx start | sv up nginx |
| Stop | systemctl stop nginx | service nginx stop | rc-service nginx stop | sv down nginx |
| Status | systemctl status nginx | service nginx status | rc-service nginx status | sv status nginx |
| Start at boot | systemctl enable nginx | update-rc.d nginx defaults | rc-update add nginx default | ln -s /etc/sv/nginx /var/service/ |
On Alpine, OpenRC itself may need installing in a minimal image: apk add openrc.
Fix 3: Docker containers: don't use systemctl
Containers are designed to run one main process in the foreground. Don't install systemd in them. Instead:
- Start the program directly as the container's command, for example
CMD ["nginx", "-g", "daemon off;"]. - Restart a service by restarting the container:
docker restart <name>. - If you really need several processes in one container, use a small process manager such as
supervisordors6-overlay.
Need systemd for testing (for example Ansible roles)? Use a systemd-enabled image and run it with the documented privileges, not a regular application container.
Fix 4: macOS: use launchctl or brew services
There's no systemctl on macOS. For services installed with Homebrew:
brew services list
brew services start nginx
brew services restart nginx
For system services, use launchctl (for example sudo launchctl list).
Fix 5: systemd is running but the command isn't found
If ps -p 1 -o comm= prints systemd, check your PATH:
ls -l /usr/bin/systemctl /bin/systemctl
echo $PATH
/usr/bin/systemctl status ssh # call it by full path
If the full path works, add /usr/bin:/bin back to PATH in ~/.bashrc. If the file doesn't exist on a Debian or Ubuntu system, reinstall it with sudo apt install --reinstall systemd.
Frequently asked questions
How do I install systemctl?
systemctl is part of systemd. On Debian or Ubuntu run sudo apt install systemd. But in Docker, Alpine or macOS, installing it won't help. Use that system's own service command instead.
What is the Alpine Linux equivalent of systemctl?
OpenRC: rc-service <name> start|stop|status and rc-update add <name> default to start at boot.
Why does "sudo systemctl" say command not found when systemctl works?
sudo uses its own secure_path. Check it with sudo grep secure_path /etc/sudoers, and make sure it includes /usr/bin.
Does a VPS support systemctl?
Yes. A full KVM VPS running Ubuntu, Debian, AlmaLinux or Rocky boots with systemd, so systemctl works normally. Container-based (OpenVZ/LXC) plans may behave differently.


