package mariadb-common 10.0.29-0ubuntu0.16.04.1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 2

Bug #1676284 reported by Jerick Icamina
36
This bug affects 3 people
Affects Status Importance Assigned to Milestone
mariadb-10.0 (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

I cant replace my password and login bug AF

ProblemType: Package
DistroRelease: Ubuntu 16.04
Package: mariadb-common 10.0.29-0ubuntu0.16.04.1
ProcVersionSignature: Ubuntu 4.4.0-66.87-generic 4.4.44
Uname: Linux 4.4.0-66-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.5
Architecture: amd64
Date: Mon Mar 27 11:15:32 2017
Dependencies: mysql-common 5.7.17-0ubuntu0.16.04.1
DuplicateSignature:
 package:mariadb-common:10.0.29-0ubuntu0.16.04.1
 Setting up mariadb-common (10.0.29-0ubuntu0.16.04.1) ...
 update-alternatives: error: alternative path /etc/mysql/mariadb.cnf doesn't exist
 dpkg: error processing package mariadb-common (--configure):
  subprocess installed post-installation script returned error exit status 2
ErrorMessage: subprocess installed post-installation script returned error exit status 2
InstallationDate: Installed on 2017-03-04 (23 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
Logs.var.log.daemon.log:

Logs.var.log.mysql.error.log:

MySQLConf.etc.mysql.conf.d.mysql.cnf: [mysql]
MySQLConf.etc.mysql.conf.d.mysqldump.cnf:
 [mysqldump]
 quick
 quote-names
 max_allowed_packet = 16M
MySQLVarLibDirListing: ['multi-master.info', 'aria_log_control', 'ib_logfile1', 'aria_log.00000001', 'jerck-Satellite-L40D-A.err', 'mysql', 'ib_logfile0', 'jerck-Satellite-L40D-A.pid', 'debian-10.0.flag', 'ibdata1', 'performance_schema']
PackageArchitecture: all
ProcCmdline: BOOT_IMAGE=/boot/vmlinuz-4.4.0-66-generic root=UUID=b710e7e3-eec8-4116-90b6-799c94e4a2b8 ro quiet splash vt.handoff=7
RelatedPackageVersions:
 dpkg 1.18.4ubuntu1.1
 apt 1.2.19
SourcePackage: mariadb-10.0
Title: package mariadb-common 10.0.29-0ubuntu0.16.04.1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 2
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.mysql.debian-start: [deleted]
modified.conffile..etc.mysql.mariadb.conf.d.50-mysqld_safe.cnf: [deleted]
modified.conffile..etc.mysql.mariadb.conf.d.50-server.cnf: [deleted]

Revision history for this message
Jerick Icamina (jerickicamina) wrote :
tags: removed: need-duplicate-check
Revision history for this message
Faustin (fauust) wrote :

Hi Jerick,
this lines is relevant:
Setting up mariadb-common (10.0.29-0ubuntu0.16.04.1) ...
update-alternatives: error: alternative path /etc/mysql/mariadb.cnf doesn't exist

Could you explain the steps that led to this and give us the content of /etc/mysql dir?

BTW I am going to set bug 1676282 as a duplicate of this one. And this one contains much more relevant information.

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

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

Changed in mariadb-10.0 (Ubuntu):
status: New → Confirmed
Revision history for this message
Daniel (gustaw-daniel) wrote :

I have the same error:

   update-alternatives: error: alternative path /etc/mysql/mariadb.cnf doesn't exist

And this is content of /etc/mysql

   ls /etc/mysql
   conf.d mariadb.conf.d my.cnf my.cnf.fallback

Revision history for this message
Faustin (fauust) wrote :

Hi Daniel,
thank you for your help on this bug report.

Could you confirm what step led to this situation?

Could you give me the following information:
- version of mariadb-common that you are installing (apt-get download mariadb-common) ;
- copy paste the result of the following command:
$ dpkg --contents mariadb-common*.deb # (where mariadb-common*.deb is the package downloaded previously)

Faustin (fauust)
Changed in mariadb-10.0 (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for mariadb-10.0 (Ubuntu) because there has been no activity for 60 days.]

Changed in mariadb-10.0 (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Quintin Beukes (myceliguy) wrote :

I see this is expired but I am running into this scenario again and the steps to reproduce and fix this seem to be simple so I'm posting it here because backlinks lead me here. This can occur in many Ubuntu versions and it's essentially user error.

REPRODUCE:
The basic sequence and user reasoning appears to be:
1. User installs mysql-server

2. User decides to switch to mariadb, so he removes mysql packages but he doesn't purge the data directory

3. Then after installing mariadb, the service fails to start because the data directory is initialized by mysql. The person then decides to remove the mysql data manually.

4. So the user uninstalls all mariadb packages and then manually deletes the /etc/mysql and /var/lib/mysql directories.

5. But mysql-common is still lingering because it was installed as a dependency of mariadb-common. So the manual deletion of /etc/mysql left mysql-common in a broken state.

6. Now any attempts to install mariadb-server (or merely mariadb-common) will cause the installation to fail with this error:
update-alternatives: error: alternative path /etc/mysql/mariadb.cnf doesn't exist

A command sequence to reproduce this error is:
$ sudo apt -y purge 'mysql-*' 'mariadb-*' && sudo apt -y install mysql-server && sudo apt -y remove 'mysql-*' && sudo apt -y install mariadb-server && sudo apt -y remove 'mariadb-*' && sudo rm -rf /etc/mysql /var/lib/mysql && sudo apt -y install mariadb-common

CONCLUSION AND FIX:
To avoid the user error use the "apt purge" when removing mysql instead of "apt remove" with manually deletion of mysql configuration/data, because this leaves mysql-common broken.

If you've run into this problem, a simple fix is:
$ sudo apt -y purge mysql-common && sudo apt -y install mariadb-server

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.