Apache fails to shutdown cleanly during update and removes libapache2-mod-php5 in the process, causing service restart to fail due to syntax errors in configuration

Bug #969426 reported by Ben Johnson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)
Expired
Low
Unassigned

Bug Description

# lsb_release -rd
Description: Ubuntu 10.04.4 LTS
Release: 10.04

# apt-cache policy apache2
apache2:
  Installed: 2.2.14-5ubuntu8.9
  Candidate: 2.2.14-5ubuntu8.9
  Version table:
 *** 2.2.14-5ubuntu8.9 0
        500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages
        100 /var/lib/dpkg/status
     2.2.14-5ubuntu8.8 0
        500 http://us.archive.ubuntu.com/ubuntu/ lucid-security/main Packages
     2.2.14-5ubuntu8 0
        500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages

# apt-cache policy libapache2-mod-php5
libapache2-mod-php5:
  Installed: 5.3.2-1ubuntu4.14
  Candidate: 5.3.2-1ubuntu4.14
  Version table:
 *** 5.3.2-1ubuntu4.14 0
        500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages
        500 http://us.archive.ubuntu.com/ubuntu/ lucid-security/main Packages
        100 /var/lib/dpkg/status
     5.3.2-1ubuntu4 0
        500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages

--------------------------------------

I have observed this behavior several times over the course of a few months now.

It seems that any time I update apache2 and related packages, a) Apache cannot be shutdown cleanly, so all running processes are killed, and b) libapache2-mod-php5 is removed and never reinstalled. The fact that libapache2-mod-php5 is never reinstalled causes Apache to fail to start after the update, due to syntax errors (unrecognized directives) in the Apache configuration.

The apt-get log transcript follows:

--------------------------------------

Now updating apache2 ..

    Installing package(s) with command apt-get -y install apache2 ..

    Reading package lists...
    Building dependency tree...
    Reading state information...
    The following extra packages will be installed:
      apache2-mpm-worker apache2-threaded-dev apache2.2-bin apache2.2-common
    Suggested packages:
      ufw
    The following packages will be REMOVED:
      apache2-mpm-prefork libapache2-mod-php5
    The following NEW packages will be installed:
      apache2-mpm-worker
    The following packages will be upgraded:
      apache2 apache2-threaded-dev apache2.2-bin apache2.2-common
    4 upgraded, 1 newly installed, 2 to remove and 18 not upgraded.
    Need to get 3172kB of archives.
    After this operation, 8487kB disk space will be freed.
    Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main apache2-threaded-dev 2.2.14-5ubuntu8.9 [137kB]
    Get:2 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main apache2 2.2.14-5ubuntu8.9 [1488B]
    Get:3 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main apache2.2-common 2.2.14-5ubuntu8.9 [291kB]
    Get:4 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main apache2.2-bin 2.2.14-5ubuntu8.9 [2740kB]
    Get:5 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main apache2-mpm-worker 2.2.14-5ubuntu8.9 [2366B]
    Reading changelogs...
    apache2 (2.2.15-1) unstable; urgency=low

      * This release adds and enables mod_reqtimeout, which limits the time
        Apache waits for a client to send a complete request. This helps to
        mitigate against certain denial of service attacks. In case of problems
        with slow clients, the timeout values can be adjusted in
        /etc/apache2/mods-available/reqtimeout.conf , or the module can be
        disabled with "a2dismod reqtimeout".

     -- Chuck Short <email address hidden> Tue, 13 Apr 2010 09:09:34 -0400

    apt-listchanges: Mailing root: apt-listchanges: news for example.com
    Fetched 3172kB in 1s (1958kB/s)
    (Reading database ... 68899 files and directories currently installed.)
    Preparing to replace apache2-threaded-dev 2.2.14-5ubuntu8.8 (using .../apache2-threaded-dev_2.2.14-5ubuntu8.9_amd64.deb) ...
    Unpacking replacement apache2-threaded-dev ...
    Preparing to replace apache2 2.2.14-5ubuntu8.8 (using .../apache2_2.2.14-5ubuntu8.9_amd64.deb) ...
    Unpacking replacement apache2 ...
    (Reading database ... 68891 files and directories currently installed.)
    Removing libapache2-mod-php5 ...
    Module php5 disabled.
    Run '/etc/init.d/apache2 restart' to activate new configuration!
    dpkg: apache2-mpm-prefork: dependency problems, but removing anyway as you requested:
     roundcube-core depends on apache2 | lighttpd | httpd; however:
      Package apache2 is not configured yet.
      Package apache2-mpm-prefork which provides apache2 is to be removed.
      Package lighttpd is not installed.
      Package httpd is not installed.
      Package apache2-mpm-prefork which provides httpd is to be removed.
     mailman depends on apache2 | httpd; however:
      Package apache2 is not configured yet.
      Package apache2-mpm-prefork which provides apache2 is to be removed.
      Package httpd is not installed.
      Package apache2-mpm-prefork which provides httpd is to be removed.
     mediawiki depends on apache2 | httpd; however:
      Package apache2 is not configured yet.
      Package apache2-mpm-prefork which provides apache2 is to be removed.
      Package httpd is not installed.
      Package apache2-mpm-prefork which provides httpd is to be removed.
     libapache2-mod-python depends on apache2; however:
      Package apache2 is not configured yet.
      Package apache2-mpm-prefork which provides apache2 is to be removed.
     roundcube-core depends on apache2 | lighttpd | httpd; however:
      Package apache2 is not configured yet.
      Package apache2-mpm-prefork which provides apache2 is to be removed.
      Package lighttpd is not installed.
      Package httpd is not installed.
      Package apache2-mpm-prefork which provides httpd is to be removed.
     mailman depends on apache2 | httpd; however:
      Package apache2 is not configured yet.
      Package apache2-mpm-prefork which provides apache2 is to be removed.
      Package httpd is not installed.
      Package apache2-mpm-prefork which provides httpd is to be removed.
     mediawiki depends on apache2 | httpd; however:
      Package apache2 is not configured yet.
      Package apache2-mpm-prefork which provides apache2 is to be removed.
      Package httpd is not installed.
      Package apache2-mpm-prefork which provides httpd is to be removed.
    Removing apache2-mpm-prefork ...
     * Stopping web server apache2
     * We failed to correctly shutdown apache, so we're now killing all running apache processes. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!
     ... waiting ...done.
    (Reading database ... 68887 files and directories currently installed.)
    Preparing to replace apache2.2-common 2.2.14-5ubuntu8.8 (using .../apache2.2-common_2.2.14-5ubuntu8.9_amd64.deb) ...
    Unpacking replacement apache2.2-common ...
    Preparing to replace apache2.2-bin 2.2.14-5ubuntu8.8 (using .../apache2.2-bin_2.2.14-5ubuntu8.9_amd64.deb) ...
    Unpacking replacement apache2.2-bin ...
    Selecting previously deselected package apache2-mpm-worker.
    Unpacking apache2-mpm-worker (from .../apache2-mpm-worker_2.2.14-5ubuntu8.9_amd64.deb) ...
    Setting up apache2.2-bin (2.2.14-5ubuntu8.9) ...
    Setting up apache2.2-common (2.2.14-5ubuntu8.9) ...

    Setting up apache2-threaded-dev (2.2.14-5ubuntu8.9) ...

    Setting up apache2-mpm-worker (2.2.14-5ubuntu8.9) ...
     * Starting web server apache2
    Syntax error on line 15 of /etc/apache2/httpd.conf:
    Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration
       ...fail!
    invoke-rc.d: initscript apache2, action "start" failed.

    Setting up apache2 (2.2.14-5ubuntu8.9) ...

    .. install complete.

Revision history for this message
James Page (james-page) wrote :

Hi Ben

Looks like you might have two issue here:

1) apache2-mpm-prefork gets removed which libapache2-mod-php5 depends on:

The following packages will be REMOVED:
      apache2-mpm-prefork libapache2-mod-php5

This is because you are running 'apt-get -y install apache2' rather than actually upgrading so apt selects the default worker type - you should run:

  sudo apt-get dist-upgrade
or
  sudo apt-get update

2) Apache not restarting correctly

Might be caused by the above - please try and see if it still happens.

Otherwise any errors from the apache log files would be good to see.

Marking 'Incomplete' and 'Low' for the time being as I don't think this is a more general issue.

Changed in apache2 (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Ben Johnson (a03-6eo-chg) wrote :

Thank you for the reply, James; it clarifies the issue.

Using 'apt-get upgrade' applied the package upgrades without causing Apache to shutdown uncleanly, and the libapache2-mod-php5 package was unaffected, so Apache restarted without issue. All is well.

Perhaps this is a question is more appropriate for another venue, but is there any means by which to execute 'apt-get dist-upgrade' or 'apt-get upgrade', on the command-line, without updating every package on the system (excepting those that have been kept-back, of course). (I ask because when I reported this issue, I was using Webmin to apply the package upgrades. It seems that the problem is with Webmin's package upgrade implementation, so any insight offered here may be useful to the Webmin developer[s].)

It appears that the Ubuntu Update Manager supports this behavior; it enables the user to un-check the boxes next to individual updates. At the same time, those selections do not persist once the Update Manager has been closed (which is the desired behavior). So, how does the Update Manager achieve this? Does it temporarily keep-back the unchecked packages, until the application is closed, and then remove the temporary holds? Or is there some lesser-known argument to 'apt-get' that allows one to specify the packages to be upgraded, explicitly?

Thanks again.

Revision history for this message
Ben Johnson (a03-6eo-chg) wrote :

I have scoured the 'apt-get' documentation and am left to assume that Ubuntu's Update Manager uses its own logic to allow for upgrading packages selectively. This passage from apt-get's man-pages spells it out clearly:

This is also the target to use if you want to upgrade one or more
already-installed packages without upgrading every package you have
on your system. Unlike the "upgrade" target, which installs the
newest version of all currently installed packages, "install" will
install the newest version of only the package(s) specified. Simply
provide the name of the package(s) you wish to upgrade, and if a
newer version is available, it (and its dependencies, as described
above) will be downloaded and installed.

So, even the apt-get manual states that 'apt-get install package-name' should be used to upgrade packages selectively. This is exactly the approach that Webmin has taken, and is exactly the reason that Apache with Mod-PHP is mucked-up every time it's upgraded.

Am I asking the wrong questions? Or am I in the wrong place?

Thanks again.

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

[Expired for apache2 (Ubuntu) because there has been no activity for 60 days.]

Changed in apache2 (Ubuntu):
status: Incomplete → Expired
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.