PHP5 breaks apache update

Bug #95325 reported by Matthew Nuzum
58
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)
Invalid
High
Unassigned
update-manager (Ubuntu)
Fix Released
High
Michael Vogt

Bug Description

Binary package hint: update-manager

I think this is because apache2 was stopped. It went through the whole 2+ hour process of downloading the packages, then it started installing. About 2 min into this aspect it died. Screenshot of the error and a tar file from /var/log/dist-upgrade is attached.

Revision history for this message
Matthew Nuzum (newz) wrote :
Revision history for this message
Matthew Nuzum (newz) wrote :
Revision history for this message
Matthew Nuzum (newz) wrote :

Hmm... this is bad. I tried re-running update manager and got a message "Software index is broken - It is impossible to install or remove software..." I'm attaching a screenshot

Revision history for this message
Matthew Nuzum (newz) wrote :

ok, more bad news... even sudo apt-get install -f fails now... It does have something to do with apache2. It can't stop apache and therefore dies. However, I can't start apache

matt@matts-laptop:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  vmware-player-kernel-modules-2.6.17-10 apache2-common python2.5
  python2.5-minimal libpq4 php5-mysql
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  apache2-mpm-prefork apache2.2-common
The following packages will be REMOVED:
  apache2-common
The following NEW packages will be installed:
  apache2.2-common
The following packages will be upgraded:
  apache2-mpm-prefork
1 upgraded, 1 newly installed, 1 to remove and 1104 not upgraded.
120 not fully installed or removed.
Need to get 0B/1358kB of archives.
After unpacking 602kB of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: apache2-common: dependency problems, but removing anyway as you request:
 apache2-mpm-prefork depends on apache2-common (= 2.0.55-4ubuntu4); however:
  Package apache2-common is to be removed.
(Reading database ... 158341 files and directories currently installed.)
Removing apache2-common ...
 * Stopping apache 2.0 web server... [fail]
invoke-rc.d: initscript apache2, action "stop" failed.
dpkg: error processing apache2-common (--remove):
 subprocess pre-removal script returned error exit status 1
Errors were encountered while processing:
 apache2-common
E: Sub-process /usr/bin/dpkg returned an error code (1)

matt@matts-laptop:~$ sudo /etc/init.d/apache2 start
 * Starting apache 2.0 web server... Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load:
API module structure `php5_module' in file /usr/lib/apache2/modules/libphp5.so is garbled - perhaps this is not an Apache module DSO?
                                                                         [fail]

***GOOD NEWS***
sudo rm /etc/apache2/mods-enabled/php5.load fixes the problem

Still, this is very scary stuff

Revision history for this message
Michael Vogt (mvo) wrote :

Here is the error from the logs:

Removing apache2-common ...
 * Stopping apache 2.0 web server...
 * Stopping apache 2.0 web server...
 * Stopping apache 2.0 web server... [fail]
invoke-rc.d: initscript apache2, action "stop" failed.
dpkg: error processing apache2-common (--remove):
 subprocess pre-removal script returned error exit status 1
Errors were encountered while processing:
 apache2-common

I reassign this to apache2 and milestone it (because it breaks upgrades)

Thanks,
 Michael

Changed in update-manager:
importance: Undecided → High
status: Unconfirmed → Confirmed
Revision history for this message
Daniel Hahler (blueyed) wrote :

Have you tried manually stopping the old Apache? ("sudo /etc/init.d/apache2 stop")

Revision history for this message
Matthew Nuzum (newz) wrote :

Before the upgrade process began, starting and stopping apache wasn't a problem. The problem is that I couldn't complete the update to Feisty using update-manager because of some problems. I eventually figured out that if I deleted some of the apache configuration files relating to php5 then the update process did work.

Revision history for this message
Michael Vogt (mvo) wrote :

@dAniel hAhler: Thanks for this suggestions, but this is really a bug in the package. it should be able to deal with the upgrade without having to special case it.

Revision history for this message
Daniel Hahler (blueyed) wrote :

Manually stopping of Apache was meant to help in debugging this - e.g. where/how does it fail?
Does it only fail, because Apache is not running and some dpkg-script does not handle it correctly?

IMHO the bug title is misleading: PHP5 does not cause breaking this - but apache2-common from edgy (according to bug #88210).
The PHP error then also results from a broken Apache setup, doesn't it?

Revision history for this message
Tollef Fog Heen (tfheen) wrote :

This has to be worked around in update-manager

Changed in update-manager:
assignee: nobody → mvo
importance: Undecided → High
status: Unconfirmed → Confirmed
Revision history for this message
Tollef Fog Heen (tfheen) wrote :

This is a bug in php5 for not depending on apache2-common; rejecting, will have to be worked around in update-manager.

Changed in apache2:
status: Confirmed → Rejected
Revision history for this message
Michael Vogt (mvo) wrote :

Here is a summary of our irc discussion:

<mvo> Mithrandir: is that the workaround you recommend: "rm -f /var/lib/dpkg/info/apache2-common.postrm." ?
<Mithrandir> mvo: no, the workaround is to remove php[45] before upgrading apache.
<mvo> Mithrandir: so before the actual upgrade, remove php[45], upgrade, reinstall php[45]?
<Mithrandir> mvo: that ought to work, yes.
<mvo> Mithrandir: thats very evil and has the potential to screw up quite badly within the apt cache. is that really the only way?
 _ion: no
<Mithrandir> mvo: the problem is php[45] depends on apache2-common's ABI without declaring that.
[..]
<Mithrandir> mvo: the problem here is a missing dependency, you could, maybe, possibly work around it by first stopping apache2, then removing the prerm and postrm then upgrade, but you would need to test this properly.
<mvo> Mithrandir: the missing dependency is not a package dependency but the ABI dependency that you talked about earlier? (sorry, I'm not familiar with php/apache packages
<Mithrandir> mvo: no. libapache2-mod-php5 in edgy depends (as in, an ABI dependency) on apache2-common, but fails to declare that Depend on apache2-common, the package. This is a bug. libpache2-mod-php5 in feisty depends and Depends on apache2.2-common.
<Mithrandir> mvo: if you upgrade libapache2-mod-php5 without first upgrading apache2-common, it will fall over. If you first install apache2.2-common without removing libapache2-mod-php5, the upgrade falls over.
<mvo> Mithrandir: I seem to be unable to reproduce the apache/php upgrade issue here in a chroot or in vmware. even with the same ordering it seems (http://paste.ubuntu-nl.org/12909). is there more to do to reproduce the issue?
<Mithrandir> mvo: from memory, something like: debootstrap an edgy chroot. Install apache2 + libapache2-mod-php5. download the relevant binaries from feisty, run dpkg -i on them; it ought to blow up. If not, try installing just apache2.2-common and apache2-mpm-prefork from feisty.
 mvo: it might work by accident.

I can not reproduce it here yet. Even with unpack/configure patterns that look very similar to the one in the bugreports.

Revision history for this message
Michael Vogt (mvo) wrote :

For the records, I tried installing "apache2 php5 libapache2-mod-php5" in a clean edgy chroot and then upgraded with that to feisty. I got now crash.

Revision history for this message
Michael Vogt (mvo) wrote :

That should read: "I got no crash". I also did that in a vmware environment.

Revision history for this message
Michael Vogt (mvo) wrote :

Soren Hansen was so kind to give me instruction how to reproduce the problem reliably:

1. Do a clean Edgy install (I used ubuntu server, but whatever rocks
   your boat..)
2. Install libapache2-mod-php5 (pulls in apache as well)
3. stop apache (*very* important step as it turns out)
4. sed -i -e s/edgy/feisty/ /etc/apt/sources.list
5. apt-get update ; apt-get install libapache2-mod-php5

The problem is:
* php5 gets installed
* apache2 upgrade fails, because prerm tries to stop it (failing because
  it's already stopped)
* Any subsequent attempts at doing anything with Apache fails, because
  php5 has been upgraded breaking API compatibility with apache2 (2.0)).

I can reproduce it now too.

Revision history for this message
Michael Vogt (mvo) wrote :

It seems to me the safest approach here is for update-manager to:
* check if apache2-common is installed
* if so, stop it and remove /var/lib/dpkg/info/apache2-common-prerm (it contains only the DEBHELPER stop magic)

This has minimal other implications.

Changed in update-manager:
status: Confirmed → In Progress
Revision history for this message
Michael Vogt (mvo) wrote :

Implemented my last suggestion in bzr.

Changed in update-manager:
status: In Progress → Fix Committed
Michael Vogt (mvo)
Changed in update-manager:
status: Fix Committed → Fix Released
Revision history for this message
calenti (calenti) wrote :

Issue for my upgrade attempt was the first line in Apache 2's module list. After the upgrade failed I couldn't even start apache2 from sudo /etc/init.d/apache2 start.

I commented out the PHP reference in the apache module list and was able to start apache. I am now retrying the dist-upgrade using apitude per the FeistyUpgrade section of help.ubuntu.com.

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.