9

I want to increase the maximum number of open files in Fedora 27, since the default settings are too low:

$ ulimit -Sn 1024 $ ulimit -Hn 4096 

First, I ensure that the system-wide setting is high enough, by adding the following line to /etc/sysctl.conf:

fs.inotify.max_user_watches=524288 fs.file-max=100000 

Then, I set the user-specific settings by adding the following lines to /etc/security/limits.conf (root must be added separately since the Wildcard matches all users except root):

* soft nofile 100000 * hard nofile 100000 root soft nofile 100000 root hard nofile 100000 

To ensure that the above settings are actually loaded, I have added the following line to /etc/pam.d/login:

session required pam_limits.so 

After rebooting my computer and logging in, I still get the same results for ulimit -Sn and ulimit -Hn. Only the system-wide setting have been set:

$ cat /proc/sys/fs/file-max 100000 

I'm a bit at a loss as to what to do... Anybody have any ideas how I might diagnose/solve this?

1
  • You could add debug to the line in /etc/pam.d/login. I just double checked on a FC27 and the pam_limits.so is also in the pam modules system-auth, sudo, runuser, password-auth... also check with journalctl -f which pam module is triggered on login. Commented Mar 4, 2018 at 18:02

2 Answers 2

7

The problem here is that the GUI (and gnome-terminal) are started by systemd --user, which does not read from /etc/security/limits.conf. Instead, you should edit /etc/systemd/user.conf and /etc/systemd/system.conf for the soft and hard limits, respectively, by appending e.g.

DefaultLimitNOFILE=100000 

This same question has come up a few times on the StackExchange network; see e.g. this question for further discussion.

There are also bug reports for the issue, both for Ubuntu and Fedora.

0

Also, check your ~/.bashrc file for ulimit usage.

In my Fedora 38 I found that in my ~/.bashrc there where line

limit -n 4096 

so updating it resolved the issue.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.