Bug#1042544: systemd: Can't increase user default file descriptors (nofile) soft limit above 1024 for gnome-terminal.

Luca Boccassi bluca at debian.org
Sun Jul 30 12:45:27 BST 2023


On Sun, 30 Jul 2023 05:26:32 +0200 "Olivier F. R. Dierick"
<o.dierick at piezo-forte.be> wrote:
> Package: systemd
> Version: 252.12-1~deb12u1
> Severity: normal
> 
>    * What led up to the situation?
> 
> Hello,
> 
> I'm testing games with Wine and contributing to its development.
> 
> I was using Debian 8 until recently.
> I installed a fresh install of Debian 12 in a new partition.
> The system is mostly a default GNOME desktop setup + schroot
environment for compiling Wine.
> I've installed all the required development tools and libraries and
successfully compiled a working version of Wine.
> I obviously need to launch Wine in the graphical GNOME session. I use
the default gnome-terminal to launch the Wine application.
> The problem is that I encounter the 'Too many file descriptors open,
you should probably increase ulimit -n.' error with certain windows
apps.
> In Debian 8, the default soft & hard limit were both set to 65536 and
I didn't have to change anything for it to work.
> In Debian 12, the default soft limit is 1024 (The default hard limit
of 1048576 is fine).
> I can increase the soft limit up to the hard limit by running the
'ulimit -Sn XXXXX' command in the terminal before runnig Wine and it
works.
> I want to make that change permanent for my single user.
> 
>    * What exactly did you do (or not do) that was effective (or
>      ineffective)?
> 
> I tried all that I found on the web, and none of it gave me the
result I want:
> - Creating the file /etc/security/limits.d/10-olivier.conf and
writing "olivier soft nofile 1048576" in it.
> - Adding "root soft nofile 1048576" into /etc/security/limits.d/10-
olivier.conf.
> - Creating the file /etc/systemd/system.conf.d/limits.conf and
writing "[Manager]" and "DefaultLimitNOFILE=65536" in it.
> - Adding "session required pam_limits.so" to /etc/pam.d/common-
session and /etc/pam.d/common-session-noninteractive.
> - Changing "olivier" to "*" in /etc/security/limits.d/10-olivier.conf
to extend the rule to all non-root users.
> 
> Those actions were performed incrementaly, with a reboot between each
action.
> 
>    * What was the outcome of this action?
> 
> Each action had the intended result, but did not affect the default
gnome-terminal session, which always return 1024 for ulimit -Sn.
> - Creating the file in /etc/security/limits.d with the single user
changed the soft limit in non-graphical TTYs from 1024 to 1048576.
> - Adding the rule for root changed the soft limit in non-graphical
TTYs from 1024 to 1048576.
> - Creating the file in /etc/systemd/system.conf.d/limits.conf changed
the soft limit of root in sudo session in gnome-terminal, but not for
the default user session.
> - Adding pam_limits.so to /etc/pam.d/common-session{,-noninteractive}
didn't have a visible effect.
> - Extending the limits.d rule from "olivier" to "*" didn't fix the
issue.
> 
>    * What outcome did you expect instead?
> 
> I did expect the ulimit -n command to return either 1048576 or 65536
(depending on which of systemd or pam.d was used for gnome-terminal)
for the user immediately after opening a gnome-terminal in the user's
GNOME session after changing the appropriate system configuration
files.
> 
>    * Additional notes:
> 
> After the actions, running 'sudo -s -u olivier' in the gnome-terminal
opens a session were ulimit -n returns the increased soft limit.
> I would rather have it work right away when opening gnome-terminal.
> I think this may be a hint for the cause of the issue.
> 
> Wine should increase it's own soft limit or have an (per-application)
option to set the desired soft limit and that it's a bug or shortcoming
of Wine that it does not.
> Until this is addressed, I would like the system setting to work in
the gnome-terminal.
> 
> I can put 'ulimit -n XXXX' in my profile/bash login script, but
that's only a work-around for the issue with the system setting not
being applied.

Setting the default soft limit higher than 1024 means that any
application or library using ye olde select() _will_ break. So you need
to be extremely careful as things might go wrong in hidden and non-
obvious ways. It should be each application that raises its own soft
limit, until select() has disappeared completely that's the only safe
generic default unfortunately.

-- 
Kind regards,
Luca Boccassi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20230730/d8b454e5/attachment.sig>


More information about the Pkg-systemd-maintainers mailing list