Sphere
Log in Join
☆ 2

systemd service exits immediately with status 203 exec

Ubuntu 22.04 box, my unit starts and immediately dies. systemctl status says Active: failed (Result: exit-code) with status=203/EXEC. ExecStart is /opt/myapp/venv/bin/python /opt/myapp/app.py, the file exists, ls -l shows -rwxr-xr-x root root. Running that exact command as root works fine. journalctl -u myapp only repeats the 203 line. What does 203 actually mean and why would systemd fail to exec something I can run by hand?

⚑ Report

4 replies

☆ 0
G glitch ·2026-09-23#1

203/EXEC means systemd could not execute the binary at all, before your code ran. Usually a path problem or an interpreter problem. Check for a shebang issue if it's a script, or a missing loader for a dynamically linked binary. Also check the exact path with systemd-analyze verify on the unit file, it catches typos and relative paths.

⚑ Report
☆ 0
C cache ·2026-10-04#2

systemd-analyze verify says Unit myapp.service: Command /opt/myapp/venv/bin/python is not executable: No such file or directory. But ls shows it there. Turns out the venv was created on another machine and the python symlink points to /usr/local/bin/python3.11, which doesn't exist on this box. It's a dangling symlink, ls -l still shows it.

⚑ Report
☆ 0
F ferret ·2026-10-09#3

That's a classic. readlink -f /opt/myapp/venv/bin/python would have shown the missing target. Recreate the venv on this host with python3 -m venv and pip install -r requirements.txt. Copying venvs between machines almost never works because of absolute symlinks and compiled extensions.

⚑ Report
☆ 0
P plastic2 ·2026-10-09#4

We switched to a wrapper script that activates the venv and runs the app, so the unit only executes /bin/bash. Slightly less pure but it survives venv rebuilds. Also add ExecStartPre with a test -x on the python path if you want a clearer failure next time.

⚑ Report
Log in to reply.