CompTIA Linux+ (XK0-006)System ManagementMedium
A system administrator installs a new application that uses a custom systemd service named 'appdaemon.service'. After installation, the administrator attempts to start the service with 'systemctl start appdaemon.service', but it fails immediately. Upon checking 'journalctl -xe', they see an error indicating the service unit file cannot be found. What is the most likely cause?
- AThe service is masked, preventing it from starting.
- BThe unit file is not located in a standard systemd unit file path.
- CThe service requires a reboot to be recognized by systemd.
- DThe service is disabled and needs to be enabled before starting.
Show answer & explanationAnswer & explanation
Correct answer: B. The unit file is not located in a standard systemd unit file path.
If 'systemctl' cannot find the unit file, it means the file is not in one of the standard locations where systemd looks (e.g., /etc/systemd/system, /usr/lib/systemd/system). The administrator needs to place the unit file in the correct directory and then run 'systemctl daemon-reload'.
Why the other options are wrong
- A. If masked, the error would indicate it's masked or a symbolic link to /dev/null, not 'cannot be found'.
- C. Systemd does not typically require a full reboot to recognize new unit files; 'systemctl daemon-reload' is usually sufficient.
- D. A disabled service can still be started manually with 'systemctl start'; 'enabled' only controls automatic startup at boot.
systemd Unit File Paths
Systemd unit files (like services, targets, mounts) are stored in specific directories. Systemd searches these paths in a defined order to find and load unit configurations.
- Primary locations: /etc/systemd/system (for local admin overrides), /run/systemd/system (runtime generated), /usr/lib/systemd/system (for installed packages).
- Unit files must have the correct extension (e.g., .service, .target, .mount).
- After placing a new unit file, 'systemctl daemon-reload' is required for systemd to recognize it.
Memory trick: SystemD needs its files in the right place to start.