Systemd LimitNOFILE capped to 4096
Solution 1
Late answer;
limits.conf
is not used when systemd is running (limits.conf
is for non-systemd systems).
The file you actually want is; /etc/systemd/system.conf
- this is the global config. Then you have /etc/systemd/user.conf
- this specifies further per-user restrictions.
Specifically in your case; even though you have configured user.conf
with a higher limit, this is not valid as the limit in system.conf
is lower, and acts as a cap on the limit in user.conf
O_O
Solution 2
From man systemd.exec
:
For system units these resource limits may be chosen freely. For user units however (i.e. units run by a per-user instance of systemd(1)), these limits are bound by (possibly more restrictive) per-user limits enforced by the OS.
Your system probably has a configured hard limit of 4096 open files per process. It would open up a loophole if systemd allowed you to bypass this limit.
Free Bullets
Updated on September 18, 2022Comments
-
Free Bullets over 1 year
I have a systemd user service with
LimitNOFILE
set. The value is respected until it hits 4096. After that point, it's capped to 4096. I've also tried increasingDefaultLimitNOFILE
in/etc/systemd/user.conf
.It's set correctly in limits.conf, which works for new shells out of the box. Though, I heard systemd doesn't care about that file. What could be the problem?
-
Free Bullets over 6 yearsThanks for the man page reference. I'm not sure that's quite it since I have
limits.conf
configured, but it should get me further troubleshooting.