Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In a Debian lenny server running postgresql, I noticed that a lack of semaphore arrays is preventing Apache from starting up.

Looking at the limits, I see 128 arrays used out of 128 arrays maximum, for semaphores. I know this is the problem because it happens on a semget call.

How do I increase the number of arrays?

PS: I need Apache running to make use of phppgadmin.

share|improve this question
    
I'm kind of surprised you managed to hit that limit -- I run apache and pgsql on multiple servers at my workplace without encountering that limit. One thing that might be of help is that phppgadmin doesn't necessarily need to run on the same server as postgresql... –  Shadur May 6 '11 at 16:56
    
@Shadur I suspect there are lost semaphores from early crashes. I can't do anything about that at the moment, though, so I'm considering my other options. –  Daniel C. Sobral May 6 '11 at 17:04
    
In that case I recommend you find some way to clear the lost semaphores and find out what keeps crashing, or raising the limit will just get you in trouble again when the new limit is reached... –  Shadur May 6 '11 at 17:53
    
@Shadur It is not crashing anymore, but to clear the semaphores I need to stop the database, and it will take a while before I get a window to do that. –  Daniel C. Sobral May 6 '11 at 18:47
    
You can RECOMPILE, the Linux OS, and increase the hard limit. I bumped it up to thousands, because that's what I was using for one client (they were porting unix code to linux).. norman. –  norman Aug 15 at 21:36

1 Answer 1

up vote 6 down vote accepted

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).

On my system, cat /proc/sys/kernel/sem reports:

250 32000   32  128

So do that on your system, and then echo it back after increasing the last number:

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

(There are tab characters between the numbers, so I'm using printf to generate them.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.