Fix systemd status=205/LIMITS (resource limit failed)
systemd status=205/LIMITS: a Limit*= resource limit could not be applied at start. Read the RLIMIT_ name and error in the journal, then fix the unit.
code=exited, status=205/LIMITS205/LIMITS does not mean the program crashed. Right before starting it, systemd failed to apply a resource limit (LimitNOFILE= and the other Limit*= settings). The status line above is the documented form, not captured output. Which limit and which error is in one journal line. For sibling codes see 200/CHDIR and 203/EXEC.
[1] Find the failing line in the journal.
# journalctl -u myapp -b --no-pager -n 20The systemd 255 source sets 205 in three places, each with its own wording.
| Journal wording (255 source) | Meaning |
|---|---|
Failed to adjust resource limit RLIMIT_NOFILE: … | A Limit*= named by the part after RLIMIT_ (NOFILE, NPROC, …) could not be applied. The text after the colon is the setrlimit(2) error |
Failed to adjust coredump_filter: … | Writing /proc/self/coredump_filter for CoredumpFilter= failed. Not a setrlimit error |
Failed to adjust RLIMIT_RTPRIO resource limit: … | RestrictRealtime= failed while lowering RLIMIT_RTPRIO to 0 |
The steps below cover the first row. For the other two, only the wording was confirmed in the source, not what makes them fail. If you see one, comment out that setting temporarily just to see whether it is the cause, and put it back when you are done. RestrictRealtime= stops a service from taking the CPU with realtime scheduling, so do not leave it removed.
[2] List the limits the unit sets.
# systemctl cat myapp | grep -E '^(Limit|DefaultLimit)'# grep -E '^DefaultLimit' /etc/systemd/system.confLimits the unit does not set follow DefaultLimit*= in system.conf; a user service (systemctl --user) inherits the limits its user service manager received (systemd.exec manual).
[3] Know what happens when a limit cannot be raised. When setrlimit(2) fails with EPERM, systemd does not give up; it lowers the value to the current hard limit and tries once more (setrlimit_closest()). Below is the result of a helper that follows that sequence (run/closest.pl, mounted at /closest.pl in the container), run as an unprivileged account in an Ubuntu 24.04 container with the hard limit set to 4096. It is not systemd itself.
# prlimit --nofile=1024:4096 setpriv --reuid=65534 --regid=65534 --clear-groups perl /closest.pl NOFILE 65536 65536RLIMIT_NOFILE now 1024:4096 target 65536:65536 setrlimit: Operation not permitted closest: retried with 4096:4096, ok (no 205)infinity as the target gave the same result. So being blocked while raising a limit does not give 205; the value is silently capped at the ceiling. LimitNOFILE=65536 may really be 4096, which is why [5] checks it.
By the source, 205 comes out on an error other than EPERM, on EPERM when the hard limit is infinity, when getrlimit fails to read the current limit, or when the second, capped setrlimit fails. None of these could be produced in this test.
[4] Fix it according to the name and error in the journal.
- Delete
Limit*=lines you do not need. The manual recommendsMemoryMax=for memory andTasksMax=for process counts (MemoryHigh vs MemoryMax). - A user service cannot raise a limit above what its user manager received, whatever
Limit*=says. The manual's way: raise the user's limit through PAM, or set the limit onuser@.serviceand restart that user's manager.
# systemctl edit --drop-in=limits-nofile user@.service[Service]LimitNOFILE=1024:65536A single value sets both soft and hard limits, and the manual warns that raising the soft limit above 1024 breaks programs using select(2) with descriptors above 1023. So only the hard limit is raised here (65536 is an example). To apply it, restart the target user's manager (UID 1000 here).
# systemctl restart user@1000.serviceTo undo, delete limits-nofile.conf, run systemctl daemon-reload, and restart the manager the same way.
[5] After fixing, clear the failure record, start the service, and check the applied limit. For a system service:
# systemctl daemon-reload# systemctl reset-failed myapp# systemctl start myapp# grep 'open files' /proc/$(systemctl show -p MainPID --value myapp)/limitsFor a user service, run every systemctl as that user with --user (including the one inside the MainPID lookup). Without it you touch a system service of the same name. If the last line shows less than the unit's value, it was capped as in [3].
Analyze your syslog · journal log in the browser ↗ — nothing is uploaded.