Linux Labs

Inside the system: resources, kernel, processes / Stage 4 of 12

ulimit and sysctl: system ceilings

Not running Starting usually ~20 s
Leave the lesson

Step 10 of 10 · summary · 2 min

Summary

  • To a process, an open file is a descriptor; beyond the soft limit the kernel opens nothing, and the program writes Too many open files.
  • A process gets its limits from its parent and sees them in /proc/<PID>/limits: it raises the soft one by itself up to the hard one; root raises the hard one.
  • systemd sets a service's limits: LimitNOFILE in a drop-in in /etc/systemd/system/<unit>.d/, then daemon-reload and a restart.
  • sysctl -w changes a kernel parameter until a reboot, a file in /etc/sysctl.d changes it at every boot, and sysctl --system applies the files right away.
  • The shipper at the start of the lesson lost logs because systemd ran it with LimitNOFILE=64: your 1024 had nothing to do with it.
Ubuntu 24.04
Loading…