MySQL 5.6 refuses to install on systems that have had MariaDB 10.0 installed, preventing users from reverting to MySQL without manual intervention (aka mysql flag file system needs a redesign)

Bug #1490071 reported by David Rodríguez
496
This bug affects 108 people
Affects Status Importance Assigned to Milestone
mysql-5.7 (Debian)
New
Unknown
mysql-5.7 (Ubuntu)
Triaged
High
Roberta Pinheiro
mysql-8.0 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I installed MariaDB and then I tried to uninstall it but I couldn't because it said that it won't downgrade to 5.6 from 10.0..

ProblemType: Package
DistroRelease: Ubuntu 15.04
Package: mysql-server-5.6 5.6.25-0ubuntu0.15.04.1
ProcVersionSignature: Ubuntu 3.19.0-26.28-generic 3.19.8-ckt4
Uname: Linux 3.19.0-26-generic x86_64
ApportVersion: 2.17.2-0ubuntu1.3
Architecture: amd64
Date: Thu Aug 27 20:39:14 2015
DuplicateSignature: package:mysql-server-5.6:5.6.25-0ubuntu0.15.04.1:subprocess new pre-installation script returned error exit status 1
ErrorMessage: subprocess new pre-installation script returned error exit status 1
InstallationDate: Installed on 2015-08-24 (4 days ago)
InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Release amd64 (20150422)
Logs.var.log.daemon.log:

MySQLConf.etc.mysql.conf.d.mysql.cnf: [mysql]
MySQLConf.etc.mysql.conf.d.mysqldump.cnf:
 [mysqldump]
 quick
 quote-names
 max_allowed_packet = 16M
MySQLConf.etc.mysql.mysql.conf.d.mysqld.safe.syslog.cnf:
 [mysqld_safe]
 syslog
MySQLVarLibDirListing: ['ib_logfile0', 'ibdata1', 'auto.cnf', 'prueba', 'debian-5.6.flag', 'ib_logfile1', 'performance_schema', 'phpmyadmin', 'test', 'mysql']
ProcCmdline: BOOT_IMAGE=/boot/vmlinuz-3.19.0-26-generic root=UUID=174e17c5-ffbc-43ac-bb2b-35d77cd59538 ro quiet splash vt.handoff=7
RelatedPackageVersions:
 dpkg 1.17.25ubuntu1
 apt 1.0.9.7ubuntu4.1
SourcePackage: mysql-5.6
Title: package mysql-server-5.6 5.6.25-0ubuntu0.15.04.1 failed to install/upgrade: subprocess new pre-installation script returned error exit status 1
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
David Rodríguez (david-erazo14) wrote :
tags: removed: need-duplicate-check
Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

Unfortunately crossgrading from Oracle MySQL 5.6 to MariaDB 10.0 makes changes to the database in /var/lib/mysql/ that cannot be undone automatically, and we don't currently have a technical solution to this. You will need to fix this situation up manually.

IMHO, this is an interaction between MySQL and MariaDB that I think needs to be undone. MariaDB shouldn't write to /var/lib/mysql/ if it is going to make incompatible changes there. Instead it should use /var/lib/mariadb/ or something. I have proposed a solution previously on the pkg-mysql-maint list, but we have been working on other requirements to make a proper fix work first. We're not quite finished with the transition yet (mostly waiting on me), but let's keep this bug open to track this item.

summary: - package mysql-server-5.6 5.6.25-0ubuntu0.15.04.1 failed to
- install/upgrade: subprocess new pre-installation script returned error
- exit status 1
+ MariaDB writes to /var/lib/mysql after crossgrade, preventing users from
+ reverting to MySQL
Robie Basak (racb)
affects: mysql-5.6 (Ubuntu) → mariadb-10.0 (Ubuntu)
Revision history for this message
Otto Kekäläinen (otto) wrote : Re: MariaDB writes to /var/lib/mysql after crossgrade, preventing users from reverting to MySQL

Robie, sorry but you've understood this all wrong. I hope to clarify the status now.

The lines responsible for this downgrade prevention feature are these:

    # Safe the user from stupidities.
    show_downgrade_warning=0
    for i in `ls $DATADIR/debian-*.flag 2>/dev/null`; do
      found_version=`echo $i | sed 's/.*debian-\([0-9\.]\+\).flag/\1/'`
      if dpkg --compare-versions "$this_version" '<<' "$found_version"; then
        show_downgrade_warning=1
        break;
      fi
    done
    if [ "$show_downgrade_warning" = 1 ]; then
      db_fset mysql-server-$this_version/really_downgrade seen false || true
      db_input medium mysql-server-$this_version/really_downgrade || true
      db_go
      db_get mysql-server-$this_version/really_downgrade || true
      if [ "$RET" = "true" ]; then
        rm -f $DATADIR/debian-*.flag
        touch $DATADIR/debian-$this_version.flag
      else
        echo "Aborting downgrade from (at least) $found_version to $this_version." 1>&2
        echo "If are sure you want to downgrade to $this_version, remove the file" 1>&2
        echo "$DATADIR/debian-*.flag and try installing again." 1>&2
        db_stop
        exit 1
      fi
    fi

See source at http://anonscm.debian.org/cgit/pkg-mysql/mysql-5.5.git/tree/debian/mysql-server-5.5.preinst#n67

I am on purpose linking to the mysql-5.5 source to alleviate that this downgrade flag thing is old legacy that has been around for ages. This same code is in MySQL 5.6 packaging. It is completely unfair to blaim MariaDB for any of this.

When you wanted to implement the config file decoupling last year I multiple times asked you to "prove" your point by referencing to actual bug reports where any real users where suffering from something that config file decoupling would be the solution. I don't recall that you managed to do that. Even then all the examples you referenced to were really bugs regarding legacy packaging and for example this flag file thing.

I tried to prioritize fixing this flag time on mailing list and irc many times. For example:

    I'd also like us to review the package install/remove/purge
    pre/post-scripts, as they are the same across all new versions of all
    variants and while doing MariaDB I stumbled across multiple issues,
    which some of I've fixed (and you should copy those commits over to
    the mysql-5.6 git tree), and some of them are still unresolved and we
    need to fix them together. I think this is a high priority since many
    of the install/upgrade/remove errors people report bugs about are due
    the stupid legacy stuff in these scripts, and due to design issues
    like the /var/lib/mysql/*.flag system.

(from http://lists.alioth.debian.org/pipermail/pkg-mysql-maint/2014-November/007237.html)

Please change the title of the bug to something more appropriate and please participate in the discussion at pkg-mysql-maint mailing list about how to redesign this flag thing: http://lists.alioth.debian.org/pipermail/pkg-mysql-maint/2015-September/008128.html

affects: mariadb-10.0 (Ubuntu) → mysql-5.6 (Ubuntu)
summary: - MariaDB writes to /var/lib/mysql after crossgrade, preventing users from
- reverting to MySQL
+ MySQL 5.5/5.6 detects /var/lib/mysql/*.flag file and aborts installation
Revision history for this message
Robie Basak (racb) wrote : Re: [Bug 1490071] Re: MariaDB writes to /var/lib/mysql after crossgrade, preventing users from reverting to MySQL

On Tue, Sep 01, 2015 at 01:03:47PM -0000, Otto Kekäläinen wrote:
> Robie, sorry but you've understood this all wrong. I hope to clarify the
> status now.

Sorry. Let's work through this.

I thought it was fundamentally not supported to crossgrade a directory
from mariadb-10.0 to mysql-5.6? So I don't see how the flags thing comes
into this. So let's start here. Am I mistaken? Is there an
upstream-supproted path for getting from a /var/lib/mysql that is
running on MariaDB 10.0 to a /var/lib/mysql that is running on MySQL
5.6? If not upstream-supported, is it something we can do automatically
in distro packaging that will result in something that is upstream
supported again?

Revision history for this message
Otto Kekäläinen (otto) wrote : Re: MySQL 5.5/5.6 detects /var/lib/mysql/*.flag file and aborts installation

I belive too that it is fundamentally not supported to downgrade or crossgrade. From MySQL x.x to 5.5 to 5.6 users / database admins have been responsible for backing up their data and upgrading the database without having the option to go back. This is quite sensible and there is no point in trying to copy /var/lib/mysql-5.5 to say /var/lib/mysql-5.6 when most users have no intention to downgrade on the same installation (they will do it via backups if they must), and there is probably not diskspace to duplicate the database on each upgrade either.

There is nothing we can do to enable downgrading in particular.

The bug is about the user experience: how users are notified what happens and how dpkg is aborted into a broken state.

Revision history for this message
Robie Basak (racb) wrote : Re: [Bug 1490071] Re: MySQL 5.5/5.6 detects /var/lib/mysql/*.flag file and aborts installation

On Tue, Sep 01, 2015 at 01:38:26PM -0000, Otto Kekäläinen wrote:
> The bug is about the user experience: how users are notified what
> happens and how dpkg is aborted into a broken state.

I disagree. I'm treating this bug as tracking the fact that it cannot be
done, whereas I have proposed a mechanism by which it could be done.

I don't think it's acceptable for a crossgrade from MySQL to MariaDB to
take place in a way that cannot be reversed by MariaDB effectively
clobbering the MySQL packaging's data files, when otherwise removing and
re-installing the MySQL packaging only with no MariaDB involved would
work.

It is certainly non-trivial to fix in a way that works for everybody,
and we will need to talk more about how we can resolve this, but that
doesn't stop the issue from existing.

summary: - MySQL 5.5/5.6 detects /var/lib/mysql/*.flag file and aborts installation
+ MariaDB writes to /var/lib/mysql after crossgrade, preventing users from
+ reverting to MySQL without manual intervention
Revision history for this message
Robie Basak (racb) wrote : Re: MariaDB writes to /var/lib/mysql after crossgrade, preventing users from reverting to MySQL without manual intervention

> From MySQL x.x to 5.5 to 5.6 users / database admins have been responsible for backing up their data and upgrading the database without having the option to go back.

I expect every release to ship with only one version of (Oracle) MySQL, and reverting an upgrade across two releases is certainly not supported. So this is not inconsistent: within a single release, I expect a user to be able to switch from MySQL to MariaDB and back again. I do not a user to be able to switch from 5.5 to 5.6 and back again without user intervention, but this is fine because that would never happen within a single release.

Revision history for this message
Otto Kekäläinen (otto) wrote :

"I expect a user to be able to switch from MySQL to MariaDB and back again."

It works for MySQL 5.5 and MariaDB 5.5, the latter promising to be binary compatible wiith 5.5 The Debian packaging flag system in MySQL packages is compatible with this. The preinstall flag check will allow installation to proceed when switching back and forth between 5.5 variants.

A downgrade from MySQL 5.7 to 5.6 or MariaDB 10.0 to MySQL 5.6 is not guarenteed to work due to possible changes in database format. A user needs to downgrade manually via exportin and improting database dumps.

The bug is about the user experience: how users are notified what happens and how dpkg is aborted into a broken state.

..and the bug/feature really is in MySQL preinstall script (http://anonscm.debian.org/cgit/pkg-mysql/mysql-5.6.git/tree/debian/mysql-server-5.6.preinst#n67 is the exact line), so stop putting MariaDB in the bug title or assigning this to MariaDB package.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mysql-5.6 (Ubuntu):
status: New → Confirmed
Robie Basak (racb)
tags: added: mysql-packaging-policy
Changed in mysql-5.6 (Ubuntu):
importance: Undecided → High
Revision history for this message
Otto Kekäläinen (otto) wrote :

The title is still misleading. The problem can be fixed by changing the mysql package code. The part that the mariadb package does is not anything new, it is exactly the same code as in the mysql packages and originates from there.

summary: - MariaDB writes to /var/lib/mysql after crossgrade, preventing users from
- reverting to MySQL without manual intervention
+ MySQL 5.6 refuses to start on systems that have had MariaDB 10.0
+ installed, preventing users from reverting to MySQL without manual
+ intervention (aka mysql flag file system needs a redesign)
summary: - MySQL 5.6 refuses to start on systems that have had MariaDB 10.0
+ MySQL 5.6 refuses to install on systems that have had MariaDB 10.0
installed, preventing users from reverting to MySQL without manual
intervention (aka mysql flag file system needs a redesign)
Robie Basak (racb)
affects: mysql-5.6 (Ubuntu) → mysql-5.7 (Ubuntu)
Changed in mysql-5.7 (Ubuntu):
status: Confirmed → Triaged
Robie Basak (racb)
Changed in mysql-5.7 (Ubuntu):
milestone: none → ubuntu-16.10
Changed in mysql-5.7 (Ubuntu):
status: Triaged → Confirmed
assignee: nobody → ndebildos20115@gmail.com (ndebildos20115)
status: Confirmed → Incomplete
status: Incomplete → Confirmed
Revision history for this message
Robie Basak (racb) wrote :

@ndebildos20115

Please get in touch with Ubuntu devs before adjusting this bug.

Changed in mysql-5.7 (Ubuntu):
status: Confirmed → Triaged
assignee: ndebildos20115@gmail.com (ndebildos20115) → nobody
Revision history for this message
deutrino (deutrino) wrote :

I tried to remove mysql after encountering this bug and still had leftovers giving me errors every time I ran apt.

For those who ended up here looking for a workaround to remove debris, try:

sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server
sudo apt update && sudo apt dist-upgrade && sudo apt autoremove && sudo apt -f install

See also https://askubuntu.com/questions/789853/unable-to-install-or-remove-mysql

Revision history for this message
breno (breno-costeau) wrote : Re: [Bug 1490071] Re: MySQL 5.6 refuses to install on systems that have had MariaDB 10.0 installed, preventing users from reverting to MySQL without manual intervention (aka mysql flag file system needs a redesign)

Eu não entendi a mensagem em inglês, mas consegui resolver o problema.
Estava instalando a versão servidor como cliente. Posteriormente instalei a
versão cliente e funcionou corretamente

Em 19/10/2016 17:06, "Robie Basak" <email address hidden> escreveu:

> ** Bug watch added: Debian Bug tracker #841345
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841345
>
> ** Also affects: mysql-5.7 (Debian) via
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841345
> Importance: Unknown
> Status: Unknown
>
> --
> You received this bug notification because you are subscribed to a
> duplicate bug report (1577272).
> https://bugs.launchpad.net/bugs/1490071
>
> Title:
> MySQL 5.6 refuses to install on systems that have had MariaDB 10.0
> installed, preventing users from reverting to MySQL without manual
> intervention (aka mysql flag file system needs a redesign)
>
> Status in mysql-5.7 package in Ubuntu:
> Triaged
> Status in mysql-5.7 package in Debian:
> Unknown
>
> Bug description:
> I installed MariaDB and then I tried to uninstall it but I couldn't
> because it said that it won't downgrade to 5.6 from 10.0..
>
> ProblemType: Package
> DistroRelease: Ubuntu 15.04
> Package: mysql-server-5.6 5.6.25-0ubuntu0.15.04.1
> ProcVersionSignature: Ubuntu 3.19.0-26.28-generic 3.19.8-ckt4
> Uname: Linux 3.19.0-26-generic x86_64
> ApportVersion: 2.17.2-0ubuntu1.3
> Architecture: amd64
> Date: Thu Aug 27 20:39:14 2015
> DuplicateSignature: package:mysql-server-5.6:5.6.25-0ubuntu0.15.04.1:subprocess
> new pre-installation script returned error exit status 1
> ErrorMessage: subprocess new pre-installation script returned error exit
> status 1
> InstallationDate: Installed on 2015-08-24 (4 days ago)
> InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Release amd64 (20150422)
> Logs.var.log.daemon.log:
>
> MySQLConf.etc.mysql.conf.d.mysql.cnf: [mysql]
> MySQLConf.etc.mysql.conf.d.mysqldump.cnf:
> [mysqldump]
> quick
> quote-names
> max_allowed_packet = 16M
> MySQLConf.etc.mysql.mysql.conf.d.mysqld.safe.syslog.cnf:
> [mysqld_safe]
> syslog
> MySQLVarLibDirListing: ['ib_logfile0', 'ibdata1', 'auto.cnf', 'prueba',
> 'debian-5.6.flag', 'ib_logfile1', 'performance_schema', 'phpmyadmin',
> 'test', 'mysql']
> ProcCmdline: BOOT_IMAGE=/boot/vmlinuz-3.19.0-26-generic
> root=UUID=174e17c5-ffbc-43ac-bb2b-35d77cd59538 ro quiet splash
> vt.handoff=7
> RelatedPackageVersions:
> dpkg 1.17.25ubuntu1
> apt 1.0.9.7ubuntu4.1
> SourcePackage: mysql-5.6
> Title: package mysql-server-5.6 5.6.25-0ubuntu0.15.04.1 failed to
> install/upgrade: subprocess new pre-installation script returned error exit
> status 1
> UpgradeStatus: No upgrade log present (probably fresh install)
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/
> 1490071/+subscriptions
>

Changed in mysql-5.7 (Debian):
status: Unknown → New
Revision history for this message
tuxnani(రహ్మానుద్దీన్ షేక్) (rahimanuddin) wrote :

Any work around to remove this error?

Changed in mysql-5.7 (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Otto Kekäläinen (otto) wrote :

https://launchpad.net/~iamtiiinaaa does not seem to be a user who should mark this issue as fixed in any way. The flag system still needs a redesign.

Changed in mysql-5.7 (Ubuntu):
status: Fix Released → Triaged
Revision history for this message
SuperErik (erik-verheulconsultants) wrote :

Well this was annoying. I installed MariaDB 10.1 to find out that it was not compatible with Sonarqube 5.6.6. I purged MariaDB. MySql 5.7 failed to install.

My resolution: Delete all recent files in VAR. Uninstall the failed Mysql. Install Mysql again. Now it succeeded.

good luck,
Erik

Revision history for this message
LucMorizur (lucmorizur) wrote :

Tried to install mysql-server from terminal window:
-----------------------------------------
root@LACH4744:~# apt-get install mysql-server
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
The following additional packages will be installed:
  libevent-core-2.0-5 mysql-client-5.7 mysql-client-core-5.7 mysql-server-5.7 mysql-server-core-5.7
Paquets suggérés :
  mailx tinyca
Les NOUVEAUX paquets suivants seront installés :
  libevent-core-2.0-5 mysql-client-5.7 mysql-client-core-5.7 mysql-server mysql-server-5.7 mysql-server-core-5.7
0 mis à jour, 6 nouvellement installés, 0 à enlever et 0 non mis à jour.
Il est nécessaire de prendre 0 o/17,8 Mo dans les archives.
Après cette opération, 160 Mo d'espace disque supplémentaires seront utilisés.
Souhaitez-vous continuer ? [O/n] o
Préconfiguration des paquets...
Sélection du paquet mysql-client-core-5.7 précédemment désélectionné.
(Lecture de la base de données... 386350 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de .../mysql-client-core-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb ...
Dépaquetage de mysql-client-core-5.7 (5.7.19-0ubuntu0.16.04.1) ...
Sélection du paquet mysql-client-5.7 précédemment désélectionné.
Préparation du dépaquetage de .../mysql-client-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb ...
Dépaquetage de mysql-client-5.7 (5.7.19-0ubuntu0.16.04.1) ...
Sélection du paquet mysql-server-core-5.7 précédemment désélectionné.
Préparation du dépaquetage de .../mysql-server-core-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb ...
Dépaquetage de mysql-server-core-5.7 (5.7.19-0ubuntu0.16.04.1) ...
Sélection du paquet libevent-core-2.0-5:amd64 précédemment désélectionné.
Préparation du dépaquetage de .../libevent-core-2.0-5_2.0.21-stable-2ubuntu0.16.04.1_amd64.deb ...
Dépaquetage de libevent-core-2.0-5:amd64 (2.0.21-stable-2ubuntu0.16.04.1) ...
Préparation du dépaquetage de .../mysql-server-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb ...
Aborting downgrade from (at least) 10.0 to 5.7.
If are sure you want to downgrade to 5.7, remove the file
/var/lib/mysql/debian-*.flag and try installing again.
dpkg: erreur de traitement de l'archive /var/cache/apt/archives/mysql-server-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb (--unpack) :
 le sous-processus nouveau script pre-installation a retourné une erreur de sortie d'état 1
Sélection du paquet mysql-server précédemment désélectionné.
Préparation du dépaquetage de .../mysql-server_5.7.19-0ubuntu0.16.04.1_all.deb ...
Dépaquetage de mysql-server (5.7.19-0ubuntu0.16.04.1) ...
Traitement des actions différées (« triggers ») pour man-db (2.7.5-1) ...
Traitement des actions différées (« triggers ») pour libc-bin (2.23-0ubuntu9) ...
Des erreurs ont été rencontrées pendant l'exécution :
 /var/cache/apt/archives/mysql-server-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@LACH4744:~#
-----------------------------------------

Changed in mysql-5.7 (Ubuntu):
assignee: nobody → Roberta Pinheiro (hapera)
Changed in mysql-5.7 (Debian):
status: New → Fix Released
Changed in mysql-5.7 (Debian):
status: Fix Released → New
Revision history for this message
Bryce Harrington (bryce) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mysql-8.0 (Ubuntu):
status: New → Confirmed
To post a comment you must log in.