Apache doesn't start if /var/log/apache2 is missing

Bug #936216 reported by Sworddragon on 2012-02-19
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Apache2 Web Server
apache2 (Ubuntu)

Bug Description

I'm using Ubuntu 12.04 dev with apache2 2.2.22-1ubuntu1. If the directory /var/log/apache2 doesn't exist the apache server can't start:

sworddragon@ubuntu-vm:~$ sudo /etc/init.d/apache2 start
 * Starting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
(2)No such file or directory: apache2: could not open error log file /var/log/apache2/error.log.
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.

I think /etc/init.d/apache2 should check for this directory and create it if it is missing.

tags: added: upstream
Changed in apache2 (Ubuntu):
status: New → Triaged
importance: Undecided → Low
Jason Wood (sandain) wrote :

This requires systemd 235, which is in the Bionic Beaver, but a good fix for this issue would be to simply modify the apache2.service file to include the LogsDirectory directive.

Jason Wood (sandain) wrote :

I should note that I hit this issue only because I use tmpfs to mount /var/log on one of my systems where I don't care about logs surviving a restart. This is obviously non-standard, so it is of low priority, but it would be nice if the above patch could make it into the next version of Ubuntu.

The attachment "patch.diff" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch

Hi Jason,
I wanted to thank you for your participation.
But on the suggested change I have a few comments.

First of all if you install apache2 it will create /var/log/apache2 by debian/apache2.dirs in the packaging telling it to do so.
I see that if you run on tmpfs you'll loose that directory on e.g. reboots and then run into this issue.
But then it is kind of a special configuration that has to take care.

I like that "just" adding this single line would solve a very old apache bug so trivially.
But there are a few things to be considered.
First of all the dir is configurable in /etc/apache2/envvars and then reused.
 $ grep -Hrn APACHE_LOG_DIR /etc/

So the change to the service file (if not denied by some other implications systemd makes on it).
Maybe with

To be clear I like it, but I think you should address this upstream instead of in a deviation by Ubuntu.
But maybe you can give some live to the old bug if you would suggest that there (feel free to incooperate my suggestions)?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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