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

2023-07-31 Thread Michael Biebl

Am 30.07.23 um 05:26 schrieb Olivier F. R. Dierick:

- Creating the file /etc/systemd/system.conf.d/limits.conf and writing "[Manager]" and 
"DefaultLimitNOFILE=65536" in it.


gnome-terminal is started as a user service, no as a system service.
So what you most likely need to change is to update
/etc/systemd/user.conf(.d)

See man user.conf.d

Regards,
Michael



OpenPGP_signature
Description: OpenPGP digital signature


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

2023-07-30 Thread Olivier F. R. Dierick
Hello,

Thanks for the warning, Luca Boccassi.

I'm aware of the implications of increasing the soft limit. I read many
discussions on the subject on the web while looking for a solution, and
understand the rationale of the Debian decision to set the soft limit
to 1024 and the hard limit to 1048576 in recent releases.
I agree to that and expect that modern, non-select()-using applications
set the soft limit themselves to deliberately indicate that they want
more file descriptors. I filed a bug for Wine as it didn't work as
expected in this case. (https://bugs.winehq.org/show_bug.cgi?id=55363)
That should not be discussed here, though.

What I report is that after changing every possible settings I could
find documentation for on the web, the soft limit stays unchanged in
the initial session of a freshly opened gnome-terminal in the graphical
DE. The higher soft limit gets properly set everywhere else as
expected, including opening a new session in the gnome-terminal with
sudo to the same user, or temporarily setting the value with 'ulimit -n
'. This means to me that something overrides the global settings
from systemd & pam_limits.so in gnome-terminal initialization or a
parent process, or that it takes a path that simply doesn't load the
systemd/pam_limits settings.

I would like to know if I simply missed something in my attempt to
configure a higher soft limit, or if the issue lies within systemd or
another component/application. How can I check that?

Regards.

P.S. Quoting the original message seems broken for me when using the
'reply' link on the Debian Bug page. The generated quote was limited to
a few lines of my own quoted message in your reply. I removed it as it
was meaningless.
-- 
Olivier F. R. Dierick
o.dier...@piezo-forte.be



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

2023-07-30 Thread Luca Boccassi
On Sun, 30 Jul 2023 05:26:32 +0200 "Olivier F. R. Dierick"
 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 X' 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 ' 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


signature.asc
Description: This is a digitally signed message part