Apache2 fails to start with libapache2-mod-fcgid: No such file or directory: mod_fcgid

Bug #1266400 reported by Stephen
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
libapache2-mod-fcgid (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

When I upgraded to saucy, Apache2 failed to start with the full error in /var/log/apache2/error_log:

[Sun Jan 05 07:32:52.418401 2014] [fcgid:emerg] [pid 15690:tid 3074378304] (2)No such file or directory: mod_fcgid: Can't create shared memory for size 1167812 bytes

This appears to be because the configuration directive for SharememPath used by mod_fcgid is not set correctly in the configuration files. That variable needs to be set to a directory that is created and empty. Such a directory seems to exist: /var/lib/apache2/module/enabled_by_admin/fcgid

I was able to add this to my Apache configuration to solve the issue:

<IfModule mod_fcgid.c>
  SharememPath /var/lib/apache2/module/enabled_by_admin/fcgid
</IfModule>

This SharememPath setting should be made by default in /etc/apache2/mods-available/fcgid.conf

ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: libapache2-mod-fcgid 1:2.3.9-1
ProcVersionSignature: Ubuntu 3.11.0-14.21-generic 3.11.7
Uname: Linux 3.11.0-14-generic i686
ApportVersion: 2.12.5-0ubuntu2.2
Architecture: i386
Date: Mon Jan 6 04:14:00 2014
Dependencies:
 gcc-4.8-base 4.8.1-10ubuntu9
 libc6 2.17-93ubuntu4
 libgcc1 1:4.8.1-10ubuntu9
 multiarch-support 2.17-93ubuntu4
InstallationDate: Installed on 2011-06-16 (935 days ago)
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386 (20110427.1)
MarkForUpload: True
SourcePackage: libapache2-mod-fcgid
UpgradeStatus: Upgraded to saucy on 2014-01-02 (3 days ago)

Revision history for this message
Stephen (1012web) wrote :
Revision history for this message
Felix Geyer (debfx) wrote :

SharememPath (aka FcgidProcessTableFile) defaults to /var/lib/apache2/fcgid/shm.
Does /var/lib/apache2/fcgid exist on your system and is owned by www-data?

Revision history for this message
Stephen (1012web) wrote :

shm does not exist in that location on my saucy system

$ ls -lah /var/lib/apache2/fcgid/
total 12K
drwxr-xr-x 3 root root 4.0K Jan 5 16:04 .
drwxr-xr-x 6 root root 4.0K Jan 5 11:42 ..
drwx------ 2 www-data root 4.0K Jan 6 10:25 sock

Revision history for this message
Stephen (1012web) wrote :

I used apt to remove the apache module and re-install it. The directory does not get recreated by the installation.

$ sudo apt-get remove --purge libapache2-mod-fcgid
$ sudo rm -rf /var/lib/apache2/fcgid/
$ sudo apt-get install libapache2-mod-fcgid
$ ls -lah /var/lib/apache2/fcgid/
total 12K
drwxr-xr-x 3 www-data www-data 4.0K Jan 6 12:55 .
drwxr-xr-x 6 root root 4.0K Jan 6 12:55 ..
drwxr-xr-x 2 www-data www-data 4.0K Oct 11 14:15 sock

Revision history for this message
Stephen (1012web) wrote :

I have a machine still running raring. The "shm" file exists on it. If I purge and re-install libapache2-mod-fcgid, the "shm" file does get re-created:

$ ls -lah /var/lib/apache2/fcgid/
total 32K
drwxr-xr-x 3 www-data root 4.0K Jan 6 02:03 .
drwxr-xr-x 3 root root 4.0K Oct 31 2012 ..
-rw-r--r-- 1 root root 4 Jan 6 02:03 shm
drwxr-xr-x 2 www-data www-data 20K Jan 6 10:29 sock

The creation of this directory must not be happening anymore during the installation of libapache2-mod-fcgid

Revision history for this message
Stephen (1012web) wrote :

I can confirm that the server starts fine with no configuration changes (I removed the workaround I had suggested earlier) when I create the file/ var/lib/apache2/fcgid/shm

$ sudo touch /var/lib/apache2/fcgid/shm
$ ls -lah /var/lib/apache2/fcgid/
total 16K
drwxr-xr-x 3 www-data www-data 4.0K Jan 6 13:01 .
drwxr-xr-x 6 root root 4.0K Jan 6 12:55 ..
-rw-r--r-- 1 root root 4 Jan 6 13:01 shm
drwxr-xr-x 2 www-data www-data 4.0K Jan 6 13:02 sock

It is owned by root and has the same permissions as on my "raring" machine.

Revision history for this message
Felix Geyer (debfx) wrote :

Not sure what's going on there. I can't reproduce the problem.
/var/lib/apache2/fcgid/shm is not supposed to be created by the package but apache creates it on startup.

Revision history for this message
Stephen (1012web) wrote :

I think I see what the problem was. Based on one of my early comments the /var/lib/apache2/fcgid/ directory was owned by root so the file couldn't be created there by apache running as www-data

It looks like the permissions were reset when I purged and reinstalled the package. I can confirm that the shm file disappears when I stop apache2 and re-appears when I start it.

Revision history for this message
janl (janl) wrote :

Same problem on machine upgraded from 12.04.<last> to 14.04.

/var/lib/apache2/fcgid/ does not exist.
/var/lib/apache2 is owned by root

32633 open("/var/log/apache2/kqview-access.log", O_WRONLY|O_CREAT|O_APPEND|O_CLOEXEC, 0666) = 13
32633 open("/var/lib/apache2/fcgid/shm", O_WRONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
32633 open("/var/lib/apache2/fcgid/shm", O_WRONLY|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = -1 ENOENT (No such file or directory)
32633 write(2, "[Fri May 02 12:21:17.679303 2014] [fcgid:emerg] [pid 32633:tid 139668710119296] (2)No such file or directory: mod_fcgid: Can't create shared memory for size 1200712 bytes\n", 171) = 171

....

<email address hidden># mkdir /var/lib/apache2/fcgid
<email address hidden># chown www-data:www-data /var/lib/apache2/fcgid
<email address hidden># /etc/init.d/apache2 start
 * Starting web server apache2 *
<email address hidden># ls -l /var/lib/apache2/fcgid
total 8
-rw-r--r-- 1 root root 8 mai 2 12:26 shm
drwx------ 2 www-data root 4096 mai 2 12:26 sock

Revision history for this message
Dan Porter (stealthii) wrote :

Ensure that the `slotmem_shm` module is loaded by Apache, and see if the problem still persists.

https://issues.apache.org/bugzilla/show_bug.cgi?id=52841#c1

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in libapache2-mod-fcgid (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.