increase user memory limits (staff group)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

increase user memory limits (staff group)

Riccardo Mottola
Hi all,

I need to compile certain big softare and want to do this as user, I am
hitting memory limits, e.g:

../../js/src/libjs_static.a: could not read symbols: Memory exhausted

I read in various post and man pages, but am a little confused.

First thing, I added my user to the "staff" group, which should have
increased limits, but they are not enough.

$ groups
staff wheel wsrc

in login.conf, I have:

default:\
         :path=/usr/bin /bin /usr/sbin /sbin /usr/X11R6/bin
/usr/local/bin /usr/local/sbin:\
         :umask=022:\
         :datasize-max=2048M:\
         :datasize-cur=1024M:\
         :maxproc-max=256:\
         :maxproc-cur=128:\
         :openfiles-cur=512:\
         :stacksize-cur=4M:\
         :localcipher=blowfish,a:\
         :tc=auth-defaults:\
         :tc=auth-ftp-defaults:

staff:\
         :datasize-cur=2048M:\
         :datasize-max=infinity:\
         :maxproc-max=512:\
         :maxproc-cur=256:\
         :stacksize-cur=32M:\
         :ignorenologin:\
         :requirehome@:\
         :tc=default:



I see this once logged in:
$ ulimit -a
time(cpu-seconds)    unlimited
file(blocks)         unlimited
coredump(blocks)     unlimited
data(kbytes)         1325784
stack(kbytes)        4096
lockedmem(kbytes)    3957020
memory(kbytes)       3957020
nofiles(descriptors) 512
processes            128


I suppose that to solve my "memory exhausted" error I need to increase
data and perhaps stack, since memory is already 4GB.

However, if I attempt:

$ ulimit -d 3957016
ksh: ulimit: -d exceeds allowable limit

$ ulimit -d 2097152
ksh: ulimit: -d exceeds allowable limit

can you give me a hint of what am I missing? apparently both
"datasize-max" and "datasize-cur" aren't working, since as default I get 1GB

Thanks.

Riccardo

Reply | Threaded
Open this post in threaded view
|

Re: increase user memory limits (staff group)

Solene Rapenne
On Mon, Feb 11, 2019 at 12:09:56PM +0100, Riccardo Mottola wrote:

> Hi all,
>
> I need to compile certain big softare and want to do this as
> user, I am hitting memory limits, e.g:
>
> ./../js/src/libjs_static.a: could not read symbols: Memory exhausted
>
> I read in various post and man pages, but am a little confused.
>
> First thing, I added my user to the "staff" group, which should
> have increased limits, but they are not enough.
>
> $ groups
> staff wheel wsrc
>
> Thanks.
>
> Riccardo
>

The names in login.conf are classes, this is not related to groups.
You can find in which class your user by looking at the 5th field of
your username in /etc/master.passwd. You can use the following command:

    $ doas awk -F':' '/^YOUR_USER/ { print $5 }' /etc/master.passwd

If it returns "staff" then you should have the correct limits from
/etc/login.conf

Look at /etc/login.conf.db, if you have that file, you must either
recreate it using cap_mkdb or remove it. If the file is not present
then login.conf is read. If the file is present, login.conf is not
read and login.conf.db is used instead, so you need to recreate it.
This is explained in login.conf(5).

Don't forget to delog yourself and relog-in with the account after
changes into login.conf. Limits are applied at login, not when you
call ulimit.

Reply | Threaded
Open this post in threaded view
|

Re: increase user memory limits (staff group)

Riccardo Mottola
Hi Solene!

Solene Rapenne wrote:
> The names in login.conf are classes, this is not related to groups.
> You can find in which class your user by looking at the 5th field of
> your username in /etc/master.passwd. You can use the following command:
>
>      $ doas awk -F':' '/^YOUR_USER/ { print $5 }' /etc/master.passwd
>
> If it returns "staff" then you should have the correct limits from
> /etc/login.conf

thanks for the hint, I got side-tracked by the name of the class being
the same as group.

Your command does not return anything, so the solution was as simple as

sudo usermod -L staff <myuser>

and now your command returns "staff"... fine!

I won't set any defaults for classes, since it is only me that needs
this for now.


Thanks,

Riccardo