Apache 2.4 AH01762 & AH01760: failed to initialize shm (Shared Memory Segment)

Mattias Geniar, Tuesday, January 12, 2016

I recently ran into the following problem on an Apache 2.4 server, where after server reboot the service itself would no longer start.

This was the error whenever I tried to start it:

$ tail -f error.log
[auth_digest:error] [pid 11716] (2)No such file or directory:
   AH01762: Failed to create shared memory segment on file /run/httpd/authdigest_shm.11716
[auth_digest:error] [pid 11716] (2)No such file or directory:
   AH01760: failed to initialize shm - all nonce-count checking, one-time nonces,
   and MD5-sess algorithm disabled

Systemd reported the same problem;

$ systemctl status -l httpd.service
 - httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since ...

The cause is shown in the first error message: Failed to create shared memory segment on file /run/httpd/authdigest_shm.11716.

If I traced this, I noticed the directory /run/httpd no longer existed. The simple fix in this case, was to re-create that missing directory.

$ mkdir /run/httpd
$ chown root:httpd /run/httpd
$ chmod 0710 /run/httpd

The directory should be owned by root and writeable for the root user. The Apache group (in my case, httpd), needs executable rights to look into the directory.

Hi! My name is Mattias Geniar. I'm a Support Manager at Nucleus Hosting in Belgium, a general web geek & public speaker. Currently working on DNS Spy & Oh Dear!. Follow me on Twitter as @mattiasgeniar.

Share this post

Did you like this post? Will you help me share it on social media? Thanks!


kostyrevaa Thursday, January 14, 2016 at 11:09 - Reply

and why did the directory disappear you don’t even care?

    Mattias Geniar Thursday, January 14, 2016 at 11:51 - Reply

    I do care, but I couldn’t find the reason: either a manual screw-up on my part, a package update/upgrade that incorrectly removed the file or an allignment in the stars that didn’t add up.

    The cause is unknown but I have a fix if it ever happens again. ;-)

Andrae Wednesday, June 15, 2016 at 17:58 - Reply

Thanks for sharing this. I encountered the same problem and was unable to start httpd. My server is on AWS i’m not sure why the restart would cause that directory to disappear.

Etienne Thursday, July 21, 2016 at 22:52 - Reply

I got the same issue. Caused after a yum update on CentOS 7.2
However, restarting the server fixed the issue

Harald Reindl Thursday, January 26, 2017 at 18:28 - Reply

well, because /run is tmpfs and folders needs to be created at boot by https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html it’s that simple

Ben Thursday, February 9, 2017 at 17:15 - Reply

This same thing happened to me due to changing the /etc/group file (we have a separate system that controls this file and pushes changes automatically). I didn’t include the apache group, so apache couldn’t start. I re-added the group, but this directory was missing. I had to make one subtle change to your commands – I used apache instead of httpd as the group. Otherwise, this worked great. Thanks for posting!

Wieger Friday, August 25, 2017 at 16:00 - Reply

Perhaps it is useful to menstion the bug report: https://bz.apache.org/bugzilla/show_bug.cgi?id=54622

Leave a Reply

Your email address will not be published. Required fields are marked *