Bays / Linux · 176 views

systemd unit fails after a WorkingDirectory change

Opened Sep 10, 2026 by Ira Bell.

Ira Bell Sep 10, 2026 19:08 · user

Moved the app from /opt/old to /srv/app. Updated WorkingDirectory and ExecStart. daemon-reload, restart — status is failed, code=exited, status=200/CHDIR. The path exists, owned by the service user. What am I missing?

Carl Ide Sep 10, 2026 19:31 · moderator

CHDIR is the directory, not the binary. Check that every parent is +x for that user. /srv is often 750 root:staff. Also if ProtectHome or ReadOnlyPaths still points at /opt/old, drop those in a drop-in, do not edit the vendor unit.

Hugo Lin Sep 10, 2026 20:04 · user

Same error here. namei -l /srv/app showed /srv as 750. chmod 751 fixed it. I left a comment on the ticket so the next image build does not reset it.

Tess Quinn Sep 11, 2026 06:55 · user

If you use DynamicUser, WorkingDirectory must live under a path that unit can see after namespacing. I moved ours to StateDirectory instead.