20 February 2018

APACHE - failed to start

[On]
Red Hat Enterprise Linux Server release 7.4 (Maipo)

Apache was not running and attempt to start the httpd service failed. The natural thing as a sysadmin you would check the error_log. 

# systemctl restart httpd
# tail -f /var/log/httpd/error_log (location could be different on your installation)
--- error snippet---
[Tue Feb 20 17:57:32.667940 2018] [auth_digest:error] [pid 6256] (28)No space left on device: AH01762: Failed to create shared memory segment on file /run/httpd/authdigest_shm.6256
[Tue Feb 20 17:57:32.667948 2018] [auth_digest:error] [pid 6256] (28)No space left on device: AH01760: failed to initialize shm - all nonce-count checking, one-time nonces, and MD5-sess algorithm disabled
--- error snippet---

2 things to observe here. 
  1. no space left of device
  2. failed to create shared memory
As it turns out /run partition was used up 100% - which explains the subsequent error -  no. 2. 

Basically - the issue here is Apache has been leaving some stuff behind in shared memory. So the next command list those stuffs 

# ipcs -s (s is semaphores)

--- output ---
------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0x00000000 3375104    apache     600        1
0x00000000 3407873    apache     600        1
0x00000000 2359298    apache     600        1
0x00000000 3440643    apache     600        1
0x00000000 3473412    apache     600        1
0x00000000 3506181    apache     600        1
--- output ---

You may proceed to remove the semaphores (apache only) by executing this command
# ipcrm -s  {semid} (if possible one after another)

Then proceed with restarting the httpd service
# systemctl restart httpd
# systemctl status httpd (verify Apache is running)
# ipcs -s (verify the semaphores are cleared)

Also, it is a good practice to reboot your machine once in 2 or 3 months that will actually clear the unused semaphores. 

No comments:

APACHE - failed to start

[On] Red Hat Enterprise Linux Server release 7.4 (Maipo) Apache was not running and attempt to start the httpd service failed. The natural t...