A unit stopped working after you added `DynamicUser=yes`; the app can't find its data in `/var/lib/myapp`.
AdvancedTroubleshootingsystemd services and journald
Answer
Likely causes → With DynamicUser=yes, the UID changes and /var/lib/myapp is owned by the old user; dynamic users can only write to StateDirectory=, which lives under /var/lib/private/.
Diagnose →
systemctl show myapp -p DynamicUser -p StateDirectory
ls -ld /var/lib/myapp /var/lib/private/myapp
Fix → Set StateDirectory=myapp; systemd migrates ownership and symlinks /var/lib/myapp to /var/lib/private/myapp. Move existing data into it if needed.
Prevent → Plan state directories when adopting DynamicUser.
More on systemd services and journald
`systemctl status myapp` shows `Main process exited, code=exited, status=203/EXEC`.BeginnerA service fails with `status=217/USER`.BeginnerA service fails with `status=200/CHDIR`.BeginnerA unit fails with `status=226/NAMESPACE`.AdvancedYou edited a unit file, restarted the service, but the old behaviour persists. `systemctl status` shows `Warning: The unit file, source configuration file or drop-ins of myapp.service changed on disk`.BeginnerYou edited `/usr/lib/systemd/system/nginx.service` directly and after a package update your change vanished.Beginner