** Description changed:

  [Impact]
  A normal upgrade of a properly functioning PHP website server can 
unexpectedly result in disabling PHP, when there are no misconfigurations or 
other actual errors.  It's also easy to miss the error message, thus making it 
more challenging to notice the site breakage.
  
  [Fix]
  Instead of issuing an err when there is already one or more active apache mod 
for php(s) of a different version, issue a warning and disable it.
  
  [Test Case]
  
  For bionic -> focal upgrades:
  
-   $ lxc launch ubuntu:18.04/amd64 ba
-   $ lxc exec ba -- bash
-   # apt-get install -y libapache2-mod-php
-   # apt-get install -y ubuntu-release-upgrader-core
-   # do-release-upgrade -d
-     + Answer defaults for everything
-     + Allow it to reboot when done, and log back in
+   $ lxc launch ubuntu:18.04/amd64 ba
+   $ lxc exec ba -- bash
+   # apt-get install -y libapache2-mod-php
+   # apt-get install -y ubuntu-release-upgrader-core
+   # do-release-upgrade -d
+     + Answer defaults for everything
+     + Allow it to reboot when done, and log back in
  
  For eoan -> focal upgrades:
  
-   $ lxc launch ubuntu:18.04/amd64 ba
-   $ lxc exec ba -- bash
-   # apt-get install -y libapache2-mod-php
-   # apt-get install -y ubuntu-release-upgrader-core
-   # do-release-upgrade -d
-     + Answer defaults for everything
-     + Allow it to reboot when done, and log back in
+   $ lxc launch ubuntu:19.10/amd64 ba
+   $ lxc exec ba -- bash
+   # apt-get install -y libapache2-mod-php
+   # apt-get install -y ubuntu-release-upgrader-core
+   # do-release-upgrade -d
+     + Answer defaults for everything
+     + Allow it to reboot when done, and log back in
  
  For either case, to verify the error is present:
-   # journalctl --boot | grep libapache2-mod-php7.4 | grep php7.[23] | cut -d: 
-f5
-   php7.3 module already enabled, not enabling PHP 7.4
-   # apt-cache policy libapache2-mod-php* | grep -B1 Installed
-     libapache2-mod-php:
-       Installed: 2:7.4+75
-     --
-     libapache2-mod-php5:
-       Installed: (none)
-     --
-     libapache2-mod-php7.2:
-       Installed: (none)
-     --
-     libapache2-mod-php7.3:
-       Installed: (none)
-     --
-     libapache2-mod-php7.4:
-       Installed: 7.4.3-4ubuntu1
+   # journalctl --boot | grep libapache2-mod-php7.4 | grep php7.[23] | cut -d: 
-f5
+   php7.3 module already enabled, not enabling PHP 7.4
+   # apt-cache policy libapache2-mod-php* | grep -B1 Installed
+     libapache2-mod-php:
+       Installed: 2:7.4+75
+     --
+     libapache2-mod-php5:
+       Installed: (none)
+     --
+     libapache2-mod-php7.2:
+       Installed: (none)
+     --
+     libapache2-mod-php7.3:
+       Installed: (none)
+     --
+     libapache2-mod-php7.4:
+       Installed: 7.4.3-4ubuntu1
  
  To verify the fix (for bionic; eoan is similar):
  
-   $ lxc launch ubuntu:18.04/amd64 bb
-   $ lxc exec bb -- bash
-   # apt-get -y install software-properties-common
-   # add-apt-repository -yus 
ppa:bryce/php-defaults-fix-lp1865218-mod-php-upgrade
-   # apt-cache policy libapache2-mod-php7.2
-     + Verify the new version is available
-   # apt-get install -y libapache2-mod-php
-   # apt-cache policy libapache2-mod-php7.2
-     + Verify the new version is installed
-   # apt-get install -y ubuntu-release-upgrader-core
-   # apt-get upgrade -y
-   # do-release-upgrade -d
-     + Answer defaults for everything
-     + Allow it to reboot when done, and log back in
-   # Verify the 7.4 version is installed
-     apt-cache policy libapache2-mod-php* | grep -B1 Installed
-   # Verify error is not present
-     journalctl --boot | grep libapache2-mod-php7.4 | grep php7.[23] | cut -d: 
-f5
- 
+   $ lxc launch ubuntu:18.04/amd64 bb
+   $ lxc exec bb -- bash
+   # apt-get -y install software-properties-common
+   # add-apt-repository -yus 
ppa:bryce/php-defaults-fix-lp1865218-mod-php-upgrade
+   # apt-cache policy libapache2-mod-php7.2
+     + Verify the new version is available
+   # apt-get install -y libapache2-mod-php
+   # apt-cache policy libapache2-mod-php7.2
+     + Verify the new version is installed
+   # apt-get install -y ubuntu-release-upgrader-core
+   # apt-get upgrade -y
+   # do-release-upgrade -d
+     + Answer defaults for everything
+     + Allow it to reboot when done, and log back in
+   # Verify the 7.4 version is installed
+     apt-cache policy libapache2-mod-php* | grep -B1 Installed
+   # Verify error is not present
+     journalctl --boot | grep libapache2-mod-php7.4 | grep php7.[23] | cut -d: 
-f5
  
  [Regression Potential]
  Since this change affects only the installer's upgrade logic, the thing to 
keep an eye on would be behavioral changes during upgrades or, possibly, during 
installation.
  
  Presumably the rationale for the current behavior of refusing to disable
  an already running mod-php is if the user had intentionally installed a
  non-distro managed or self-modified mod-php.  Upgrading in such a
  situation might result in unexpected behavior changes.  However, this
  custom configuration is unlikely to be common, and should be expected to
  be affected during a system upgrade.
- 
  
  [Original Report]
  Yesterday, when upgrading a client VMs running Xenial and moving to Bionic, I 
noticed Apache's mod_php was disabled. I later reproduced this in a container:
  
  # create a Xenial container
  $ lxc launch images:ubuntu/xenial xa
  Creating xa
  Starting xa
  
  # Install Apache mod_php
  $ lxc shell xa
  mesg: ttyname failed: Success
  
  root@xa:~# apt-get install libapache2-mod-php
  Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  ...
  Unpacking libapache2-mod-php7.0 (7.0.33-0ubuntu0.16.04.12) ...
  ...
  apache2_switch_mpm Switch to prefork
  apache2_invoke: Enable module php7.0
  
  # Upgrade to Bionic
  root@xa:~# apt-get install ubuntu-release-upgrader-core
  ...
  
  root@xa:~# do-release-upgrade
  ...
  Creating config file /etc/php/7.2/cli/php.ini with new version
  Setting up libapache2-mod-php7.2 (7.2.24-0ubuntu0.18.04.3) ...
  
  Creating config file /etc/php/7.2/apache2/php.ini with new version
  libapache2-mod-php7.2: php7.0 module already enabled, not enabling PHP 7.2
  Setting up libapache2-mod-php (1:7.2+60ubuntu1) ...
  ...
  Removing libapache2-mod-php7.0 (7.0.33-0ubuntu0.16.04.12) ...
  Module php7.0 disabled.
  apache2_invoke prerm: Disable module php7.0
  Purging configuration files for libapache2-mod-php7.0 
(7.0.33-0ubuntu0.16.04.12) ...
  apache2_invoke postrm: Purging state for php7.0
  dpkg: warning: while removing libapache2-mod-php7.0, directory 
'/etc/php/7.0/apache2/conf.d' not empty so not removed
  ...
  
  System upgrade is complete.
  
  Restart required
  
  To finish the upgrade, a restart is required.
  If you select 'y' the system will be restarted.
  
  Continue [yN] y
  
  Additional information on the upgraded container:
  
  root@xa:~# lsb_release -rd
  Description:  Ubuntu 18.04.4 LTS
  Release:      18.04
  root@xa:~# apt-cache policy libapache2-mod-php7.2
  libapache2-mod-php7.2:
    Installed: 7.2.24-0ubuntu0.18.04.3
    Candidate: 7.2.24-0ubuntu0.18.04.3
    Version table:
   *** 7.2.24-0ubuntu0.18.04.3 500
          500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 
Packages
          500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 
Packages
          100 /var/lib/dpkg/status
       7.2.3-1ubuntu1 500
          500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1865218

Title:
  mod_php gets disabled during do-release-upgrade

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/php7.2/+bug/1865218/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to