# kernel: maxproc limit exceeded



## motivez (Jan 17, 2009)

I can't seem to find a solution to this.. I've been to several IRC channels and no luck so far.

Server info:



> FreeBSD x 7.0-RELEASE-p8 FreeBSD 7.0-RELEASE-p8 #0: Sat Jan 10 03:59:23 EST 2009     root@x:/usr/obj/usr/src/sys/x  i386



Background: I'm trying to run two TeamSpeak servers on the same account. The server spawns many processes, currently exceeding the value listed when I run the 'limits' command, leading to the processes being killed:



			
				/var/log/messages said:
			
		

> kernel: maxproc limit exceeded by uid 1061, please see tuning(7) and login.conf(5).





> [motivez@x ~]$ limits
> Resource limits (current):
> cputime          infinity secs
> filesize         infinity kB
> ...



However, in my login.conf I have specified a limit greater than that value.. so, wherever that value is set is not respecting the way I have login.conf currently set up for the account.


```
admin:\
[b]        :maxproc=unlimited:\[/b]
        :cputime=unlimited:\
        :filesize=unlimited:\
        :datasize=unlimited:\
        :memorylocked=unlimited:\
        :stacksize=unlimited:\
        :memoryuse=unlimited:\
        :vmemoryuse=unlimited:\
        :openfiles=4096:\
        :tc=default:

[root@x ~]# pw usershow -u 1061
motivez:*:1061:1063:[b]admin[/b]:0:0:User &:/usr/home/motivez:/bin/bash
```

I ran the cap_mkdb /etc/login.conf command after making changes, although my 'default' has maxproc as unlimited as well, so in theory, there should be no limits currently.



> [motivez@x ~]$ ulimit
> unlimited
> 
> [root@x ~]# sysctl -a | grep kern.max
> ...



There's nothing in /boot/loader.conf or /etc/sysctl.conf about the kern.maxproc or anything like that.

Anyone have any ideas? I can't figure out why the information in login.conf isn't being respected, and I can't figure out where the 20 is coming from in with the limits command.. or how to change it.


----------



## SirDice (Jan 18, 2009)

IIRC MAXPROC is set on the fly and is calculated by the amount of memory in your machine. You can also hardcode it in the kernel config. Again IIRC fbsd5 had this in the GENERIC config. If you're using an older kernel conf try and remove the MAXPROC.

These are mine:

```
dice@williscorto:~>limits
Resource limits (current):
  cputime          infinity secs
  filesize         infinity kB
  datasize           524288 kB
  stacksize           65536 kB
  coredumpsize     infinity kB
  memoryuse        infinity kB
  memorylocked     infinity kB
  maxprocesses         5547
  openfiles           22500
  sbsize           infinity bytes
  vmemoryuse       infinity kB
```


----------



## danger@ (Jan 18, 2009)

have you logged out and in after you changed login.conf?


----------



## mvip (Feb 16, 2009)

I'm having almost exact the same problem, but with 'openfiles.' I think I've done pretty much everything. Similarly to motivez, the 'limit' value never seems to change, and limits.conf is set to 'unlimited'. For some reason I don't think the login.conf settings takes affect, as I tried to set a value, logout and in again, but the value was still the same. 

I've also tried to override the value by hand, but fail to do so too.


```
$ ulimit -n
2656
$ ulimit -n 20000
-bash: ulimit: open files: cannot modify limit: Operation not permitted
```

The server is running 7.0. I've spent hours Googling, but can't seem to find any solution.


----------



## mvip (Feb 18, 2009)

I found the solution to at least my problem. By raising the sysctl values (kern.maxfiles and kern.maxfilesperproc) and then logout and in again, 'uname -n' was raised to the value of 'kern.maxfilesperproc'


----------



## David Okwii (May 9, 2016)

Hello, am having this exact issue "maxproc limit exceeded by uid 0, please see tuning and login.conf". Unfortunately I can't SSH into the server. I plan to reboot, maybe this will fix my issue.


----------

