• How to increase the number of semaphores in Linux?

If you occasionally see the following error when running backups or file copies on Linux:

Limit for the maximum number of semaphores reached. You can check and set the limits in /proc/sys/kernel/sem.\n

You may need to increase the maximum number of semaphores on your Linux server.

If you read the manpage for semget, in the Notes section you'll notice:

System wide maximum number of semaphore sets: policy dependent (on Linux, this limit can be read and modified via the fourth field of /proc/sys/kernel/sem).

You can check the current semaphore limit on your server by running:

cat /proc/sys/kernel/sem
250 32000   32  128

Then to increase the limit to 200 for example echo it back after increasing the last number:

printf '250\t32000\t32\t200' >/proc/sys/kernel/sem

This article was last modified: Feb. 7, 2019, 11:24 a.m.


Please log in to leave a comment.

Add or change tags.

A comma-separated list of tags.


Hacker News