Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Setting ulimits in /etc/login.conf

704 views
Skip to first unread message

Steven Schneider

unread,
Oct 7, 2011, 10:32:59 PM10/7/11
to
How do you permently set ulimits in /etc/login.conf? I'm reading
man 1 ksh and man 5 login.conf, but I'm not too sure that I'm quite
following them.

Any suggestions on what to look at, or just how to do it?

--
W. Steven Schneider <steven_s...@incentre.net>

Joachim Schipper

unread,
Oct 8, 2011, 1:48:56 AM10/8/11
to
Steven Schneider <steven_s...@incentre.net> wrote:
> How do you permently set ulimits in /etc/login.conf? I'm reading
> man 1 ksh and man 5 login.conf, but I'm not too sure that I'm quite
> following them.
>
> Any suggestions on what to look at, or just how to do it?

Just look at /etc/login.conf (look for e.g. datasize-{max,cur})? What do
you want to do?

Joachim

Steven Schneider

unread,
Oct 8, 2011, 7:32:00 AM10/8/11
to
* Joachim Schipper <joa...@NOSPAMjoachimschipper.nl> [2011-10-08]:
Oh, it _is_ datasize! By why didn't altering that change my ulimits
on next log in? Does it require a reboot after making the change?

> What do
> you want to do?
>

Well, I'm running chrome on my workstation and I want to boost the
datasize. I had noticed some performance issues and wanted to see
if increasing the ulimit -d amounts would make a difference.

While I could do it manually I thought it might be a good idea to
know how to do that on login/reboot.

Steven Schneider

unread,
Oct 8, 2011, 9:20:15 AM10/8/11
to
* Steven Schneider <steven_s...@incentre.net> [2011-10-08]:

> * Joachim Schipper <joa...@NOSPAMjoachimschipper.nl> [2011-10-08]:
>> Steven Schneider <steven_s...@incentre.net> wrote:
>> What do
>> you want to do?
>>
specifically, I want to double my ulimit -d from 512M to 1024M
though that may be a bit much. I'll probably want a bit less than
double, but I thought it be a good place to start. :-)

Joachim Schipper

unread,
Oct 8, 2011, 11:59:51 AM10/8/11
to
Steven Schneider <steven_s...@incentre.net> wrote:
> * Steven Schneider <steven_s...@incentre.net> [2011-10-08]:
>> * Joachim Schipper <joa...@NOSPAMjoachimschipper.nl> [2011-10-08]:
>>> Steven Schneider <steven_s...@incentre.net> wrote:
>>> What do
>>> you want to do?
>>>
> specifically, I want to double my ulimit -d from 512M to 1024M
> though that may be a bit much. I'll probably want a bit less than
> double, but I thought it be a good place to start. :-)

I have

default:\
:path=/usr/bin /bin /usr/sbin /sbin /usr/X11R6/bin
/usr/local/bin:\
:umask=022:\
:datasize-max=3072M:\
:datasize-cur=1536M:\
:maxproc-max=256:\
:maxproc-cur=128:\
:openfiles-cur=128:\
:stacksize-cur=4M:\
:localcipher=blowfish,12:\
:ypcipher=old:\
:tc=auth-defaults:\
:tc=auth-ftp-defaults:

staff:\
:datasize-cur=4096M:\
:datasize-max=infinity:\
:maxproc-max=512:\
:maxproc-cur=128:\
:ignorenologin:\
:requirehome@:\
:tc=default:

which seems to work for me, although I run Firefox. (Note that you need
to raise both the hard and soft limit, i.e. datasize-max and
datasize-cur.)

This is on a fairly modern, but cheap laptop with 2GB RAM. The above
settings are completely inappropriate for a multi-user system, since one
user can force the machine into swap.

Joachim

Christian Weisgerber

unread,
Oct 8, 2011, 11:36:15 AM10/8/11
to
Steven Schneider <steven_s...@incentre.net> wrote:

> > Just look at /etc/login.conf (look for e.g. datasize-{max,cur})?
>
> Oh, it _is_ datasize! By why didn't altering that change my ulimits
> on next log in?

Do you have a stale /etc/login.conf.db lying around?

--
Christian "naddy" Weisgerber na...@mips.inka.de

Steven Schneider

unread,
Oct 8, 2011, 2:45:53 PM10/8/11
to
* Christian Weisgerber <na...@mips.inka.de> [2011-10-08]:
> Steven Schneider <steven_s...@incentre.net> wrote:
>
>> > Just look at /etc/login.conf (look for e.g. datasize-{max,cur})?
>>
>> Oh, it _is_ datasize! By why didn't altering that change my ulimits
>> on next log in?
>
> Do you have a stale /etc/login.conf.db lying around?
>

No, I just double checked, and according to man 5 login.conf I
probably don't need one.

I take it that the settings should be taking upon log in?

Christian Weisgerber

unread,
Oct 9, 2011, 9:47:38 AM10/9/11
to
Steven Schneider <steven_s...@incentre.net> wrote:

> >> > Just look at /etc/login.conf (look for e.g. datasize-{max,cur})?
> >>
> >> Oh, it _is_ datasize! By why didn't altering that change my ulimits
> >> on next log in?
>

> I take it that the settings should be taking upon log in?

Yes, they should.

DoN. Nichols

unread,
Oct 9, 2011, 5:58:00 PM10/9/11
to
On 2011-10-09, Christian Weisgerber <na...@mips.inka.de> wrote:
> Steven Schneider <steven_s...@incentre.net> wrote:
>
>> >> > Just look at /etc/login.conf (look for e.g. datasize-{max,cur})?
>> >>
>> >> Oh, it _is_ datasize! By why didn't altering that change my ulimits
>> >> on next log in?
>>
>> I take it that the settings should be taking upon log in?
>
> Yes, they should.

I seem to remember somewhere up-thread that you said that you
were wanting to *increase* the databytes limit. That can only be done
by root -- all others are stuck with no higher than what they started
with.

Is it possible that /etc/login.conf is read by the system at
boot, perhaps by init or some similar process which is spawning the
shells? If so, then the ulimit values will be beyond your control as a
normal user.

Or perhaps a limit has been set in the kernel which will have to
be relaxed before you can change it.

Good Luck,
DoN.

--
Remove oil spill source from e-mail
Email: <BPdnic...@d-and-d.com> | Voice (all times): (703) 938-4564
(too) near Washington D.C. | http://www.d-and-d.com/dnichols/DoN.html
--- Black Holes are where God is dividing by zero ---

Joachim Schipper

unread,
Oct 10, 2011, 3:55:26 AM10/10/11
to
DoN. Nichols <BPdnic...@d-and-d.com> wrote:
> On 2011-10-09, Christian Weisgerber <na...@mips.inka.de> wrote:
>> Steven Schneider <steven_s...@incentre.net> wrote:
>>
>>> >> > Just look at /etc/login.conf (look for e.g. datasize-{max,cur})?
>>> >>
>>> >> Oh, it _is_ datasize! By why didn't altering that change my ulimits
>>> >> on next log in?
>>>
>>> I take it that the settings should be taking upon log in?
>>
>> Yes, they should.
>
> I seem to remember somewhere up-thread that you said that you
> were wanting to *increase* the databytes limit. That can only be done
> by root -- all others are stuck with no higher than what they started
> with.

Normal users can increase their soft limit up to their hard limit, and
their hard limit not at all. However, the hard limit is set (by
login(1), I believe) at log in, to the value specified in
/etc/login.conf (or /etc/login.conf.db if that exists.) That is what
we're talking about.

> Is it possible that /etc/login.conf is read by the system at
> boot, perhaps by init or some similar process which is spawning the
> shells? If so, then the ulimit values will be beyond your control as a
> normal user.

No, it's read on log in.

> Or perhaps a limit has been set in the kernel which will have to
> be relaxed before you can change it.

There are various limits in the kernel, but increasing datasize to 1GB
does not hit any of them.

Joachim

Steven Schneider

unread,
Oct 10, 2011, 4:41:25 PM10/10/11
to
My current changes in /etc/login.conf

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=128:\
:stacksize-cur=4M:\
:localcipher=blowfish,6:\
:ypcipher=old:\
:tc=auth-defaults:\
:tc=auth-ftp-defaults:

However, ulimit -d still shows 512 MB whether I log out and log back
in, or reboot my system and log back in. I suspect that I'm missing
a minor, but important detail.

> This is on a fairly modern, but cheap laptop with 2GB RAM. The above
> settings are completely inappropriate for a multi-user system, since one
> user can force the machine into swap.
>

My machine is essentially single-user though I try to run it more
like a multi-user system (ie. no single large partition for
everything not swap, least privileges, etc...). I'm also lucky
enough to have 8 GB RAM on this machine. That said, if I can get
this to work, and I find I don't need 1024 MB+ I'll be throttling it
back.

Steven Schneider

unread,
Oct 10, 2011, 4:49:15 PM10/10/11
to
* DoN. Nichols <BPdnic...@d-and-d.com> [2011-10-09]:

> On 2011-10-09, Christian Weisgerber <na...@mips.inka.de> wrote:
>> Steven Schneider <steven_s...@incentre.net> wrote:
>>
>>> >> > Just look at /etc/login.conf (look for e.g. datasize-{max,cur})?
>>> >>
>>> >> Oh, it _is_ datasize! By why didn't altering that change my ulimits
>>> >> on next log in?
>>>
>>> I take it that the settings should be taking upon log in?
>>
>> Yes, they should.
>
> I seem to remember somewhere up-thread that you said that you
> were wanting to *increase* the databytes limit. That can only be done
> by root -- all others are stuck with no higher than what they started
> with.
>
Joachim appears to already have answered this. :-)

> Is it possible that /etc/login.conf is read by the system at
> boot, perhaps by init or some similar process which is spawning the
> shells? If so, then the ulimit values will be beyond your control as a
> normal user.

Well, I can definately alter /etc/login.conf so I'd think the
settings should take. I'm beginning to think that I've missed
something as I've had to reboot a couple of times for various
reasons and my ulimit -d hasn't changed.


>
> Or perhaps a limit has been set in the kernel which will have to
> be relaxed before you can change it.

I don't think so. As I said, I'm aware that I've missed something
and though don't know what it is, it doesn't seem to be something
hard-coded.

I may yet be wrong on this....

>
> Good Luck,
>
Thanks.

Message has been deleted

Steven Schneider

unread,
Oct 10, 2011, 5:50:56 PM10/10/11
to
* Hannah <hu47121...@usenet.kitty.sub.org> [2011-10-10]:
> Hi!
>
> Steven Schneider <steven_s...@incentre.net> wrote:
>>[...]

>>My current changes in /etc/login.conf
>
>>default:\
>> :path=/usr/bin /bin /usr/sbin /sbin /usr/X11R6/bin
>> /usr/local/bin /usr/local/sbin:\
>
> If there's that line wrap in your file indeed, just as you quoted it here,
> that's probably a syntax error, rendering (at least) the remaining of
> this entry useless.
>
No, I only added the wrap for the post. That's what I get for
listening to my newsreader instead of thinking for myself. :-)

>>However, ulimit -d still shows 512 MB whether I log out and log back
>>in, or reboot my system and log back in. I suspect that I'm missing
>>a minor, but important detail.
>

> Could be.
>
> Here it is:
>
> Leave default as it is, add
>
> moreres:\
> :datasize-max=infinity:\
> :datasize-cur=1024M:\
> :maxproc-max=512:\
> :maxproc-cur=384:\
> :openfiles-max=2048:\
> :openfiles-cur=1024:\
> :tc=default:
>
> and change my normal user's login class to moreres.
> Mind the backslashes at the end of each line except for the last
> one.
>
Okay, I'll get right on it. Thanks.

Steven Schneider

unread,
Oct 10, 2011, 6:11:07 PM10/10/11
to
* Steven Schneider <steven_s...@incentre.net> [2011-10-10]:

> * Hannah <hu47121...@usenet.kitty.sub.org> [2011-10-10]:
>> Hi!
>>
>> Leave default as it is, add
>>
>> moreres:\
>> :datasize-max=infinity:\
>> :datasize-cur=1024M:\
>> :maxproc-max=512:\
>> :maxproc-cur=384:\
>> :openfiles-max=2048:\
>> :openfiles-cur=1024:\
>> :tc=default:
>>
>> and change my normal user's login class to moreres.
>> Mind the backslashes at the end of each line except for the last
>> one.
>>
Just following up to my own post to record the results.

Thanks Hannah, that did it. It should have been obvious I guess. I
feel kind of silly not figuring it out on my own. :-)

0 new messages