Howto enable more file open?

I encountered an error message:

eventfd: too many open files

The commands ulimit -Sn and ulimit -Hn both give a number of 4096.

I thought making changes in /etc/security/limits.conf would do the trick and I added the following lines to it:

vaessen soft nofile 8192
vaessen hard nofile 8192

But after reboot, the number of still 4096 remains when issuing ulimit -Sn and ulimit -Hn.

Is there a way to increase these numbers?

Hm, strange. This is on 15.2.
I have

henk@boven:~> ulimit -Sn
1024
henk@boven:~> ulimit -Hn
4096
henk@boven:~>

I made similar changes like you in /etc/security/limits.conf: setting both to 8192.
I did not reboot, but made a fresh login. In my case in the CLI in logical console #1 (after typing Ctrl-Alt-F1). Difficult to copy/paste from there, thus you must believe me when I say that both limits were indeed 8192 in that session.

I logged out, switched back to my GUI session and undid the configuration changes.
Back to screen 1 and yes, a new login and the former 1024 and 4096 are in place.

Thus either this is a 15.3 specialty or you did something different from what I did (but your description above is all-right though).

man ulimit says:

ULIMIT(3)                                                                                    Linux Programmer's Manual                                                                                   ULIMIT(3) 

**NAME**
       ulimit - get and set user limits 

**SYNOPSIS**
       **#include <ulimit.h>**

       **long ulimit(int **cmd**, long **newlimit**);**

**DESCRIPTION**
       **Warning: this routine is obsolete.  Use **getrlimit**(2), **setrlimit**(2), and **sysconf******(3) instead.**  For the shell command **ulimit**(), see **bash**(1).

Maybe try those?

BTW, I have the same settings as henk on 15.2, too.

This is about the library call (and header file to be included) in a C program. You look into the wrong section (3, programming). You in fact did

man 3 ulimit

For the command you need

man 1 ulimit

or choose the correct page when you do

henk@boven:~> man ulimit
Man: alle passende pagina's vinden, niet alleen eerste (set MAN_POSIXLY_CORRECT to avoid this)
 * ulimit (3)
   ulimit (2)
   ulimit (1p)
   ulimit (3p)
Man: Welke man-pagina wilt u zien?
Man: ]

And you must make that choice quick enough else it will skip to one, in this case 3 :frowning:

Where? System systemd service, user systemd service, user shell, somewhere else …

The commands ulimit -Sn and ulimit -Hn both give a number of 4096.

Where? User shell? Is it GUI? Is it console session login? Is it remote session via ssh?

Is there a way to increase these numbers?

Increase where? Each of those possibilities is (potentially) configured in different place.

I see entirely different ulimit values (1024/524288) in user session started in Xfce terminal emulator or logging in on text console. I have not changed anything in default system configuration related to limits.

Yea, well, actually I just got curious and

man 1 ulimit

brought me this:

ULIMIT(1P)                                                                                   POSIX Programmer's Manual                                                                                  ULIMIT(1P) 

**PROLOG**
       This  manual  page  is  part  of  the POSIX Programmer's Manual.  The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the 
       interface may not be implemented on Linux. 

**NAME**
       ulimit — set or report file size limit 

**SYNOPSIS**
       ulimit ****−f**] **blocks**]**

**DESCRIPTION**
       The ulimit utility shall set or report the file-size writing limit imposed on files written by the shell and its child processes (files of any size may be read). Only a process  with  appropriate  privi- 
       leges can increase the limit. 

**OPTIONS**
       The ulimit utility shall conform to the Base Definitions volume of POSIX.1‐2008, Section12.2, UtilitySyntaxGuidelines. 

       The following option shall be supported: 

       **−f        **Set (or report, if no blocks operand is present), the file size limit in blocks. The **−f **option shall also be the default case. 

**OPERANDS**
       The following operand shall be supported: 

       blocks    The number of 512-byte blocks to use as the new file size limit. 

**STDIN**
       Not used. 

**INPUT FILES**
       None. 

Which didn’t seem to fit.

Sure: How to Set Resource Limits for a Process with Systemd in CentOS/RHEL 7 and 8 – The Geek Diary

right, though that page fails to mention that proper way of “editing” systemd units is via

systemctl edit <fooservice>

which will then properly create an override file in fooservice.service.d/override.conf. Now, htf do I make systemctl edit use vi instead of nano, grr

I’ am afraid this does not help so far.
Changing /etc/systemd/system.conf is exactly what I did.
As for the second approach, changing the values for a specific service or process, I would not know how to imply that in OpenSuSE Leap 15.3.
In /var/run I see processes, but not one of them seems to apply to the program I started, which I did by executing [FONT=arial][size=2]/usr/bin/steam in a shell.
How to proceed from there?

[/size]
[/FONT]

The program was started from within a user shell. It starts with this line:
#!/usr/bin/env bash

It is used to start a Windows game, executed by a program similar to wine. It invokes other programs and at some point the message appears that too many files are open.

As I already told you - user shell in Leap 15.3 defaults to 1024/524288. If you see different values, you either already have changed defaults or use some rather non-standard way to obtain user shell. In both cases you need to provide more details.

Most obvious guess is that ulimit is lowered in some of your shell rc files.

Run “systemd-cgls” to identify the controlling service and try to modify this one. On my machine bash running in konsole are part of app-org.kde.konsole-34548ba9caa2473ca864beed0871ff00.scope You will need to use a template service.

Have a look here:

**erlangen:~ #** systemctl cat user-1000.slice                              
**# /usr/lib/systemd/system/user-.slice.d/10-defaults.conf**
#  SPDX-License-Identifier: LGPL-2.1-or-later 
# 
#  This file is part of systemd. 
# 
#  systemd is free software; you can redistribute it and/or modify it 
#  under the terms of the GNU Lesser General Public License as published by 
#  the Free Software Foundation; either version 2.1 of the License, or 
#  (at your option) any later version. 

[Unit] 
Description=User Slice of UID %j 
Documentation=man:user@.service(5) 
After=systemd-user-sessions.service 
StopWhenUnneeded=yes 

[Slice] 
TasksMax=33% 
**erlangen:~ #**



Override by editing the unit.

The bash shell knows .bashrc as rc file.
It is largely commented out and only lines not so are these:

test-s ~/.alias && . ~/.alias || true
HISTFILE=/dev/null
export PS1='$(pwd) $ ’
alias ll=“ls -la”

export PATH=“$PATH:/home/vaessen/.local/bin”
“.bashrc” 37L, 1430C

The processes that matter are hierarchically under these:

─user.slice
│ └─user-1026.slice
│ ├─session-1.scope

By the way: that I use 1026 as ID has to do with my Synology NAS station.

The command systemctl cat user.slice gives



[FONT=arial][size=2]#/usr/lib/systemd/system/user.sclice
#  SPDX-License-Identifier: LGPL-2.1+ 
# 
#  This file is part of systemd. 
# 
#  systemd is free software; you can redistribute it and/or modify it 
#  under the terms of the GNU Lesser General Public License as published by 
#  the Free Software Foundation; either version 2.1 of the License, or 
#  (at your option) any later version. 

[Unit] 
Description=User and Session Slice 
Documentation=man:systemd.special(7) 
Before=slices.target
[/size][/FONT]

[FONT=arial][size=2]
[/size]

[/FONT]

Don’t worry about garbled output. Try “man user@.service”.

I learned this from https://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/


Above command forces the limit to 100000 files. You need to edit /etc/sysctl.conf file and put following line so that after reboot the setting will remain as it is:
# vi /etc/sysctl.conf

Append a config directive as follows:
fs.file-max = 100000

I did so.
To my surprise, in the bash shell, after reboot, the command ‘ulimit -n’ yields 8192. Not 100000.

From your link I learned:

Command To List Number Of Open File Descriptors

Use the following command command to display maximum number of open file descriptors:
cat /proc/sys/fs/file-max

Output:
75000 75000 files normal user can have open in single login session.

I try that on host erlangen:

karl@erlangen:~> cat /proc/sys/fs/file-max 
9223372036854775807 
karl@erlangen:~> 

Amazing, isn’t it?:wink:
I recommend RTFM.

I daresay it is.

Because, “ulimit” is a Bash “built-in” – “man bashbuiltins” –


       ulimit -HSabcdefiklmnpqrstuvxPT [limit]]
              Provides  control  over the resources available to the shell and to processes started by it, on systems that allow
              such control.  The -H and -S options specify that the hard or soft limit is set for the given  resource.   A  hard
              limit  cannot be increased by a non-root user once it is set; a soft limit may be increased up to the value of the
              hard limit.  If neither -H nor -S is specified, both the soft and hard limits are set.  The value of limit can  be
              a number in the unit specified for the resource or one of the special values hard, soft, or unlimited, which stand
              for the current hard limit, the current soft limit, and no limit, respectively.  If limit is omitted, the  current
              value of the soft limit of the resource is printed, unless the -H option is given.  When more than one resource is
              specified, the limit name and unit are printed before the value.  Other options are interpreted as follows:
              -a     All current limits are reported
              -b     The maximum socket buffer size
              -c     The maximum size of core files created
              -d     The maximum size of a process's data segment
              -e     The maximum scheduling priority ("nice")
              -f     The maximum size of files written by the shell and its children
              -i     The maximum number of pending signals
              -k     The maximum number of kqueues that may be allocated
              -l     The maximum size that may be locked into memory
              -m     The maximum resident set size (many systems do not honor this limit)
              -n     The maximum number of open file descriptors (most systems do not allow this value to be set)
              -p     The pipe size in 512-byte blocks (this may not be set)
              -q     The maximum number of bytes in POSIX message queues
              -r     The maximum real-time scheduling priority
              -s     The maximum stack size
              -t     The maximum amount of cpu time in seconds
              -u     The maximum number of processes available to a single user
              -v     The maximum amount of virtual memory available to the shell and, on some systems, to its children
              -x     The maximum number of file locks
              -P     The maximum number of pseudoterminals
              -T     The maximum number of threads

              If limit is given, and the -a option is not used, limit is the new value of the specified resource.  If no  option
              is  given,  then -f is assumed.  Values are in 1024-byte increments, except for -t, which is in seconds; -p, which
              is in units of 512-byte blocks; -P, -T, -b, -k, -n, and -u, which are unscaled values; and, when in Posix mode, -c
              and  -f,  which  are  in 512-byte increments.  The return status is 0 unless an invalid option or argument is sup-
              plied, or an error occurs while setting a new limit.

“ulimit --help” also provides this information …