Skip to content

/errors/systemd/failed-to-start-unit-not-found

Failed to start nginx.service: Unit nginx.service not found.

The commands on this page have not been executed by our verification runner yet.updated
tool
systemd
exit code
5
versions
systemd 2xx
os
linux

Failed to start nginx.service: Unit nginx.service not found. means systemd has no unit by that name loaded: there is no nginx.service file in any directory systemd searches, or it was added after systemd last read its configuration. Check the name with systemctl list-unit-files 'nginx*', install the package that provides it, or run systemctl daemon-reload after creating the file. systemctl exits with status 5, the LSB code for "program is not installed" that systemctl returns for an unknown unit.

Where the message comes from

The text after the colon is the D-Bus error that the service manager returns (Unit %s not found. in src/core/dbus-unit.c); systemctl prefixes the verb and the unit name. Other verbs print the same pattern:

text
Failed to start nginx.service: Unit nginx.service not found.
Failed to restart php-fpm.service: Unit php-fpm.service not found.
Failed to stop docker.service: Unit docker.service not found.

systemctl status NAME reports the same condition as Unit NAME could not be found.

Find the right name

bash
systemctl list-unit-files 'nginx*'
systemctl list-unit-files --type=service | grep -i php
systemctl list-units --all 'ssh*'

Service names differ between distributions: apache2 (Debian, Ubuntu) vs httpd (Fedora, RHEL), ssh vs sshd, versioned names such as php8.3-fpm or postgresql@16-main.

A unit file you just created

systemd reads unit files at boot and on daemon-reload. A file copied into /etc/systemd/system/ is not visible until then:

bash
sudo cp myapp.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now myapp.service

Custom system units belong in /etc/systemd/system/. Files shipped by packages live in /usr/lib/systemd/system/ (or /lib/systemd/system/). The suffix must match the unit type (.service, .timer, .socket).

System or user unit

Units in ~/.config/systemd/user/ belong to the per-user service manager. Manage them without sudo and with --user:

bash
systemctl --user daemon-reload
systemctl --user start myapp.service

sudo systemctl start myapp.service looks only at system units and fails with this message, and systemctl --user does not see units in /etc/systemd/system/.

Sources