apache down every day and can not not start

arazit

Verified User
Joined
Aug 20, 2008
Messages
199
I checked apache log file
errors:
[Mon Aug 31 17:47:14 2009] [emerg] (28)No space left on device: Couldn't create accept lock (/var/logs/accept.lock.31750) (5)

[Mon Aug 31 17:47:14 2009] [emerg] (28)No space left on device: Couldn't create accept lock (/var/logs/accept.lock.31750) (5)
[Mon Aug 31 17:48:02 2009] [warn] RSA server certificate CommonName (CN) `server.sina.com' does NOT match server name!?
[Mon Aug 31 17:48:02 2009] [warn] RSA server certificate CommonName (CN) `server.sina.com' does NOT match server name!?
[Mon Aug 31 17:48:02 2009] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Mon Aug 31 17:48:02 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Aug 31 17:48:02 2009] [notice] ModSecurity for Apache/2.5.9 (http://www.modsecurity.org/) configured.
[Mon Aug 31 17:48:02 2009] [notice] Original server signature: Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8k DAV/2
[Mon Aug 31 17:48:03 2009] [warn] RSA server certificate CommonName (CN) `server.sina.com' does NOT match server name!?
[Mon Aug 31 17:48:03 2009] [warn] RSA server certificate CommonName (CN) `server.sina.com' does NOT match server name!?
[Mon Aug 31 17:48:03 2009] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Mon Aug 31 17:48:03 2009] [warn] pid file /var/run/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Mon Aug 31 17:48:03 2009] [emerg] (28)No space left on device: Couldn't create accept lock (/var/logs/accept.lock.31903) (5)
 
Remove crap on /var partition that you dont need.

Use this command to find large files:

Code:
du -h /var | grep '^.*[0-9]M' | sort -n
 
Code:
/sbin/service mysqld stop

mkdir -p /usr/var/lib

mv /var/lib/mysql /usr/var/lib/mysql

ln -s /var/lib/mysql /usr/var/lib/mysql

/sbin/service mysqld restart
 
Mysql can not start
ERROR! Manager of pid-file quit without updating file.
ERROR! Failed to stop running server, so refusing to try to start.
 
likely you deleted mysql-bin.xxx files that are still defined in mysql-bin.index check the folder for the log files and then check mysql-bin.index in that folder if there aren't any missing files defined.
 
Code:
/sbin/service mysqld stop

mkdir -p /usr/var/lib

mv /var/lib/mysql /usr/var/lib/mysql

ln -s /var/lib/mysql /usr/var/lib/mysql

/sbin/service mysqld restart
I moved mysql dir to /usr/var/lib/mysql bud apache down again
apache log:
[Mon Sep 07 00:36:03 2009] [warn] pid file /var/run/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Mon Sep 07 00:36:03 2009] [emerg] (28)No space left on device: Couldn't create accept lock (/var/logs/accept.lock.15515) (5)
 
Possible solutions:

1) see the fix above for the semget problem, or Google these words:
directadmin apache no space left on device; I found some helpful threads including this one.

2) check your /var partition; it may be out of space. If it is, the quick and dirty fix is to delete some old logfiles as follows:
Code:
# cd /var/log
# rm *.?
(Note do not type the # character; it's only there so you'll know to do this as root.)

3) Hire someone (us?) to log in and fix it for you. Actually I can't believe you've let this problem go on for seven days without getting it fixed. I sure hope you don't lose any paying clients down for seven days.

Jeff
 
It is NOT recommended that you do this on a working server. If you decide to do it be sure you have a backup you can restore. You've been warned.

You'll need low-level partition managment software compatible with the file system you've got installed on your server.

Gnu Parted should work on both Linux and FreeBSD.

However, unless you're very familiar with systems administration, and have a full backup and are willing to restore from it if necessary (after a bare-metal OS restore), do not attempt this.

It should work if you follow the instructions, but if it breaks you're facing a bare-metal reinstall.

Jeff
 
This is your solution :)

# ipcs -s | grep apache

# ipcs -s | grep apache | perl -e 'while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'

then

You can fix it complate :

add these lines to your /etc/sysctl.conf

kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024
 
The solution to "No space left on device." Many times its a semaphore issue not a disk space issue.
 
I just had the same problem on one of our servers.

What is causing all these stuck semaphores ?

Any other solution than adding :
ipcs -s | grep apache | perl -e 'while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'

to the crontab ?
 
You may want to increase your available semaphores. Add this to /etc/sysctl.conf:

kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024

And then run sysctl -p to pick up the new changes.


http://rackerhacker.com/2007/08/24/apache-no-space-left-on-device-couldnt-create-accept-lock/

I config this But get this error yet and apache down every day

[Wed Mar 24 01:18:14 2010] [warn] Init: You should not use name-based virtual hosts in conjunction with SSL!!
[Wed Mar 24 01:18:14 2010] [emerg] (28)No space left on device: Couldn't create accept lock (/var/log/httpd/accept.lock.13543) (5)


I get this error in sysctl -p in ssh

net.ipv4.ip_forward = 0
error: "Operation not permitted" setting key "net.ipv4.tcp_syncookies"
kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024


My server is Openvz ( hypervm )
OS: centos 5.4 32bit
 
Last edited:
Why is net.ipv4.tcp_syncookies in the file? The instructions did not say anything about net.ipv4.tcp_syncookies.
 
Back
Top