Comment 4 for bug 1782806

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Bionic Verification
===================

First, confirming the bug:
ubuntu@bionic-apache2-1782806:~$ apt-cache policy apache2
apache2:
  Installed: 2.4.29-1ubuntu4.4
  Candidate: 2.4.29-1ubuntu4.4
  Version table:
 *** 2.4.29-1ubuntu4.4 500
        500 http://br.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages

# prep
ubuntu@bionic-apache2-1782806:~$ sudo cp /etc/apache2/mods-available/{mpm_prefork,prefork}.conf
ubuntu@bionic-apache2-1782806:~$ sudo cp /etc/apache2/mods-available/{mpm_prefork,prefork}.load
ubuntu@bionic-apache2-1782806:~$ sudo ln -s /etc/apache2/mods-{available,enabled}/prefork.load
ubuntu@bionic-apache2-1782806:~$ sudo ln -s /etc/apache2/mods-{available,enabled}/prefork.conf

# this should fail
ubuntu@bionic-apache2-1782806:~$ sudo apt install libapache2-mod-php7.2 -y
...
Creating config file /etc/php/7.2/apache2/php.ini with new version
apache2_switch_mpm prefork: No action required
dpkg: error processing package libapache2-mod-php7.2 (--configure):
 installed libapache2-mod-php7.2 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 libapache2-mod-php7.2
E: Sub-process /usr/bin/dpkg returned an error code (1)

Bug confirmed.

Confirming fix

a) upgrading from the broken package to the fixed one
Starting with this scenario. Note how the php module package is in a failed state:
ubuntu@bionic-apache2-1782806:~$ dpkg -l|grep apache2
ii apache2 2.4.29-1ubuntu4.4
ii apache2-bin 2.4.29-1ubuntu4.4
ii apache2-data 2.4.29-1ubuntu4.4
ii apache2-utils 2.4.29-1ubuntu4.4
iF libapache2-mod-php7.2 7.2.10-0ubuntu0.18.04.1

ubuntu@bionic-apache2-1782806:~$ sudo apt install apache2 apache2-bin apache2-data apache2-utils

(...)
Setting up apache2 (2.4.29-1ubuntu4.5) ...
info: Switch to mpm prefork for package libapache2-mod-php7.2
Module mpm_event disabled.
Enabling module mpm_prefork.
info: Executing deferred 'a2enmod php7.2' for package libapache2-mod-php7.2
Enabling module php7.2.
W: APT had planned for dpkg to do more than it reported back (20 vs 24).
   Affected packages: libapache2-mod-php7.2:amd64

# php is now ok
ubuntu@bionic-apache2-1782806:~$ dpkg -l|grep libapache2-mod-php
ii libapache2-mod-php7.2 7.2.10-0ubuntu0.18.04.1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)

# apt -f install is clean:
ubuntu@bionic-apache2-1782806:~$ sudo apt -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 49 not upgraded.

b) Starting out with the condition that shows the bug, but with the fixed package from proposed:
ubuntu@bionic-apache2-1782806:~$ apt-cache policy apache2
apache2:
  Installed: 2.4.29-1ubuntu4.5
  Candidate: 2.4.29-1ubuntu4.5
  Version table:
 *** 2.4.29-1ubuntu4.5 500
        500 http://br.archive.ubuntu.com/ubuntu bionic-proposed/main amd64 Packages

# Creating the condition for the bug, as before:
ubuntu@bionic-apache2-1782806:~$ sudo cp /etc/apache2/mods-available/{mpm_prefork,prefork}.conf
ubuntu@bionic-apache2-1782806:~$ sudo cp /etc/apache2/mods-available/{mpm_prefork,prefork}.load
ubuntu@bionic-apache2-1782806:~$ sudo ln -s /etc/apache2/mods-{available,enabled}/prefork.load
ubuntu@bionic-apache2-1782806:~$ sudo ln -s /etc/apache2/mods-{available,enabled}/prefork.conf
ubuntu@bionic-apache2-1782806:~$

# installing the php module. It works this time:
ubuntu@bionic-apache2-1782806:~$ sudo apt install libapache2-mod-php7.2 -y
...
Creating config file /etc/php/7.2/cli/php.ini with new version
Setting up libapache2-mod-php7.2 (7.2.10-0ubuntu0.18.04.1) ...

Creating config file /etc/php/7.2/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php7.2
ubuntu@bionic-apache2-1782806:~$

Verification succeeded.