How to increase open file limits on Ubuntu 22.04

Originally written: Sep 7, 2022

In /etc/security/limits.conf, add

* soft nofile 1000001
* hard nofile 1000001

Log out, log back in again, and you should have:

$ ulimit -Sn
1000001
$ ulimit -Hn
1000001

Original Source

Update (Dec 6, 2022)

If you want to automate this via Salt, this is what you can add to your config.

open_file_limits:
  file.blockreplace:
    - name: /etc/security/limits.conf
    - marker_start: "# START salt zone -DO-NOT-EDIT-"
    - marker_end: "# END salt zone --"
    - content: |
        * soft nofile 1000001
        * hard nofile 1000001
        root soft nofile 1000001
        root hard nofile 1000001
    - append_if_not_found: True
    - show_changes: True


Date
December 6, 2022