[SRU] If /usr/sbin/apache2 is set -x, upgrades fail

Bug #583698 reported by Thorsten Glaser
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Server papercuts
Fix Released
Medium
Serge Hallyn
apache2 (Ubuntu)
Fix Released
Low
Unassigned
Hardy
Fix Released
Low
Unassigned

Bug Description

Binary package hint: apache2

Setting up apache2.2-common (2.2.8-1ubuntu0.16) ...
chmod: invalid mode: `root'
Try `chmod --help' for more information.
dpkg: error processing apache2.2-common (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of apache2-mpm-prefork:
 apache2-mpm-prefork depends on apache2.2-common (= 2.2.8-1ubuntu0.16); however:
  Package apache2.2-common is not configured yet.
dpkg: error processing apache2-mpm-prefork (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apache2:
 apache2 depends on apache2-mpm-worker (>= 2.2.8-1ubuntu0.16) | apache2-mpm-prefork (>= 2.2.8-1ubuntu0.16) | apache2-mpm-event (>= 2.2.8-1ubuntu0.16); however:
  Package apache2-mpm-worker is not installed.
  Package apache2-mpm-prefork is not configured yet.
  Package apache2-mpm-event is not installed.
dpkg: error processing apache2 (--configure):
 dependency problems - leaving unconfigured

The problem lies here:

if [ -e /usr/sbin/apache2 ]; then
    if [ "`dpkg-statoverride --list /usr/sbin/apache2`" = "" ]; then
        chmod +x /usr/sbin/apache2
    else
        chmod `dpkg-statoverride --list /usr/sbin/apache2 | cut -f 3` /usr/sbin/apache2
    fi
fi

$ dpkg-statoverride --list /usr/sbin/apache2
root root 644 /usr/sbin/apache2
$ dpkg-statoverride --list /usr/sbin/apache2 | cut -f 3
root root 644 /usr/sbin/apache2

With “set -x” added to /var/lib/dpkg/info/apache2.2-common.postinst:

Setting up apache2.2-common (2.2.8-1ubuntu0.16) ...
+ [ configure != configure ]
+ NETSTAT=netstat
+ [ -e /usr/sbin/apache2 ]
+ dpkg-statoverride --list /usr/sbin/apache2
+ [ root root 644 /usr/sbin/apache2 = ]
+ dpkg-statoverride --list /usr/sbin/apache2
+ cut -f 3
+ chmod root root 644 /usr/sbin/apache2 /usr/sbin/apache2
chmod: invalid mode: `root'
[…]

Revision history for this message
Thorsten Glaser (mirabilos) wrote :

Hrm, so now how do I set the severity in LP? This is critical.
If this wents from proposed to updates, we have a problem.

Dave Walker (davewalker)
Changed in apache2 (Ubuntu):
importance: Undecided → Critical
tags: added: regression-proposed
Revision history for this message
Colin Watson (cjwatson) wrote :

This regression does not appear to be specific to the version in hardy-proposed.

Revision history for this message
Colin Watson (cjwatson) wrote :

This affects specifically users who have statoverrides set for /usr/sbin/apache2. This doesn't seem to be done by anything in the current packaging; it could either be manual, or the relics of an old script. Did you intentionally make /usr/sbin/apache2 non-executable?

The bug is that cut is invoked with its default delimiter, namely tab, but dpkg-statoverrides separates the fields in its output with spaces. Therefore, the correct fix is to add the -d' ' option to that invocation of cut.

This was fixed by Debian in 2.2.12-1 (merged into karmic) by way of removing that upgrade code entirely - indeed, there's no clear evidence that they ever noticed the bug. However, since this is code to handle upgrades from apache 2.0 to 2.2, and dapper had 2.0, I don't think that's a valid option for hardy. However, the version in jaunty (and jaunty-updates) suffers from the same bug, and should be fixed at the same time.

Revision history for this message
Dave Walker (davewalker) wrote :

@Thorsten: Can you clarify the background with the history of this machine:

Was this a fresh install of Hardy, where you already had Apache installed (with -proposed enabled) and upgraded to *0.16 as part of your normal upgrades?

Older install, upgraded from say dapper with -proposed already enabled?

Other?

Changed in apache2 (Ubuntu):
status: New → Incomplete
Changed in apache2 (Ubuntu Hardy):
status: New → Incomplete
Revision history for this message
Thorsten Glaser (mirabilos) wrote :

@Dave: Old install of hardy (these are our desktop systems at work), which got upgraded (as it is, daily).
My machine has proposed in sources.list as I’m the admin in charge of them.

@Colin: Yes, -x’ing apache was intentional, to have it installed/usable but not enabled by default.

Changed in apache2 (Ubuntu):
status: Incomplete → New
Revision history for this message
Dave Walker (davewalker) wrote :

@Thorsten: From the comments Colin has added, it seems that you would have encountered this bug on *any* apache2 upgrade. I'm guessing that /usr/bin/apache2 was set -x, and this is the first upgrade of apache2 since.

Colin has outlined a fix, and as this only causes an issue for a small subset of users; i'm changing the status to low; and removing the regression tag.

Thanks.

tags: removed: regression-proposed
Changed in apache2 (Ubuntu):
importance: Critical → Low
Changed in apache2 (Ubuntu Hardy):
importance: Undecided → Low
Changed in apache2 (Ubuntu):
status: New → Triaged
Changed in apache2 (Ubuntu Hardy):
status: Incomplete → Triaged
summary: - hardy-proposed (2.2.8-1ubuntu0.16) uninstallable
+ If /usr/sbin/apache2 is set -x, upgrades fail
Revision history for this message
Thorsten Glaser (mirabilos) wrote : Re: If /usr/sbin/apache2 is set -x, upgrades fail

@Dave: I agree, but please make sure that the package version which gives me the issue
does not propagate to hardy-updates because otherwise I may have several dozen angry
people on me.

Changing the affected line to
        chmod `dpkg-statoverride --list /usr/sbin/apache2 | cut -d' ' -f 3` /usr/sbin/apache2
in /var/lib/dpkg/info/apache2.2-common.postinst does indeed fix my problem (locally).

Thanks for the quick help, and thanks in advance for providing an updated Apache 2
package before this migrates ;-)

Revision history for this message
Thorsten Glaser (mirabilos) wrote :

Thank you *VERY MUCH* for breaking a lot of our computers now.
Now I know why we’re still using Kubuntu. </sarcasm>

The priority of this bug ought to be raised to critical now, as the
next upgrade on many of our machines will fail:

root@bkix:~ # apt-cache policy apache2.2-common
apache2.2-common:
  Installed: 2.2.8-1ubuntu0.16
  Candidate: 2.2.8-1ubuntu0.16
  Version table:
 *** 2.2.8-1ubuntu0.16 0
        500 http://mirror.bonn.tarent.de hardy-updates/main Packages
        100 /var/lib/dpkg/status
     2.2.8-1ubuntu0.15 0
        500 http://mirror.bonn.tarent.de hardy-security/main Packages
     2.2.8-1 0
        500 http://mirror.bonn.tarent.de hardy/main Packages

Revision history for this message
Thorsten Glaser (mirabilos) wrote :

Can’t have been this hard… the attached debdiff fixes the issue for me.
I’ve deployed that in our internal repo right now, thanks again for all
the breakage.

Chuck Short (zulcss)
summary: - If /usr/sbin/apache2 is set -x, upgrades fail
+ [SRU] If /usr/sbin/apache2 is set -x, upgrades fail
Revision history for this message
Colin Watson (cjwatson) wrote : Please test proposed package

Accepted apache2 into hardy-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in apache2 (Ubuntu Hardy):
status: Triaged → Fix Committed
tags: added: verification-needed
Revision history for this message
Colin Watson (cjwatson) wrote :

Sorry, Dave had uploaded a fix for this to hardy-proposed some time ago but I had neglected to process it. My fault. In compensation, I'll waive the usual seven-day waiting period if you could test this quickly?

Revision history for this message
Colin Watson (cjwatson) wrote :

(I rejected your more or less identical upload, which came later.)

Revision history for this message
Thorsten Glaser (mirabilos) wrote :

Yeah, works for me, thanks!

tglase@tglase:~ $ sudo env LC_ALL=C apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Starting
Starting 2
Done
Done
The following packages will be upgraded:
  apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common
5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 3105kB of archives.
After this operation, 8192B of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://archive.ubuntu.com hardy-proposed/main apache2-utils 2.2.8-1ubuntu0.17 [141kB]
Get:2 http://archive.ubuntu.com hardy-proposed/main apache2-mpm-prefork 2.2.8-1ubuntu0.17 [232kB]
Get:3 http://archive.ubuntu.com hardy-proposed/main apache2.2-common 2.2.8-1ubuntu0.17 [756kB]
Get:4 http://archive.ubuntu.com hardy-proposed/main apache2 2.2.8-1ubuntu0.17 [46.2kB]
Get:5 http://archive.ubuntu.com hardy-proposed/main apache2-doc 2.2.8-1ubuntu0.17 [1930kB]
Fetched 3105kB in 2s (1324kB/s)
(Reading database ... 350291 files and directories currently installed.)
Preparing to replace apache2-utils 2.2.8-1ubuntu0.16tarent1 (using .../apache2-utils_2.2.8-1ubuntu0.17_i386.deb) ...
Unpacking replacement apache2-utils ...
Preparing to replace apache2-mpm-prefork 2.2.8-1ubuntu0.16tarent1 (using .../apache2-mpm-prefork_2.2.8-1ubuntu0.17_i386.deb) ...
No apache MPM package installed
Unpacking replacement apache2-mpm-prefork ...
Preparing to replace apache2.2-common 2.2.8-1ubuntu0.16tarent1 (using .../apache2.2-common_2.2.8-1ubuntu0.17_i386.deb) ...
Unpacking replacement apache2.2-common ...
Preparing to replace apache2 2.2.8-1ubuntu0.16tarent1 (using .../apache2_2.2.8-1ubuntu0.17_all.deb) ...
Unpacking replacement apache2 ...
Preparing to replace apache2-doc 2.2.8-1ubuntu0.16tarent1 (using .../apache2-doc_2.2.8-1ubuntu0.17_all.deb) ...
Unpacking replacement apache2-doc ...
Setting up apache2-utils (2.2.8-1ubuntu0.17) ...
Setting up apache2.2-common (2.2.8-1ubuntu0.17) ...

Setting up apache2-mpm-prefork (2.2.8-1ubuntu0.17) ...
No apache MPM package installed

Setting up apache2 (2.2.8-1ubuntu0.17) ...
Setting up apache2-doc (2.2.8-1ubuntu0.17) ...
No apache MPM package installed

tglase@tglase:~ $ apt-cache policy apache2.2-common
apache2.2-common:
  Installed: 2.2.8-1ubuntu0.17
  Candidate: 2.2.8-1ubuntu0.17
  Version table:
 *** 2.2.8-1ubuntu0.17 0
        500 http://archive.ubuntu.com hardy-proposed/main Packages
        100 /var/lib/dpkg/status
     2.2.8-1ubuntu0.16tarent1 0
        500 http://mirror.bonn.tarent.de hardy/tarent Packages
     2.2.8-1ubuntu0.16 0
        500 http://mirror.bonn.tarent.de hardy-updates/main Packages
     2.2.8-1ubuntu0.15 0
        500 http://mirror.bonn.tarent.de hardy-security/main Packages
     2.2.8-1 0
        500 http://mirror.bonn.tarent.de hardy/main Packages

Revision history for this message
Dave Walker (davewalker) wrote :

My verification has also proved successful, and updated the tag as appropriate.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apache2 - 2.2.8-1ubuntu0.17

---------------
apache2 (2.2.8-1ubuntu0.17) hardy-proposed; urgency=low

  * debian/apache2.2-common.postinst: When dpkg-statoverride is used, the cut
    delimiter has now been set to use ' ', as it was causing upgrades to fail.
    (LP: #583698)
 -- Dave Walker (Daviey) <email address hidden> Fri, 21 May 2010 13:50:34 +0100

Changed in apache2 (Ubuntu Hardy):
status: Fix Committed → Fix Released
Revision history for this message
Dave Walker (davewalker) wrote :

Nominating as a paper-cut to investigate if this fix needs forward porting to other releases, if so - apply it - otherwise close the task.

Thanks.

Thierry Carrez (ttx)
Changed in server-papercuts:
importance: Undecided → Medium
milestone: none → maverick-beta
status: New → Confirmed
Changed in server-papercuts:
assignee: nobody → Serge Hallyn (serge-hallyn)
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

As stated in comment #3, this is fixed in karmic, but, as implied in comment 3, it
is not fixed in jaunty (and presumably also not in intrepid). I will create and propose
equivalent patches for those tomorrow.

Revision history for this message
Martin Pitt (pitti) wrote :

Reportedly fixed in karmic and above.

Changed in apache2 (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Serge,

jaunty has survived a year and four months without that fix, and only has two more months to live. I don't think it's necessary to fix this in jaunty any more.

Thierry Carrez (ttx)
Changed in server-papercuts:
status: Confirmed → Fix Released
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.