Attempting to manage system services in Linux using systemctl start, systemctl enable, or systemctl status only to encounter the error “Failed to start example.service: Unit example.service not found” indicates that the system and service manager (systemd) cannot locate or parse a corresponding unit configuration file. In Linux distributions powered by systemd (such as Ubuntu, Debian, Fedora, Arch, and RHEL), systemd relies on unit configuration files (ending in .service, .socket, or .timer) stored in designated filesystem hierarchies. When a package installation omits daemon registration, unit manifests reside in custom non-indexed directories, or systemd has not refreshed its internal dependency graph following file changes, service execution aborts. This guide details how to locate service manifests, refresh the unit database, and resolve systemd unit loading failures.
What Causes the ‘Unit Not Found’ Error in Systemd?
The systemd unit discovery engine evaluates standardized configuration paths in a strict hierarchy:
- Unloaded Daemon Configuration: A unit file was installed, modified, or moved, but the systemd manager has not executed
daemon-reloadto index it. - Package Service Name Discrepancies: The package name differs from the actual unit name (for example, installing
apache2on Fedora where the systemd unit is namedhttpd.service). - Orphaned or Broken Symlinks: Symbolic links in
/etc/systemd/system/pointing to non-existent unit targets. - Incorrect File Permissions or Syntax Errors: The unit file lacking read permissions for root (
644) or containing malformed Section headers. - Masked Service Units: A service unit explicitly masked and symlinked to
/dev/nullto prevent automatic or manual execution.
Method 1: Reload the Systemd Daemon Manager
Forcing systemd to reread unit directories immediately registers newly installed or edited service files.
- Open your Linux terminal.
- Execute the daemon reload command with administrative privileges:
sudo systemctl daemon-reload - Attempt to query the service status again:
sudo systemctl status example.service - If systemd now recognizes the unit, enable and start it:
sudo systemctl enable --now example.service
Method 2: Verify Exact Service Unit Names and Filesystem Locations
Confirm whether the unit file exists on disk and verify its naming convention.
- List all active, inactive, and loaded units matching your service keyword:
systemctl list-unit-files | grep -i "example" - Search standard systemd unit directories for the unit manifest:
sudo find /etc/systemd/system /lib/systemd/system /usr/lib/systemd/system -name "*example*" 2>/dev/null - Notice the location:
/etc/systemd/system/: System administrator created or customized unit files (highest priority)./run/systemd/system/: Runtime units generated dynamically./lib/systemd/system/or/usr/lib/systemd/system/: Upstream package maintainer unit files.
- If the file was saved with an incorrect name or missing
.serviceextension, rename it accordingly.
Method 3: Check for and Unmask Masked Services
Masked units are linked to /dev/null, causing systemd to treat them as permanently inaccessible.
- Check if the service is currently masked:
systemctl is-enabled example.service - If the output returns
masked, unmask the unit:sudo systemctl unmask example.service - Reload the daemon configuration:
sudo systemctl daemon-reload - Start the service:
sudo systemctl start example.service
Method 4: Fix File Permissions and Unit File Syntax
Ensure the service file has appropriate POSIX permissions so systemd PID 1 can parse its instructions.
- Verify permissions on the target unit file:
ls -la /etc/systemd/system/example.service - Standard systemd unit files must be owned by
root:rootwith permissions set to644:sudo chown root:root /etc/systemd/system/example.service sudo chmod 644 /etc/systemd/system/example.service - Verify that the file contains required minimal sections:
[Unit] Description=Example Application Service After=network.target [Service] Type=simple ExecStart=/usr/local/bin/example Restart=on-failure [Install] WantedBy=multi-user.target - Run
systemd-analyze verifyto test syntax:systemd-analyze verify /etc/systemd/system/example.service - Execute
sudo systemctl daemon-reloadand start the service.