# apache-2.4.3: Invalid Mutex directory

## musv

After upgrading apache from 2.2.2 to 2.4.3, that thing refuses to start. First it complained about 70_mod_php5.conf. So I rebuilt php. Now it complains about ssl. Rebuilding openssl didn't help unfortunately:

```
/etc/init.d/apache2 start

 * apache2 has detected an error in your setup:

[Sun Oct 14 17:56:05.958259 2012] [core:warn] [pid 8264:tid 140579589965632] AH00111: Config variable ${SVN_REPOS_LOC} is not defined

[Sun Oct 14 17:56:05.958314 2012] [core:warn] [pid 8264:tid 140579589965632] AH00111: Config variable ${SVN_REPOS_LOC} is not defined

AH00526: Syntax error on line 60 of /etc/apache2/modules.d/40_mod_ssl.conf:

Invalid Mutex directory in argument file:/var/run/apache_ssl_mutex

 * ERROR: apache2 failed to start
```

Digging into the failed line:

```
Mutex file:/var/run/apache_ssl_mutex ssl-cache
```

I don't have any idea what to do with this error message.

----------

## NeddySeagoon

musv,

/var/run as been moved to /run in tmpfs

Try 

```
touch /var/run/apache_ssl_mutex
```

to ensure the file exists, then start apache2 again.

If it works now, it will fail after the next boot as the file will vanish from tmpfs.

All I can get from apache2 is Segmentation Fault, but I'm using gcc-4.7.2 on ARM.

----------

## musv

```
touch /var/run/apache_ssl_mutex

/etc/init.d/apache2 start

 * apache2 has detected an error in your setup:

[Sun Oct 14 20:07:23.096968 2012] [core:warn] [pid 12346:tid 140489590036288] AH00111: Config variable ${SVN_REPOS_LOC} is not defined

[Sun Oct 14 20:07:23.097027 2012] [core:warn] [pid 12346:tid 140489590036288] AH00111: Config variable ${SVN_REPOS_LOC} is not defined

AH00526: Syntax error on line 60 of /etc/apache2/modules.d/40_mod_ssl.conf:

Invalid Mutex directory in argument file:/var/run/apache_ssl_mutex

 * ERROR: apache2 failed to start
```

I'll guess, I go back to Apache 2.2.

----------

## daniel12345

```
mkdir /var/run/apache_ssl_mutex
```

 helped in my case. But as I'm not using SSL, it is not rellay tested  :Smile: 

----------

## musv

In my case, it didn't change a thing. The error message still showed up. After downgrading it worked again like expected. 

I use the apache server only for my local wiki. Therefore it's no pressure to upgrade. I can wait a year more, until the 2.4 seems more mature.

----------

## krizalys

 *musv wrote:*   

> In my case, it didn't change a thing. The error message still showed up. After downgrading it worked again like expected.

 

Do you mean that it did not even work one time? As suggested by Neddy & Daniel, manually creating the missing directory should allow Apache 2.4 to start until you reboot your machine. To solve the problem permanently, the apache init script may be modified.

----------

## toralf

Probably this line has to be changed too : 

```
SSLSessionCache                 shmcb:/run/ssl_scache(512000)
```

FWIW : https://bugs.gentoo.org/show_bug.cgi?id=438758

----------

## Tony0945

I fixed this by editing /etc/init.d/apache2 near line 60 

```

checkconfd() {

        if [ ! -f /etc/init.d/sysfs ]; then

                eerror "This init script works only with openrc (baselayout-2)."

                eerror "If you still need baselayout-1.x, please, use"

                eerror "apache2.initd-baselayout-1 from /usr/share/doc/apache2-$

        fi

# kludge to fix bug

        if [ ! -d /run/apache_ssl_mutex ]; then

                mkdir /run/apache_ssl_mutex

        fi

# end kludge

...

```

It works now and no warning messages, but I would sure like an official fix instead of a kludge by a guy (me!) who doesn't understand the code.

----------

## FizzyWidget

mkdir /var/run/apache_ssl_mutex 

fixed it for me

----------

## toralf

 *Dark Foo wrote:*   

> mkdir /var/run/apache_ssl_mutex 
> 
> fixed it for me

 really - pls reboot and check again

----------

## FizzyWidget

aw ffs  :Sad: 

edit

adding

mkdir -p /var/run/apache_ssl_mutex

from the bug tracker to the conf.d file seems to have sorted it, even after a reboot  :Smile: 

----------

## toralf

putting this 1 line into the init.d file 

```
checkpath --directory /var/run/apache_ssl_mutex
```

directly after "start() {" does the trick tooLast edited by toralf on Sat Jan 12, 2013 3:31 pm; edited 1 time in total

----------

## FizzyWidget

cool - thanks  :Smile: 

----------

## Mr.Aleksandrs

nano -w /etc/apache2/modules.d/40_mod_ssl.conf

Needed just commenting this line

```

## Semaphore:

# Configure the path to the mutual exclusion semaphore the SSL engine uses

# internally for inter-process synchronization.

# Mutex file:/var/run/apache_ssl_mutex ssl-cache

</IfDefine>

```

and 

```
 

/etc/init.d/apache2 start

 * /run/apache_ssl_mutex: creating directory

 * Starting apache2 ...         

```

 :Very Happy: 

----------

## mwoodiupui

1:  replace "/var/run" with "/run" everywhere in /etc/apache2/modules.d/40_mod_ssl.conf.  (The upgrade process should provide a new version of this file with the new paths.)

2:  move 'checkpath --directory /run/apache_ssl_mutex' one line up, to be the first line of start(), so that the now-subsequent 'checkconfig || return 1' won't return due to the directory not having been created yet.

----------

## pjturmel

 *musv wrote:*   

> After upgrading apache from 2.2.2 to 2.4.3, that thing refuses to start.
> 
> . . . 
> 
> ```
> ...

 

I'm trying out systemd for the first time (clean install on a new system), and ran into this, too:

```
apache2[31767]: AH00526: Syntax error on line 60 of /etc/apache2/modules.d/40_mod_ssl.conf:

apache2[31767]: Invalid Mutex directory in argument file:/run/apache_ssl_mutex
```

The solution was to use "systemctl edit apache2" to add the following override:

```
[Service]

# Run ExecStartPre with root-permissions

PermissionsStartOnly=true

ExecStartPre=/bin/mkdir -p /run/apache_ssl_mutex
```

Thanks to Jari Turkia for the solution.

----------

