Runtime error 67 too many files

runtime error 67 too many files › onedrive-issue-with-too-many-files. This appendix contains a complete listing of the error codes for all trappable errors 67. Too many files. 68. Device unavailable. 70. Permission denied. For this 4GL runtime error, check the message for -number. 4153 SQL statement error -67 Too many processes. -104 ISAM error: too many files open.

Runtime error 67 too many files - criticism advise

sort -rn head -15

Seeing the processes that use the most file handles

To see more or fewer entries adjust the parameter to the command. Once you’ve identified the process, you need to figure out whether it has gone rogue and is opening too many files because it is out of control, or whether it really needs those files. If it does need them, you need to increase its file handle limit.

Increasing the Soft Limit

If we increase the soft limit and run our program again, we should see it open more files. We’ll use the command and the (open files) option with a numeric value of 2048. This will be the new soft limit.

ulimit -n 2048

Setting a new file handle soft limit for processes

This time we successfully opened 2045 files. As expected, this is three less than 2048, because of the file handles used for , , and .

Making Permanent Changes

Increasing the soft limit only affects the current shell. Open a new terminal window and check the soft limit. You’ll see it is the old default value. But there is a way to globally set a new default value for the maximum number of open files a process can have that is persistent and survives reboots.

Out-dated advice often recommends you edit files such as “/etc/sysctl.conf” and “/etc/security/limits.conf.” However, on systemd-based distributions, these edits don’t work consistently, especially for graphical log-in sessions.

The technique shown here is the way to do this on systemd-based distributions. There are two files we need to work with. The first is the “/etc/systemd/system.conf” file. We’ll need to use .

sudo gedit /etc/systemd/system.conf

Editing the system.conf file

Search for the line that contains the string “DefaultLimitNOFILE.” Remove the hash “#” from the start of the line, and edit the first number to whatever you want your new soft limit for processes to be. We chose 4096. The second number on that line is the hard limit. We didn’t adjust this.

The DefaultLimitNOFILE value in the system.conf file

Save the file and close the editor.

We need to repeat that operation on the “/etc/systemd/user.conf” file.

sudo gedit /etc/systemd/user.conf

Editing the user.conf file

Make the same adjustments to the line containing the string “DefaultLimitNOFILE.”

The DefaultLimitNOFILE value in the user.conf file

Save the file and close the editor. You must either reboot your computer or use the command with the option so that is re-executed and ingests the new settings.

sudo systemctl daemon-reexec

Restarting systemd

Opening a terminal window and checking the new limit should show the new value you set. In our case that was 4096.

ulimit -n

Checking the new soft limit with ulimit -n

We can test this is a live, operational value by rerunning our file-greedy program.


Checking the new soft limit with the open-files program

The program fails to open file number 4094, meaning 4093 were files opened. That’s our expected value, 3 less than 4096.

Everything is a File

That’s why Linux is so dependent on file handles. Now, if you start to run out of them, you know how to increase your quota.

RELATED:What Are stdin, stdout, and stderr on Linux?