I am trying to increase the hard/soft open files limit on an Ubuntu 22.04
After reviewing questions such as this one, this one or that one and tutos such as this one or that one, I have made the following changes to my system:
- Modify
/etc/security/limits.conf
to include two lines
* soft nofile 8192
* hard nofile 8192
- Created
/etc/security/limits.d/10-openfiles.conf
with that same two lines
* soft nofile 8192
* hard nofile 8192
- Added
session required pam_limits.so
to/etc/pam.d/common-session*
- Uncommented
DefaultLimitNOFILE
on the section[Manager]
of/etc/systemd/user.conf
and set it to 8192 - Uncommented
DefaultLimitNOFILE
on the section[Manager]
of/etc/systemd/system.conf
and set it to 8192 - systemctl daemon-reexec then reboot (init 6)
No matter what, ulimit -Sn
shows 1024 and ulimit -Hn
shows 1048576
cat /proc/sys/fs/file-max
is huge, 9223372036854775807
That makes me think there must be another config file taking precedence...
System is an Azure VM with an standard Ubuntu 22 server image
Any help greatly appreciated
UPDATE
This answer points to a user-related config file in /home or /etc/profile.d/ but both grep -rnw '/etc/profile.d/' -e '1048576'
and grep -rnw '/home/' -e '1048576'
show empty results
UPDATE 2
cat /proc/sys/fs/nr_open
shows 1048576, so I guess that's from where the hard limit is coming.
Question remains, though. How can I change the soft limit to 8192 files?