When working with systemd services, a common but frustrating error occurs when attempting to start a service that appears to be properly installed:
Failed to issue method call: Unit efl_test_daemon.service failed to load: No such file or directory
Despite the service file existing in /etc/systemd/system/
with correct permissions (as shown by the ls -l
output), systemd claims it cannot find the file. This typically indicates a deeper configuration or syntax issue rather than a simple file presence problem.
From experience, several factors could trigger this behavior:
- Missing or incorrect file extensions (.service, .target, etc.)
- Symbolic link issues in multi-config environments
- Invalid unit file syntax that prevents parsing
- Cached unit information that needs refreshing
First, verify systemd can actually see your unit file:
systemctl list-unit-files | grep efl_test_daemon
If it doesn't appear, force systemd to reload its configuration:
systemctl daemon-reload
Then check the file's syntax (this often reveals hidden issues):
systemd-analyze verify /etc/systemd/system/efl_test_daemon.service
Consider this minimal but valid service file example that works:
[Unit]
Description=EFL Test Daemon
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/efl_test_daemon
Restart=on-failure
[Install]
WantedBy=multi-user.target
Common mistakes that trigger our error include:
- Missing
[Unit]
,[Service]
, or[Install]
sections - Incorrect section names (e.g.,
[unit]
instead of[Unit]
) - Unescaped special characters in paths
When basic checks don't resolve the issue:
# Check systemd's internal state
journalctl -xe
systemctl status efl_test_daemon.service
# Verify inode information
ls -i /etc/systemd/system/efl_test_daemon.service
stat /etc/systemd/system/efl_test_daemon.service
# Test alternative installation paths
sudo cp /etc/systemd/system/efl_test_daemon.service /lib/systemd/system/
systemctl daemon-reload
In some cases, the underlying filesystem can cause issues:
- NFS-mounted
/etc/systemd/system/
directories - Overlay filesystems in container environments
- Filesystem permission changes from security policies
Always verify the actual file accessibility:
sudo -u systemd-cat test -f /etc/systemd/system/efl_test_daemon.service && echo "Accessible"
When systemd reports "No such file or directory" for a service that clearly exists in /etc/systemd/system/
, we're typically dealing with one of these scenarios:
# Common symptom pattern
$ systemctl start my_service.service
Failed to issue method call: Unit my_service.service failed to load: No such file or directory.
The most frequent cause is missing dependencies that aren't immediately obvious. Systemd services can fail silently if:
- Required directories don't exist
- Environment files are missing
- WantedBy targets aren't available
# 1. Verify the service file syntax
$ systemd-analyze verify /etc/systemd/system/efl_test_daemon.service
# 2. Check for masking
$ systemctl status efl_test_daemon.service
# 3. Force systemd to reload its configuration
$ systemctl daemon-reload
# 4. Check journal logs for detailed errors
$ journalctl -xe -u efl_test_daemon.service
Case 1: Incorrect file permissions despite correct location
# Solution:
chmod 644 /etc/systemd/system/efl_test_daemon.service
systemctl daemon-reload
Case 2: Missing ExecStartPre directories
[Service]
ExecStartPre=/bin/mkdir -p /var/run/myservice # Add this if missing
ExecStart=/usr/bin/myservice
For stubborn cases, use systemd's debug mode:
# Run in debug mode
SYSTEMD_LOG_LEVEL=debug systemctl start efl_test_daemon.service
# Alternatively, check the cgroup hierarchy
systemd-cgls
[Unit]
Description=My Resilient Service
After=network.target
Requires=network-online.target
[Service]
Type=simple
User=serviceuser
Group=servicegroup
RuntimeDirectory=myservice
ExecStartPre=/bin/mkdir -p /var/log/myservice
ExecStart=/usr/local/bin/myservice --config /etc/myservice.conf
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target