I'm running in circles currently, trying to fix some mysql problem.

I couldn't use apt-get for a while now, because it always stuck at the line Setting up mysql-server-5.6 (5.6.27-0ubuntu0.15.04.1) ... and didn't let me do anything. So I tried to reinstall mysql, purging it. While I was able to remove mysql-server and mysql-client eventually, I'm still unable to purge mysql-common. Obviously, I managed to corrupt something, but how can I get my system back and running at this point?

...:~# apt-get purge mysql-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  mysql-common*
0 upgraded, 0 newly installed, 1 to remove and 5 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 423600 files and directories currently installed.)
Removing mysql-common (5.6.27-0ubuntu0.15.04.1) ...
Purging configuration files for mysql-common (5.6.27-0ubuntu0.15.04.1) ...
update-alternatives: error: /var/lib/dpkg/alternatives/my.cnf corrupt: invalid status
dpkg: error processing package mysql-common (--purge):
 subprocess installed post-removal script returned error exit status 2
Errors were encountered while processing:
 mysql-common
E: Sub-process /usr/bin/dpkg returned an error code (1)

-

...# sudo dpkg -P --force-all mysql-common
(Reading database ... 424733 files and directories currently installed.)
Removing mysql-common (5.6.27-0ubuntu0.15.04.1) ...
Purging configuration files for mysql-common (5.6.27-0ubuntu0.15.04.1) ...
update-alternatives: error: no alternatives for my.cnf
dpkg: error processing package mysql-common (--purge):
 subprocess installed post-removal script returned error exit status 2
Errors were encountered while processing:
 mysql-common

-

...:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 15.04
Release:    15.04
Codename:   vivid

My goal is to just get it back and running again (mysql).

share|improve this question
    
I don't think you ought to have a file my.cnf in /var/lib/dpkg/alternatives. To be sure, do update-alternatives --query mysql-common. That will probably fail as well, but if the output looks relevant, please add it to your question. If it simply fails with a similar message, remove /var/lib/dpkg/alternatives and try the purge operation again. – Jos Dec 31 '15 at 9:57
    
As you expected, update-alternatives only gave out no alternatives for mysql-common again. I noticed that /var/lib/dpkg/alternatives/my.cfg seemed to exist. As you suggested, I moved the whole folder before trying to redo the purge operation, but the result stays the same as above. No change / effect. – Katai Dec 31 '15 at 10:08
    
sudo dpkg -P --force-all mysql-common – A.B. Dec 31 '15 at 10:59
    
@A.B. I tried that and added the output to my question - sadly, same effect: no alternatives for my.cfg – Katai Dec 31 '15 at 12:32
    
What's the output of cat /var/lib/dpkg/alternatives/my.cnf – A.B. Dec 31 '15 at 12:47
up vote 2 down vote accepted

After some words in the chat, here is the solution:

sudo rm /etc/alternatives/my.cnf
sudo ln -s /etc/mysql/mysql.cnf /etc/alternatives/my.cnf

Why? The file /etc/alternatives/my.cnf has to be a link and nothing else.

That was the error message:

$ sudo update-alternatives --config my.cnf 
update-alternatives: warning: alternative /etc/mysql/mysql.cnf (part of link group my.cnf) doesn't exist; removing from list of alternatives
update-alternatives: error: unable to read link `/etc/alternatives/my.cnf': Invalid argument
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.