Subject: Re: [vserver] Increasing fd limit in guest
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Wed, 9 Apr 2014 12:54:19 +0200

On Wed, Apr 09, 2014 at 12:02:33PM +0200, Oliver Welter wrote:
> Hi Folks,

> I am sure that I am just overseeing an obvious thing 
> but I dont get it myself...

> Problem: My vserver guest reports a fd limit of 1024 
> (ulimit -n)

ulimit -n shows the 'soft' limit per user set in the
current shell (bash). there is also a hard limit which
can be shown with ulimit -Hn

ulimits (hard and soft) can be set via

  /etc/vservers/<vserver-name>/ulimits

> Approach:
> echo 4096 > /etc/vservers/mail/rlimits/nofile

that will set the per guest limit of kernel file
structures (in this case, hard and soft)

> ls -l /etc/vservers/mail/rlimits
> -rw-r--r-- 1 root root    5 Apr  9 11:52 nofile

> I restartet the guest but the new limit does not show 
> up in the /proc/virtual/ctx/ 

that is suspicious. I just tested with the current
3.4.83-vs2.3.3.9 and it works as expected, here
a short test for you to reproduce:

 # chcontext --xid 42 -- sleep 100000 &
 # grep FILES /proc/virtual/42/limit
 # vlimit --xid 42 --nofile 99
 # grep FILES /proc/virtual/42/limit

if that doesn't show you the 99 as limit, then
something with your kernel is wrong, if the config
change in /etc/vservers/<vserver-name>/rlimits
doesn't change the setting after a guest restart,
then something with your tools is wrong.

> neither does ulimit report the new value.

this is perfectly fine, as the ulimits are something
different. also note that changing the ulimit config
for the guest does not necessarily change what you
will see in the guest, as the guest can lower the
limit (and usually does)

> What am I doing wrong?

basically using the wrong config file.

HTH,
Herbert

> vserver-info says:
>                    Kernel: 3.4.50-vs2.3.3.9-aufs-v5
>                    VS-API: 0x00020308
>                       VCI: 0x0000000013001f11
>              util-vserver: 0.30.216-pre3038; Feb 22 2013, 00:41:48

> TIA

> Oliver

> -- 
> Protect your environment -  close windows and adopt a penguin!