apache2.2-common: /etc/init.d/apache2 script is empty

Bug #392532 reported by Calvin Mitchell on 2009-06-26
40
This bug affects 6 people
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)
Undecided
Unassigned
logrotate (Debian)
Fix Released
Unknown
logrotate (Ubuntu)
Undecided
Dave Walker

Bug Description

Binary package hint: apache2-common

Source Package: apache2.2-common, 2.2.11-6ubuntu1
lsb_release -rd:
Description: Ubuntu karmic (development branch)
Release: 9.10
apt-cache policy apache2.2-common:
apache2.2-common:
  Installed: 2.2.11-6ubuntu1
  Candidate: 2.2.11-6ubuntu1
  Version table:
 *** 2.2.11-6ubuntu1 0
        500 http://us.archive.ubuntu.com karmic/main Packages
        100 /var/lib/dpkg/status
EXPECTED for /etc/init.d/apache2 script to load web server service.
WHAT HAPPENED: nothing...the script was completely empty of contents...size 0.

Hassan El Jacifi (waver) wrote :

root@ubuntu:/var# ls -lh /etc/init.d/apache2
-rwxr-xr-x 1 root root 6.4K 2009-06-09 14:28 /etc/init.d/apache2

Sorry, I can't reproduce this bug on :

root@ubuntu:~# uname -a
Linux ubuntu 2.6.30-10-server #12-Ubuntu SMP Mon Jun 22 17:22:00 UTC 2009 x86_64 GNU/Linux

root@ubuntu:~# dpkg -l apache\* | grep ^ii
ii apache2 2.2.11-6ubuntu1 Apache HTTP Server metapackage
ii apache2-mpm-worker 2.2.11-6ubuntu1 Apache HTTP Server - high speed threaded mod
ii apache2-utils 2.2.11-6ubuntu1 utility programs for webservers
ii apache2.2-bin 2.2.11-6ubuntu1 Apache HTTP Server common binary files
ii apache2.2-common 2.2.11-6ubuntu1 Apache HTTP Server common files

Can you provide more information about your configuration (LVM, encryption, ....)

Changed in apache2 (Ubuntu):
status: New → Incomplete
Calvin Mitchell (calvin674) wrote :

Hassan: thank you for your attention on this matter!

Dell Inspiron E1505, 2.08GB RAM, 32.9GB Free on Root Part (not counting two 250GB usb drives). No LVM.
uname -a: Linux vistaclm 2.6.30-10-generic #12-Ubuntu SMP Mon Jun 22 16:30:32 UTC 2009 x86_64 GNU/Linux
sudo dpkg -l apache\* | grep ^ii:
ii apache2 2.2.11-6ubuntu1 Apache HTTP Server metapackage
ii apache2-mpm-prefork 2.2.11-6ubuntu1 Apache HTTP Server - traditional non-threade
ii apache2-src 2.2.11-6ubuntu1 Apache source code
ii apache2-utils 2.2.11-6ubuntu1 utility programs for webservers
ii apache2.2-bin 2.2.11-6ubuntu1 Apache HTTP Server common binary files
ii apache2.2-common 2.2.11-6ubuntu1 Apache HTTP Server common files
Kubuntu 9.04, AMD64
Karmic Koala: i upgrade the system from Jaunty at the beginning of June to get an updated kernel in hopes of resolving the fglrx debacle.
I develop my websites on this laptop, so i am certain that under Jaunty /etc/init.d/apache2 was fine/functional.

If you need/require any further info, you have but to ask (smile)!

Calvin Mitchell (calvin674) wrote :

Correction: Kubuntu 9.10 AMD64

Hassan El Jacifi (waver) wrote :

Hi Calvin,

My test was done on Karmic too and still can't reproduce this bug. Why do you have apache2-src installed? did you compile something? can you also provide me the result of: ls -lh /etc/init.d/apache2

Regards,

Calvin Mitchell (calvin674) wrote :

i loaded apache-src because even though apache2 was installed, it wouldn't start (due to the empty /etc/init.d/apache2 script).

-rwxr-xr-x 1 root root 5.7K 2008-02-01 22:57 /etc/init.d/apache2

...i eventually replaced the file with one i had from an earlier backup (probably of intrepid).

Robert L (robert-lundback) wrote :

Hi
I have noticed the same problem. My /etc/init.d/apache2 file is emptied occasionally.
I also noticed that new files apache2.1 apache2.2 etc was created in the same directory. It seemed like the handling of logfiles where older files are kept with a .'integer' extension.

I have several times copied back the apache2.1 file to its original name. But now and then maybe a week or so has to pass, then it happens again. With the result that apache doesnt start at reboot.

I also noticed some time ago that the time stamp of the emptied filed was close to (or same dont remember) en entry in some logfile saying syslogd restart or similar. Sorry I couldn't find the exact info right now.

So my suspicion is that somewhere the path of the logdirectory is mixed with the /etc/init.d directory/files.

my system:
uname -a
Linux myran 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686 GNU/Linux

dpkg -l | grep apache
ii apache2 2.2.11-2ubuntu2.1 Apache HTTP Server metapackage
ii apache2-mpm-worker 2.2.11-2ubuntu2.1 Apache HTTP Server - high speed threaded model
ii apache2-utils 2.2.11-2ubuntu2.1 utility programs for webservers
ii apache2.2-common 2.2.11-2ubuntu2.1 Apache HTTP Server common files

Ronald Teune (zeekoe) wrote :

Same here; Eeebuntu 3 (customized Jaunty)
$ uname -a
Linux zeekoe-laptop 2.6.29-1-netbook #0array1 SMP Mon Feb 23 15:02:03 MST 2009 i686 GNU/Linux

I deleted /etc/init.d/apache* because all of them were 0 bytes. Tried removing and then installing again the following packages:

apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 php5 php5-gd php5-mcrypt php5-mysql phpmyadmin

But the script did not return, so it's probably in another package. In what package can I find it? Or could someone upload his/her version, so I could use apache again? ;-)

mattwilks (matt-wilks) wrote :

Same as Robert and zeekoe. Found a bunch of apache2 files that looked like they had been rotated by logrotate. Running Ubuntu Karmic Server with a fresh install.

# uname -a
Linux host 2.6.31-302-rs #7 SMP Thu Oct 29 22:57:03 UTC 2009 x86_64 GNU/Linux

# dpkg -l | grep apache
ii apache2-doc 2.2.12-1ubuntu2.1
ii apache2-mpm-prefork 2.2.12-1ubuntu2.1
ii apache2-utils 2.2.12-1ubuntu2.1
ii apache2.2-bin 2.2.12-1ubuntu2.1
ii apache2.2-common 2.2.12-1ubuntu2.1
ii libapache2-mod-php5 5.2.10.dfsg.1-2ubuntu6.4
ii libapache2-mod-proxy-html 3.0.1-1

Can't see anything out of the ordinary in the apache entry found in the /etc/logrotate.d directory

danr (dan-ivixor) wrote :

I just got hit by this!

Took down my production webserver :(

danr (dan-ivixor) wrote :

Info:

#uname -a

2.6.31-19-server #56-Ubuntu SMP Thu Jan 28 03:40:48 UTC 2010 x86_64 GNU/Linux

pkg -l |grep apache
ii apache2 2.2.12-1ubuntu2.1 Apache HTTP Server metapackage
ii apache2-mpm-worker 2.2.12-1ubuntu2.1 Apache HTTP Server - high speed threaded mod
ii apache2-prefork-dev 2.2.12-1ubuntu2.1 Apache development headers - non-threaded MP
ii apache2-utils 2.2.12-1ubuntu2.1 utility programs for webservers
ii apache2.2-bin 2.2.12-1ubuntu2.1 Apache HTTP Server common binary files
ii apache2.2-common 2.2.12-1ubuntu2.1 Apache HTTP Server common files
ii libapache2-mod-python 3.3.1-8build1 Python-embedding module for Apache 2
ii libapache2-mod-rpaf 0.5-3 module for Apache2 which takes the last IP f
ii libapache2-mod-wsgi 2.5-1 Python WSGI adapter module for Apache
ii libapache2-svn 1.6.5dfsg-1ubuntu1 Subversion server modules for Apache

Stefan Fritsch (sf-sfritsch) wrote :

What file system do you use for your root partition? ext4?

mattwilks (matt-wilks) wrote :

My system is ext3.

Chuck Short (zulcss) wrote :

What version are you upgrading from?

Regards
chuck

Stefan Fritsch (sf-sfritsch) wrote :

I suspect that logrotate chokes on the '}' that is in the postrotate script in /etc/logrotate.d/apache2. Normally it works fine, but maybe if there is a configuration parse error before the script, something goes wrong.

Please provide the output from

ls -l /etc/logrotate.d

and the contents of /etc/logrotate.d/apache2 and any file in that directory that comes before apache2 when sorted alphabetically. If you have modified /etc/logrotate.conf, please provide that file as well. You can determine if you have modified it by comparing the md5sums in the output of the following two commands:

dpkg -s logrotate |grep /etc/logrotate.conf
md5sum /etc/logrotate.conf

Thanks.

Stefan Fritsch (sf-sfritsch) wrote :

The output of

logrotate -d /etc/logrotate.conf

(run as root) would be interesting, too. Especially if it mentions errors or the file /etc/init.d/apache2.

BTW, you can restore the file with

cd /tmp
aptitude download apache2.2-common
dpkg --extract apache2.2-common_*.deb apache2.2-common
sudo cp apache2.2-common/etc/init.d/apache2 /etc/init.d

A normal reinstall is not enough because dpkg will think you have emptied the file intentionally. (Purging and installing again would work, but that would delete your whole apache configuration).

mattwilks (matt-wilks) wrote :

Stefan, running

logrotate -d /etc/logrotate.conf gives me:

reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file apache2
error: error accessing /var/log/apache2: No such file or directory
error: apache2:1 glob failed for /var/log/apache2/*.log
error: found error in /var/log/apache2/*.log , skipping
removing last 1 log configs
error: apache2:11 lines must begin with a keyword or a filename (possibly in double quotes)
error: apache2:12 missing end of line
reading config info for /etc/init.d/apache2 reload > /dev/null
                fi
        endscript
}

Seems it is looking for /var/log/apache2, but the logs seem to be installed in /var/log/apache. If I create a symlink

ln -s /var/log/apache /var/log/apache2

and rerun the logrotate -d command, everything seems OK. I also ran logrotate without the -d debug switch and my apache2 init.d file was not clobbered. So the misnamed log directory seems to be the problem? I don't remember changing the name (its possible I did though) and this was a fresh install...

Stefan Fritsch (sf-sfritsch) wrote :

Thanks for your help, Matt.

I think you changed the directory name and that caused the bug to appear. But it is definitely a grave bug in logrotate that it mis-parses the config file and clobbers random files if the log directory does not exist.

Uhh, can somebody with more launchpad foo please reassign this to logrotate in a way that it stays visible with apache2? Thanks.

Changed in apache2 (Ubuntu):
status: Incomplete → Confirmed
Changed in logrotate (Debian):
status: Unknown → Fix Released
Dave Walker (davewalker) on 2010-04-04
Changed in logrotate (Ubuntu):
assignee: nobody → Dave Walker (davewalker)

Ran into this in EC2 instance as well, where symlink for log directories to an EBS mount point is preferred practice (for post crash analysis). I can live without rotated logs, but it's added several steps in the apt-get upgrade process (remove symlink, move directory back to /var/log, run upgrades, re-create symlinks).

Chuck Short (zulcss) wrote :

This should be fixed in maverick and above now.

chuck

Changed in apache2 (Ubuntu):
status: Confirmed → Fix Released
Changed in logrotate (Ubuntu):
status: New → Fix Released
Renata (renata-rocha) wrote :

I'd like to reopen this.
2.6.32-25-generic #45-Ubuntu SMP Sat Oct 16 19:48:22 UTC 2010 i686 GNU/Linux
My /etc/init.d/apache2 was emptied in at least three servers, apache2 info

# apache2 -v
Server version: Apache/2.2.14 (Ubuntu)
Server built: Sep 28 2010 12:52:38
Running on /etc/apache2/

I had to fix manually.

Benedikt Bauer (mastacheata) wrote :

> This should be fixed in maverick and above now.
>
> chuck

Any news on a fix for the LTS?
I suppose that's what most people run on their servers and this is definitely a server related bug.
So it would be nice to see that on Lucid some time soon.

 Killed (Well not literally, apache just didn't start) our server tonigt after reboot.

Point One Media (dvogels) wrote :

Just ran into this as well. Is there an ETA for a fix for the LTS?

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.