After a recent deployment, analytics.service will not start. Running systemctl status analytics.service produces:
analytics.service: Failed to load environment files: No such file or directory
analytics.service: Failed to run 'start' task: No such file or directory
analytics.service: Failed with result 'resources'.
All binaries referenced in ExecStart exist and have the correct permissions. Which single directive in the unit file is most likely causing this specific error and therefore needs to be fixed?
A Restart=on-failure policy in the [Service] section
An EnvironmentFile=/etc/analytics/analytics.env line that points to a missing file
A PIDFile=/run/analytics.pid declaration
An ExecStart=/usr/local/bin/analytics --config /etc/analytics.yml command
When systemd reports "Failed to load environment files", it is complaining that it could not open one or more files declared with the EnvironmentFile= directive. If the path given in that directive is wrong-or the file is missing-systemd aborts the start-up before it even reaches the ExecStart command, producing the failure shown in the question. Other directives listed in the distractors (ExecStart, PIDFile, Restart) are parsed differently and would trigger different error messages (for example, an invalid ExecStart path would mention the command, not environment files). Correcting or removing the EnvironmentFile= line-or prefixing the path with "-" to make it optional-will clear the error and allow the unit to start.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of the EnvironmentFile directive in a systemd unit file?
Open an interactive chat with Bash
What happens if the file specified in the EnvironmentFile directive is missing?
Open an interactive chat with Bash
How can you troubleshoot and fix issues with a missing EnvironmentFile in systemd?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Troubleshooting
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access