# kern.maxfiles limit exceeded when opening Thunar as root



## bigtoque (Jun 20, 2011)

I get a kern.maxfiles error when I *su* into root and open Thunar. kern.maxfiles on my system is 12328

If I look at kern.openfiles when I'm just a single user logged in, the count is ~3000, but as soon at as I open Thunar as root, the number jumps to ~9000, and after a few clicks, no files show up in Thunar and in the terminal I see 
	
	



```
kern.maxfiles limit exceeded by uid 1001
```
 and 
	
	



```
kern.maxfiles limit exceeded by uid 560
```

In the Handbook under "Tuning Kernel Limits" it says that kern.openfiles is set based on kern.maxusers which is based on the amount of system memory. I've got 4GB of ram and kern.maxusers is set at 384 automatically. The Handbook says "We do not recommend going above 256 unless you need a huge number of file descriptors"

I'm the only person that uses this computer, and I'm just using it as a desktop computer. There are never more than a few applications running at any given time, so I'm definitely not taxing the system.

Is this something I should fix by increasing the kern.maxusers value? Or is there something fundamentally wrong with *su*ing into root and running Thunar as root when I want to edit files?


----------



## gordon@ (Jun 20, 2011)

Generally, don't run a bunch of X applications as root. If you want to manage files as the root user, I would recommend using the command line.


----------



## bigtoque (Jun 21, 2011)

I can't think of anything I do as root other than installing/upgrading ports, and loading up Thunar if I need to edit a few files quickly. Working with files from the command line is still a major PITA for me. Surely running one program as root for a few minutes shouldn't be reason enough for the system to start throwing error messages.

In reference to my specific problem, would there be any problem with increasing the kern.maxusers value? Or is there something else that's wrong with my system that's causing kern.openfiles value to exceed kern.maxfiles when I load Thunar as root?


----------



## SirDice (Jun 21, 2011)

bigtoque said:
			
		

> In reference to my specific problem, would there be any problem with increasing the kern.maxusers value?


Don't touch kern.maxusers, the default is fine. Increasing kern.maxfiles is not a problem at all though. It's even recommended by a port (forgot which one).

Just edit /boot/loader.conf and add:

```
kern.maxfiles="25000"
```


----------

