M
M
Maxim Vyaznikov2016-10-26 01:04:29
linux
Maxim Vyaznikov, 2016-10-26 01:04:29

Debian 8, how to properly increase LimitNOFILE in systemd?

Actually, what is the question: in Debian 8, for some services (including nginx and apache), configuration files for systemd are generated based on scripts in /etc/init.d, and they end up in /run/systemd/generator.late /, and, as I understand it, are overwritten with each system restart.
I googled that LimitNOFILE must be written in one of the ways:

/usr/lib/systemd/system/<servicename>.service
/lib/systemd/system/<servicename>.service
/etc/systemd/system/<servicename>.d/override.conf

But, for the above reasons, the corresponding files are not there, and something I'm completely confused.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vyacheslav Rakhinsky, 2016-10-26
@rakhinskiy

That's right, they won't be there.
You create /etc/systemd/system/nginx.d/override.conf
and write your limits there
. Since this file is not part of the package, it will not be overwritten during updates.
Only after creating the file, do systemctl daemon-reload

I
IgorOhrimenko, 2019-02-20
@IgorOhrimenko

To override specific units, instead of manually creating a folder and file, it is convenient to use: systemctl edit юнит
To override for all system processes, as it was before through /etc/security/limits.conf, you can now make the file /etc/systemd/system.conf.d/limit. conf with the DefaultLimitNOFILE= directive and others

spoiler
DefaultLimitCPU=, DefaultLimitFSIZE=, DefaultLimitDATA=, DefaultLimitSTACK=, DefaultLimitCORE=, DefaultLimitRSS=, DefaultLimitNOFILE=, DefaultLimitAS=, DefaultLimitNPROC=, DefaultLimitMEMLOCK=, DefaultLimitLOCKS=, DefaultLimitSIGPENDING=, DefaultLimitMSGQUEUE=, DefaultLimitNICE=, DefaultLimitRTPRIO=, DefaultLimitRTTIME=
indicated in the manualman systemd-system.conf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question