CompTIA Linux+ (XK0-006)TroubleshootingEasy
A technician is troubleshooting a Linux server where a critical service, `myapp.service`, fails to start correctly. The `systemctl status myapp.service` command shows `Active: failed (Result: exit-code)`. Further investigation with `journalctl -xeu myapp.service` reveals an error message: `ExecStart=/usr/local/bin/myapp: No such file or directory`. What is the most probable cause of this service failure?
- AThe binary specified in `ExecStart` does not exist or is in the wrong path.
- BThe service unit file has incorrect permissions.
- CSELinux is preventing the service from executing the binary.
- DThe service is attempting to bind to a port already in use.
Show answer & explanationAnswer & explanation
Correct answer: A. The binary specified in `ExecStart` does not exist or is in the wrong path.
The error message `ExecStart=/usr/local/bin/myapp: No such file or directory` is explicit. It directly states that the systemd service cannot find the executable specified in the `ExecStart` directive. This means the binary `myapp` is either not present at `/usr/local/bin/myapp` or the path in the service file is incorrect.
Why the other options are wrong
- B. Incorrect permissions on the unit file itself would prevent systemd from even parsing it, not specifically result in `No such file or directory` for the executable.
- C. SELinux preventing execution would usually result in a 'Permission denied' error or an SELinux-specific audit log message, not 'No such file or directory'.
- D. If a port was already in use, the error message would typically be 'Address already in use' or similar, not 'No such file or directory'.
systemd ExecStart 'No such file'
The `ExecStart` directive in a systemd service unit file specifies the command or script to execute when the service starts. An error 'No such file or directory' means the executable at the specified path cannot be found, preventing the service from launching.
- Indicates a problem with the executable path or existence.
- Requires verifying the binary's location and name.
- A common cause of service startup failures.
Memory trick: ExecStart needs the file to exist.