Package: phpmyadmin
Version: 4:4.6.6-4
Severity: important

Dear Thijs Kinkhorst,

A problem has been noticed with the package upgrade process of phpmyadmin when 
migrating an OSMC (Debian) Jessie system to Stretch.

The postinst script appears to fail to back up the old database, this leads to 
the entire postinst script failing thus causing a partially failed dist-upgrade 
and inconsistent APT state. The following is logged:

Setting up phpmyadmin (4:4.6.6-4) ...
Installing new version of config file /etc/phpmyadmin/apache.conf ...
Installing new version of config file /etc/phpmyadmin/config.inc.php ...
Installing new version of config file /etc/phpmyadmin/lighttpd.conf ...
Determining localhost credentials from /etc/mysql/debian.cnf: succeeded.
dbconfig-common: writing config to /etc/dbconfig-common/phpmyadmin.conf
Replacing config file /etc/dbconfig-common/phpmyadmin.conf with new version
Replacing config file /etc/phpmyadmin/config-db.php with new version
creating database backup in 
/var/cache/dbconfig-common/backups/phpmyadmin_4:4.2.12-2+deb8u2.2018-01-10-10.30.29.
dumping database as user failed, retrying with administrator credentials.
error encountered backing up the old database:
mysqldump: Couldn't execute 'SHOW FUNCTION STATUS WHERE Db = 'phpmyadmin'': 
Cannot load from mysql.proc. The table is probably corrupted (1728)
dbconfig-common: phpmyadmin configure: aborted.
dbconfig-common: flushing administrative password
ESC[1mdpkg:ESC[0m error processing package phpmyadmin (--configure):
 subprocess installed post-installation script returned error exit status 1

As part of a migration to stretch, mysql is replaced with mariadb, but it's 
unclear if this triggers the issue.

To reproduce the problem:

1) Install OSMC October 2017 or earlier, or standard Debian Jessie.
2) Install mysql-server
3) Install phpmyadmin - choose to let phpmyadmin configure both apache2 and set 
up the database. Check phpmyadmin is working.
4) Upgrade to stretch - on OSMC simply update via My OSMC. On vanilla Debian 
modify /etc/apt/sources.list and update the sources from jessie to stretch, run 
apt-get update and apt-get dist-upgrade.
   My OSMC update in OSMC performs a dist-upgrade in "unattended" mode so will 
use default actions and suppress all package prompts. This could be simulated 
in Debian by executing 'DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade'.

The failure of the phpmyadmin postinst script will abort the dist-upgrade and 
leave some packages including phpmyadmin unconfigured. It's possible to 
manually recover from the situation by manually running 'dpkg --configure -a'
then manually following the prompts to set up the phpmyadmin database again.

Although it may not be the issue in this instance I'd also suggest that 
attempting to back up the database during the postinst script and fail the 
script if this does not succeed is fundamentally flawed as no assumption should 
be
made by the package script that mysql is running at the time the phpmyadmin 
postinst script. If both the mysql/mariadb package and phpmyadmin package are 
scheduled to be upgraded during the same dist-upgrade session there is a
strong chance that mysql has been stopped and not yet restarted at the point 
that the phpmyadmin postinst script runs. Instead this sort of processing that 
requires database accesss should be handled when the service is restarted
instead of during the package upgrade process. The order in which mysql and 
phpmyadmin postinst scripts run is to some degree non deterministic depending 
on what other packages are scheduled to be upgraded so may cause random failures
of this type.

Kind Regards,
Simon Byrnand


-- System Information:
Debian Release: 9.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: armhf (aarch64)
Foreign Architectures: arm64

Kernel: Linux 3.14.29-51-osmc (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C), 
LANGUAGE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages phpmyadmin depends on:
ii  dbconfig-common                 2.0.8
ii  dbconfig-mysql                  2.0.8
ii  debconf [debconf-2.0]           1.5.61
ii  libjs-sphinxdoc                 1.4.9-2
ii  perl                            5.24.1-3+deb9u2
ii  php                             1:7.0+49
ii  php-cli                         1:7.0+49
ii  php-gettext                     1.0.12-0.1
ii  php-mbstring                    1:7.0+49
ii  php-mysql                       1:7.0+49
ii  php-php-gettext                 1.0.12-0.1
ii  php-phpseclib                   2.0.4-1
ii  php-xml                         1:7.0+49
ii  php7.0 [php]                    7.0.27-0+deb9u1
ii  php7.0-cli [php-cli]            7.0.27-0+deb9u1
ii  php7.0-json [php-json]          7.0.27-0+deb9u1
ii  php7.0-mbstring [php-mbstring]  7.0.27-0+deb9u1
ii  php7.0-xml [php-xml]            7.0.27-0+deb9u1
ii  ucf                             3.0036

Versions of packages phpmyadmin recommends:
ii  apache2 [httpd]  2.4.25-3+deb9u3
pn  php-bz2          <none>
pn  php-curl         <none>
pn  php-gd           <none>
pn  php-tcpdf        <none>
pn  php-zip          <none>

Versions of packages phpmyadmin suggests:
ii  default-mysql-server                        1.0.2
ii  mariadb-server-10.1 [virtual-mysql-server]  10.1.26-0+deb9u1
pn  www-browser                                 <none>

-- debconf information:
  phpmyadmin/mysql/method: Unix socket
* phpmyadmin/reconfigure-webserver: apache2
  phpmyadmin/remote/port:
  phpmyadmin/db/dbname: phpmyadmin
  phpmyadmin/upgrade-backup: true
* phpmyadmin/mysql/admin-user: debian-sys-maint
  phpmyadmin/missing-db-package-error: abort
  phpmyadmin/db/app-user: phpmyadmin@localhost
  phpmyadmin/dbconfig-remove:
  phpmyadmin/install-error: abort
* phpmyadmin/upgrade-error: ignore
  phpmyadmin/purge: false
  phpmyadmin/setup-username: admin
  phpmyadmin/database-type: mysql
  phpmyadmin/internal/reconfiguring: false
  phpmyadmin/remove-error: abort
  phpmyadmin/remote/host: localhost
  phpmyadmin/remote/newhost:
* phpmyadmin/dbconfig-upgrade: true
  phpmyadmin/passwords-do-not-match:
  phpmyadmin/dbconfig-reinstall: false
  phpmyadmin/internal/skip-preseed: false
* phpmyadmin/dbconfig-install: true

Reply via email to