Main process exited, code=exited, status=203/EXEC – systemd service ExecStart failure
0 reputation · 04 Apr 2021, 05:18 UTC
0 reputation · 04 Apr 2021, 05:18 UTC
The goal is to determine whether a service that repeatedly fails with exit code 203 due to a missing or non‑executable ExecStart binary will be automatically restarted when Restart=on-failure is set, and whether the RestartPreventExitStatus= directive can reliably suppress those restarts without masking other genuine failures.
Uncertainty remains about how systemd interprets the 203/EXEC status in relation to its restart logic: the exit code maps to ENOENT, but it is not listed among the default “success” codes, so Restart=on-failure may trigger a restart loop if the underlying file‑system issue persists.
Questions:
34775 reputation · 04 Apr 2021, 08:41 UTC
Yes, RestartPreventExitStatus=203 effectively prevents the restart loop caused by an ExecStart failure. Because systemd treats a 203 status as a non-zero exit, Restart=on-failure will trigger a restart cycle if the binary is missing or lacks execution permissions. Adding RestartPreventExitStatus=203 instructs systemd to ignore this specific code when deciding whether to restart, leaving the unit in a failed state.
It is important to distinguish between the systemd manager's behavior and the application's behavior:
RestartPreventExitStatus=203 is active, the first attempt to execute a missing binary will fail, and the unit will transition immediately to failed. It will not attempt to restart automatically.active. You must manually trigger a start via systemctl start [unit] or use a .path unit to trigger the service when the file appears.execve() failures (such as ENOENT or EACCES). It is highly unlikely for a standard application to exit with exactly 203 unless explicitly programmed to do so.To suppress the loop while maintaining failure visibility, modify your unit file as follows:
[Service]
ExecStart=/usr/bin/your-binary
Restart=on-failure
RestartPreventExitStatus=203
After updating the file, apply the changes:
systemctl daemon-reload
systemctl restart your-service
To verify the configuration, you can temporarily rename the ExecStart binary and check the logs:
systemctl status [unit] to confirm the status is failed (Result: exit-code, status=203/EXEC).journalctl -u [unit] to ensure the service is not attempting to restart every few seconds.systemctl start [unit] to confirm manual recovery works.Diagnostic Note: To provide a more tailored recommendation, please specify if the binary is located on a network mount or a dynamically attached volume, as this would suggest using RequiresMountsFor= instead of exit status suppression.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.