What the message looks like
Failed to start myapp.service: Unit myapp.service not found.Common causes
- A typo or wrong service name; on Debian the SSH service is
ssh, on RHELsshd, and Apache isapache2orhttpd. - The package is not installed or ships no unit file.
- The unit file is in the wrong place; custom units belong in
/etc/systemd/system/. systemctl daemon-reloadwas not run after creating or changing the file.- Wrong file extension (not
.service) or, for template units, the instance name after the@is missing.
Check
- Search for similar unit names
systemctl list-unit-files --type=service | grep -i myapp - Does the file exist in one of the search paths?
ls -l /etc/systemd/system/ /usr/lib/systemd/system/ | grep -i myapp - Show the unit's content and location
systemctl cat myapp.service - Check the unit file for syntax errors
systemd-analyze verify /etc/systemd/system/myapp.service
Fix
- Check the name and look up the correct service name with
systemctl list-unit-files. - If the program is missing, install the package; if only the unit is missing, place it at
/etc/systemd/system/myapp.service. - Then run
sudo systemctl daemon-reloadso systemd reads the new file. - Verify the unit with
systemd-analyze verify, thensudo systemctl enable --now myapp.service. - For template units give the instance, for example
systemctl start name@instance.service.
Typical scenario
Someone creates a custom myapp.service file in the home directory and starts it with systemctl start myapp. The reply is Unit myapp.service not found, because systemd only searches its fixed paths such as /etc/systemd/system and /usr/lib/systemd/system. After copying the file to /etc/systemd/system/ and running systemctl daemon-reload the service starts.
FAQ
How does this differ from "Unit is masked"?
With "not found" there is no file. A masked unit exists but is linked to /dev/null and deliberately blocked; systemctl unmask undoes that.
Why does systemd not find my unit after copying it?
Usually daemon-reload is missing. Also check that the file is readable and ends in .service, since other extensions are not loaded as services.
Where do custom unit files belong?
In /etc/systemd/system/. Files under /usr/lib/systemd/system/ belong to the package manager and are overwritten on updates. Changes to packaged units are better made as a drop-in via systemctl edit.
The service is installed but the name is off. How do I find it?
Use dpkg -L packagename | grep service (Debian/Ubuntu) or rpm -ql packagename | grep service (RHEL) to see which unit files the package ships.
Can I test a program without a unit file?
Yes, briefly with systemd-run --unit=test-run /path/to/program. That creates a transient unit that disappears again when it ends.