37
24
I'm on Ubuntu 17.04. Trying to increase the open file limit, and none of the instructions I've found online are working. I can go up to 4096, but can't go past that.
$ ulimit -n
1024
$ ulimit -n 4096
$ ulimit -n
4096
That works. This doesn't:
$ ulimit -n 4097
bash: ulimit: open files: cannot modify limit: Operation not permitted
It appears to be because of the hard limit:
$ ulimit -Hn
4096
I've tried adding these lines to /etc/security/limits.conf:
* hard nofile 65535
* soft nofile 65535
root soft nofile 65535
root hard nofile 65535
Also added this line to /etc/pam.d/common-session and /etc/pam.d/common-session-noninteractive:
session required pam_limits.so
Since doing that, I've rebooted my computer. Changes to limits.conf don't seem to affect anything. The hard limit is still stuck at 4096, preventing me from going any higher. How do I increase my open files limit?
Here's some additional config info:
$ cat /proc/sys/fs/file-max
1624668
2
DefaultLimitNOFILE=65535
did the trick. But why/etc/security/limits.conf
does'nt work? – Suvitruf says Reinstate Monica – 2018-01-04T07:44:05.1606The GUI login uses systemd, which apparently has it's own configuration (
/etc/systemd/system.conf
) that is independent of the normal configuration for terminal sessions (/etc/security/limits.conf
). I don't know enough about systemd to know why it was implemented this way. – mkasberg – 2018-01-04T17:22:44.293Thank you! Hours of searching and trying everything, but this fixed the issue. – Roger Collins – 2018-03-19T23:15:18.790
1@Suvitruf because it's ignored in a systemd system. I'm posting an answer. – Marc.2377 – 2018-05-12T21:54:22.427
Doesn't work for me. Still stuck to
1024
. – Mooncrater – 2018-12-29T17:33:52.380I could change the value by first
su <username>
and then usingulimit -n 5000
. I guess it only changed for the current session. – Mooncrater – 2018-12-29T18:56:42.9901Just want to point out that limits for
root
user can't be specified by*
or group specifiers.root
literal must be specified explicitly. – Petr Javorik – 2018-12-30T16:43:06.5332This works for me, after a reboot. – Shihe Zhang – 2019-05-18T07:46:33.400
Soon, we'll have a monolithic system, all of which will be systemd. /s – Andrew Beals – 2019-10-04T18:36:27.647