[Bug 1676284] Re: package mariadb-common 10.0.29-0ubuntu0.16.04.1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 2
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 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1676284 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 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mariadb-10.0/+bug/1676284/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1676284] Re: package mariadb-common 10.0.29-0ubuntu0.16.04.1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 2
[Expired for mariadb-10.0 (Ubuntu) because there has been no activity for 60 days.] ** Changed in: mariadb-10.0 (Ubuntu) Status: Incomplete => Expired -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1676284 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 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mariadb-10.0/+bug/1676284/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1676284] Re: package mariadb-common 10.0.29-0ubuntu0.16.04.1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 2
** Changed in: mariadb-10.0 (Ubuntu) Status: Confirmed => Incomplete -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1676284 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 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mariadb-10.0/+bug/1676284/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1676284] Re: package mariadb-common 10.0.29-0ubuntu0.16.04.1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 2
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) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1676284 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 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mariadb-10.0/+bug/1676284/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1676284] Re: package mariadb-common 10.0.29-0ubuntu0.16.04.1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 2
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 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1676284 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 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mariadb-10.0/+bug/1676284/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1676284] Re: package mariadb-common 10.0.29-0ubuntu0.16.04.1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 2
Status changed to 'Confirmed' because the bug affects multiple users. ** Changed in: mariadb-10.0 (Ubuntu) Status: New => Confirmed -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1676284 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 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mariadb-10.0/+bug/1676284/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1676284] Re: package mariadb-common 10.0.29-0ubuntu0.16.04.1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 2
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. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1676284 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 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mariadb-10.0/+bug/1676284/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1676284] Re: package mariadb-common 10.0.29-0ubuntu0.16.04.1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 2
** Tags removed: need-duplicate-check -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1676284 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 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mariadb-10.0/+bug/1676284/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs