Adjusting ulimit

Hi, I’m having a bit of a hard time getting ulimit adjusted in Fedora 32
I added four folders user@1000.service.d, gdm.service.d, gnome-shell-wayland.service.d, and gnome-terminal-server.service.d to /etc/systemd/system/
In user@1000.service.d and gdm.service.d is a single file limits.conf with the line

[Service]
LimitNOFILE=4194304

The other two folders have a similiar file but with higher limits.
I also edited /etc/systemd/system.conf and /etc/systemd/user.conf and changed DefaultLimitNOFILE to DefaultLimitNOFILE=4194304.

In /etc/security/limits.conf, I added

# More files
*	soft	nofile	4194304
*	hard	nofile	4194304

In /etc/pam.d/login, I added

session	   required	pam_limits.so

The machine is then restarted.

The issue is that typing ulimit -Sn or ulimit -Hn in a gnome-shell still shows a soft limit of 1024 and hard limit of 1048576. Indeed systemctl show | grep NOFILE shows

DefaultLimitNOFILE=1048576
DefaultLimitNOFILESoft=1024

What am I missing? systemctl show user@1000.service | grep NOFILE reports

LimitNOFILE=4194304
LimitNOFILESoft=4194304

Same for systemctl show gdm.service | grep NOFILE which reports

LimitNOFILE=4194304
LimitNOFILESoft=4194304

Nothing I launch from gnome-shell inherits the increased limit…All of them take the defaultlimit, which should have been increased from editing the system.conf and user.conf under /etc/systemd/…

I believe those need to be set with :
/etc/systemd/system/<servicename>.<service>.d/override.conf

You can also do
sudo systemctl edit <servicename>
or for user services
systemctl edit <servicename> --user

1 Like

This is what I see as limits for the services that I did the limits.conf drop-in

[ocelot@yellowtrain ~]$ systemctl show user@1000.service | grep NOFILE
LimitNOFILE=4194304
LimitNOFILESoft=4194304
[ocelot@yellowtrain ~]$ systemctl show gdm.service | grep NOFILE
LimitNOFILE=4194304
LimitNOFILESoft=4194304
[ocelot@yellowtrain ~]$ systemctl show gnome-shell-wayland.service | grep NOFILE
LimitNOFILE=1073741816
LimitNOFILESoft=1073741816
[ocelot@yellowtrain ~]$ systemctl show gnome-terminal-service | grep NOFILE
LimitNOFILE=1073741816
LimitNOFILESoft=1073741816

As you can see, the services themselves ajusted their NOFILE limits, but their children don’t…All of them take the default hard-limit… Am I missing something? What should be in the override.conf?

https://bugzilla.redhat.com/show_bug.cgi?id=1901986

Did not work for me.

On Fedora 33 I was able to change the global by:
Editing /etc/systemd/system.conf
Changing
#DefaultLimitNOFILE=1024:524288
to
DefaultLimitNOFILE=1024:4194304

Maybe a bug in 32?

Possibly try backing out the other changes and starting with just that change?

1 Like

The other changes came after the inital changes to system.conf and user.conf did not work. Sorry if I did not make that clear.