From ArchWiki

Including systemd issues

I think we should discuss setting limits via limits.conf and through systemd files on the same page, since it's basically the same issue. That would mean renaming this page, however, since it wouldn't be limited (ha ha) to the limits.conf file. Any objection to just calling this page "System limits" and including systemd settings on this page as well? Chowbok (talk) 00:16, 6 August 2019 (UTC)

Can you sandbox this first? ⟨Sweyn78⟩ 04:38, 6 August 2019 (UTC)

nofile limit

Wiki suggests that providing

*                hard    nofile           65536

will increasse the nofile limit, but it does not. One has to additionally add a soft limit with the same values. Can someone verify this? Leuko (talk) 15:55, 16 June 2021 (UTC)

Hard limits are a hard cap, not an active value. You have to set a soft limit to actually see an effect. Soft limits can be set during runtime; hard limits cannot. -- Sweyn78 (talk) 21:22, 11 July 2022 (UTC)

Not working for me (nofiles and additional change required in systemd files)

I put the following into /etc/security/limits.conf:

myuser hard nofile 4096
myuser soft nofile 4096

and yet the actual nofiles limit remained unchanged (1024). I then followed the steps and this made it work. --Jose1711 (talk) 08:07, 28 March 2023 (UTC)

Did you read the note in the first paragraph? It states literally that.
Hanabishi (talk) 10:03, 28 March 2023 (UTC)
Yes, I did read that. The way I understood it though is: "if you're configuring limits for system service, check out those files". To me it came as a surprise that those files also affect the limits seen on console in a normal login session. --Jose1711 (talk) 10:45, 28 March 2023 (UTC)
You are wrong. Normal login session does respect limits.conf. In case you are using the real Linux console (tty).
As for terminal emulators, they are obviously inherit from a graphical environment. Considering that display managers and desktop environments are usually start via systemd services, such behavior is fairly expected.
Again: all child processes of a systemd service will inherit its configuration. Maybe the initial note should be improved to better explain this fact.
Also worth mentioning that any systemd service can define its own limits inside a unit file, overriding the globals. So this is even more trickier than you may think. But details about systemd is out of scope for this article, I guess.
Hanabishi (talk) 11:55, 28 March 2023 (UTC)
Wrong in what way? Before I added this section I checked it (reverted the changes in systemd files, rebooted) and the issue indeed manifested itself on an actual (textual) console. And since that stackexchange question (and several others) exists I think I may not the only one having issues to grasp the concept. --Jose1711 (talk) 12:17, 28 March 2023 (UTC)
Well, can't confirm, limits.conf works for me in tty. Even without a reboot, changes are applied on user log in. Systemd limits have no effect here.
Just to be sure, you are talking about the real tty using physically connected keyboard and monitor, not a remote connection like SSH or something?
Hanabishi (talk) 12:39, 28 March 2023 (UTC)
Yep, talking about pressing Ctrl-Alt-F2 and getting an ugly terminal with a limited support of characters (512 I believe). I will try to test more and on more machines too. --Jose1711 (talk) 14:18, 28 March 2023 (UTC)
My bad, had a typo in limits.conf (sort instead of soft. Sorry about that. --Jose1711 (talk) 16:02, 3 April 2023 (UTC)