[Bug 1428288] [NEW] dist-upgrade failed: apache2 postinst failed on absolute symlinks in mods-enabled

Ben Harris bjh21 at cam.ac.uk
Wed Mar 4 19:49:46 UTC 2015


Public bug reported:

I tried to upgrade from 12.04 LTS to 14.04 LTS using "do-release-
upgrade".  The system had previously (a few minutes previously) been
upgraded from 10.04 LTS to 12.04 LTS.  As far as I can tell, the first
upgrade was successful, but the second failed when trying to configure
apache2:

disable obsolete module dav_fs
Module dav_fs disabled.
disable obsolete module dav
ERROR: The following modules depend on dav and need to be disabled first: dav_svn
dpkg: error processing package apache2 (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports has already been reached
…
Please report this bug in a browser at 
http://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebug 
and attach the files in /var/log/dist-upgrade/ to the bug report. 
installArchives() failed 

I think this is caused by the fact that I have absolute symlinks in
/etc/apache2/mods-enabled:

root at sigurd:/home/bjh21# ls -o /etc/apache2/mods-enabled/dav*
lrwxrwxrwx 1 root 36 Nov 12  2012 /etc/apache2/mods-enabled/dav.load -> /etc/apache2/mods-available/dav.load
lrwxrwxrwx 1 root 30 Nov 12  2012 /etc/apache2/mods-enabled/dav_svn.conf -> ../mods-available/dav_svn.conf
lrwxrwxrwx 1 root 40 Nov 12  2012 /etc/apache2/mods-enabled/dav_svn.load -> /etc/apache2/mods-available/dav_svn.load

The code that detects obsolete modules in apache2.postinst looks like it
will (accidentally) not work with absolute symlinks:

refresh_modules()
{
        if we_are_upgrading_from_wheezy $@ && [ -d /etc/apache2/mods-enabled/ ] ; then
                shopt -s nullglob
                for link in /etc/apache2/mods-enabled/*.load ; do
                        target=$(readlink "$link") || true
                        if [ -z "$target" ] ; then
                                continue
                        fi

                        module=$(basename "$link" | sed 's/\.load//') ||
true

                        if [ ! -e "/etc/apache2/mods-enabled/$target" ] ; then
                                echo "disable obsolete module $module"
                                a2dismod -m -q "$module"

etc.

Concatenating the symlink contents with the directory name only works
for relative symlinks.  A simpler approach would be simply to check the
link for existence, which will treat broken links as non-existent:

if [ ! -e "${link}" ]; then

** Affects: ubuntu-release-upgrader (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "Contents of /var/log/dist-upgrade, as requested by error message"
   https://bugs.launchpad.net/bugs/1428288/+attachment/4334616/+files/dist-upgrade.tar

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ubuntu-release-upgrader in
Ubuntu.
https://bugs.launchpad.net/bugs/1428288

Title:
  dist-upgrade failed: apache2 postinst failed on absolute symlinks in
  mods-enabled

Status in ubuntu-release-upgrader package in Ubuntu:
  New

Bug description:
  I tried to upgrade from 12.04 LTS to 14.04 LTS using "do-release-
  upgrade".  The system had previously (a few minutes previously) been
  upgraded from 10.04 LTS to 12.04 LTS.  As far as I can tell, the first
  upgrade was successful, but the second failed when trying to configure
  apache2:

  disable obsolete module dav_fs
  Module dav_fs disabled.
  disable obsolete module dav
  ERROR: The following modules depend on dav and need to be disabled first: dav_svn
  dpkg: error processing package apache2 (--configure):
   subprocess installed post-installation script returned error exit status 1
  No apport report written because MaxReports has already been reached
  …
  Please report this bug in a browser at 
  http://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebug 
  and attach the files in /var/log/dist-upgrade/ to the bug report. 
  installArchives() failed 

  I think this is caused by the fact that I have absolute symlinks in
  /etc/apache2/mods-enabled:

  root at sigurd:/home/bjh21# ls -o /etc/apache2/mods-enabled/dav*
  lrwxrwxrwx 1 root 36 Nov 12  2012 /etc/apache2/mods-enabled/dav.load -> /etc/apache2/mods-available/dav.load
  lrwxrwxrwx 1 root 30 Nov 12  2012 /etc/apache2/mods-enabled/dav_svn.conf -> ../mods-available/dav_svn.conf
  lrwxrwxrwx 1 root 40 Nov 12  2012 /etc/apache2/mods-enabled/dav_svn.load -> /etc/apache2/mods-available/dav_svn.load

  The code that detects obsolete modules in apache2.postinst looks like
  it will (accidentally) not work with absolute symlinks:

  refresh_modules()
  {
          if we_are_upgrading_from_wheezy $@ && [ -d /etc/apache2/mods-enabled/ ] ; then
                  shopt -s nullglob
                  for link in /etc/apache2/mods-enabled/*.load ; do
                          target=$(readlink "$link") || true
                          if [ -z "$target" ] ; then
                                  continue
                          fi

                          module=$(basename "$link" | sed 's/\.load//')
  || true

                          if [ ! -e "/etc/apache2/mods-enabled/$target" ] ; then
                                  echo "disable obsolete module $module"
                                  a2dismod -m -q "$module"

  etc.

  Concatenating the symlink contents with the directory name only works
  for relative symlinks.  A simpler approach would be simply to check
  the link for existence, which will treat broken links as non-existent:

  if [ ! -e "${link}" ]; then

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1428288/+subscriptions



More information about the foundations-bugs mailing list