Cannot reinstall mysql-server after its purge
I recently did a fresh install of Ubuntu 16.04. I also installed mysql-server
and mysql-client
(their default version 5.7.12) via apt-get install
.
Because 5.7.12 was showing some issues, I decided to uninstall it. I tried apt-get remove mysql-server mysql-client
first but saw that artifacts like /etc/mysql
and /var/lib/mysql
didn't get removed.
I then tried apt-get --purge removed mysql-server mysql-client
, but still no difference.
So, I manually removed them (via rm -rf
). I also manually removed all *mysql*
files under /usr/
that came from any mysql-*
dependency packages like mysql-common
.
However, now, when I wish to re-install mysql-server and -client
, I'm finding that I cannot.
In fact, now I'm in a state where I can neither apt-get remove mysql-server
nor apt-get install mysql-server
!
How do fix the situation I am in? If my local package repository metadata has become corrupted, how do I repair it?
I'd hate to reinstall the whole blessed OS with all my other apps and environment, one more time just because of mysql-server
.
The following, for example, is the error I get when I try to remove mysql-server
:
$ apt-get remove mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libaio1 mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
mysql-server
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 159 kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 237601 files and directories currently installed.)
Removing mysql-server (5.7.12-0ubuntu1) ...
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)
And when trying to install, I get this error:
$ apt-get -f install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
mysql-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/10.1 kB of archives.
After this operation, 159 kB of additional disk space will be used.
Selecting previously unselected package mysql-server.
(Reading database ... 237599 files and directories currently installed.)
Preparing to unpack .../mysql-server_5.7.12-0ubuntu1_all.deb ...
Unpacking mysql-server (5.7.12-0ubuntu1) ...
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Here's the output of apt-get install -f
:
$ apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
mysql 16.04
add a comment |
I recently did a fresh install of Ubuntu 16.04. I also installed mysql-server
and mysql-client
(their default version 5.7.12) via apt-get install
.
Because 5.7.12 was showing some issues, I decided to uninstall it. I tried apt-get remove mysql-server mysql-client
first but saw that artifacts like /etc/mysql
and /var/lib/mysql
didn't get removed.
I then tried apt-get --purge removed mysql-server mysql-client
, but still no difference.
So, I manually removed them (via rm -rf
). I also manually removed all *mysql*
files under /usr/
that came from any mysql-*
dependency packages like mysql-common
.
However, now, when I wish to re-install mysql-server and -client
, I'm finding that I cannot.
In fact, now I'm in a state where I can neither apt-get remove mysql-server
nor apt-get install mysql-server
!
How do fix the situation I am in? If my local package repository metadata has become corrupted, how do I repair it?
I'd hate to reinstall the whole blessed OS with all my other apps and environment, one more time just because of mysql-server
.
The following, for example, is the error I get when I try to remove mysql-server
:
$ apt-get remove mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libaio1 mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
mysql-server
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 159 kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 237601 files and directories currently installed.)
Removing mysql-server (5.7.12-0ubuntu1) ...
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)
And when trying to install, I get this error:
$ apt-get -f install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
mysql-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/10.1 kB of archives.
After this operation, 159 kB of additional disk space will be used.
Selecting previously unselected package mysql-server.
(Reading database ... 237599 files and directories currently installed.)
Preparing to unpack .../mysql-server_5.7.12-0ubuntu1_all.deb ...
Unpacking mysql-server (5.7.12-0ubuntu1) ...
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Here's the output of apt-get install -f
:
$ apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
mysql 16.04
It looks likemysql-server-5.7
is in a bad state, try to reinstall it:sudo apt-get install --reinstall mysql-server-5.7
.
– fkraiem
Apr 27 '16 at 5:30
Makes no difference, I get the same error line:... invoke-rc.d: initscript mysql, action "start" failed. ...
that I'm getting with other flavors of install commands.
– Harry
Apr 27 '16 at 5:48
Try to remove it, then...sudo apt-get remove --purge mysql-server-5.7
. Note that this is reallymysql-server-5.7
we are talking about, notmysql-server
.
– fkraiem
Apr 27 '16 at 5:49
@Harry Many times, I restart the system to get rid of this type of error.
– d a i s y
Apr 27 '16 at 6:22
My problem solved by following this post
– Raizal I.N. Pregnanta
Apr 7 '17 at 15:16
add a comment |
I recently did a fresh install of Ubuntu 16.04. I also installed mysql-server
and mysql-client
(their default version 5.7.12) via apt-get install
.
Because 5.7.12 was showing some issues, I decided to uninstall it. I tried apt-get remove mysql-server mysql-client
first but saw that artifacts like /etc/mysql
and /var/lib/mysql
didn't get removed.
I then tried apt-get --purge removed mysql-server mysql-client
, but still no difference.
So, I manually removed them (via rm -rf
). I also manually removed all *mysql*
files under /usr/
that came from any mysql-*
dependency packages like mysql-common
.
However, now, when I wish to re-install mysql-server and -client
, I'm finding that I cannot.
In fact, now I'm in a state where I can neither apt-get remove mysql-server
nor apt-get install mysql-server
!
How do fix the situation I am in? If my local package repository metadata has become corrupted, how do I repair it?
I'd hate to reinstall the whole blessed OS with all my other apps and environment, one more time just because of mysql-server
.
The following, for example, is the error I get when I try to remove mysql-server
:
$ apt-get remove mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libaio1 mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
mysql-server
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 159 kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 237601 files and directories currently installed.)
Removing mysql-server (5.7.12-0ubuntu1) ...
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)
And when trying to install, I get this error:
$ apt-get -f install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
mysql-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/10.1 kB of archives.
After this operation, 159 kB of additional disk space will be used.
Selecting previously unselected package mysql-server.
(Reading database ... 237599 files and directories currently installed.)
Preparing to unpack .../mysql-server_5.7.12-0ubuntu1_all.deb ...
Unpacking mysql-server (5.7.12-0ubuntu1) ...
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Here's the output of apt-get install -f
:
$ apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
mysql 16.04
I recently did a fresh install of Ubuntu 16.04. I also installed mysql-server
and mysql-client
(their default version 5.7.12) via apt-get install
.
Because 5.7.12 was showing some issues, I decided to uninstall it. I tried apt-get remove mysql-server mysql-client
first but saw that artifacts like /etc/mysql
and /var/lib/mysql
didn't get removed.
I then tried apt-get --purge removed mysql-server mysql-client
, but still no difference.
So, I manually removed them (via rm -rf
). I also manually removed all *mysql*
files under /usr/
that came from any mysql-*
dependency packages like mysql-common
.
However, now, when I wish to re-install mysql-server and -client
, I'm finding that I cannot.
In fact, now I'm in a state where I can neither apt-get remove mysql-server
nor apt-get install mysql-server
!
How do fix the situation I am in? If my local package repository metadata has become corrupted, how do I repair it?
I'd hate to reinstall the whole blessed OS with all my other apps and environment, one more time just because of mysql-server
.
The following, for example, is the error I get when I try to remove mysql-server
:
$ apt-get remove mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libaio1 mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
mysql-server
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 159 kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 237601 files and directories currently installed.)
Removing mysql-server (5.7.12-0ubuntu1) ...
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)
And when trying to install, I get this error:
$ apt-get -f install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
mysql-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/10.1 kB of archives.
After this operation, 159 kB of additional disk space will be used.
Selecting previously unselected package mysql-server.
(Reading database ... 237599 files and directories currently installed.)
Preparing to unpack .../mysql-server_5.7.12-0ubuntu1_all.deb ...
Unpacking mysql-server (5.7.12-0ubuntu1) ...
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Here's the output of apt-get install -f
:
$ apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
mysql 16.04
mysql 16.04
edited Apr 27 '16 at 5:21
Harry
asked Apr 27 '16 at 4:25
HarryHarry
231136
231136
It looks likemysql-server-5.7
is in a bad state, try to reinstall it:sudo apt-get install --reinstall mysql-server-5.7
.
– fkraiem
Apr 27 '16 at 5:30
Makes no difference, I get the same error line:... invoke-rc.d: initscript mysql, action "start" failed. ...
that I'm getting with other flavors of install commands.
– Harry
Apr 27 '16 at 5:48
Try to remove it, then...sudo apt-get remove --purge mysql-server-5.7
. Note that this is reallymysql-server-5.7
we are talking about, notmysql-server
.
– fkraiem
Apr 27 '16 at 5:49
@Harry Many times, I restart the system to get rid of this type of error.
– d a i s y
Apr 27 '16 at 6:22
My problem solved by following this post
– Raizal I.N. Pregnanta
Apr 7 '17 at 15:16
add a comment |
It looks likemysql-server-5.7
is in a bad state, try to reinstall it:sudo apt-get install --reinstall mysql-server-5.7
.
– fkraiem
Apr 27 '16 at 5:30
Makes no difference, I get the same error line:... invoke-rc.d: initscript mysql, action "start" failed. ...
that I'm getting with other flavors of install commands.
– Harry
Apr 27 '16 at 5:48
Try to remove it, then...sudo apt-get remove --purge mysql-server-5.7
. Note that this is reallymysql-server-5.7
we are talking about, notmysql-server
.
– fkraiem
Apr 27 '16 at 5:49
@Harry Many times, I restart the system to get rid of this type of error.
– d a i s y
Apr 27 '16 at 6:22
My problem solved by following this post
– Raizal I.N. Pregnanta
Apr 7 '17 at 15:16
It looks like
mysql-server-5.7
is in a bad state, try to reinstall it: sudo apt-get install --reinstall mysql-server-5.7
.– fkraiem
Apr 27 '16 at 5:30
It looks like
mysql-server-5.7
is in a bad state, try to reinstall it: sudo apt-get install --reinstall mysql-server-5.7
.– fkraiem
Apr 27 '16 at 5:30
Makes no difference, I get the same error line:
... invoke-rc.d: initscript mysql, action "start" failed. ...
that I'm getting with other flavors of install commands.– Harry
Apr 27 '16 at 5:48
Makes no difference, I get the same error line:
... invoke-rc.d: initscript mysql, action "start" failed. ...
that I'm getting with other flavors of install commands.– Harry
Apr 27 '16 at 5:48
Try to remove it, then...
sudo apt-get remove --purge mysql-server-5.7
. Note that this is really mysql-server-5.7
we are talking about, not mysql-server
.– fkraiem
Apr 27 '16 at 5:49
Try to remove it, then...
sudo apt-get remove --purge mysql-server-5.7
. Note that this is really mysql-server-5.7
we are talking about, not mysql-server
.– fkraiem
Apr 27 '16 at 5:49
@Harry Many times, I restart the system to get rid of this type of error.
– d a i s y
Apr 27 '16 at 6:22
@Harry Many times, I restart the system to get rid of this type of error.
– d a i s y
Apr 27 '16 at 6:22
My problem solved by following this post
– Raizal I.N. Pregnanta
Apr 7 '17 at 15:16
My problem solved by following this post
– Raizal I.N. Pregnanta
Apr 7 '17 at 15:16
add a comment |
6 Answers
6
active
oldest
votes
Edited Jan 10 2017: This is a major review of this post to correct serious issues in this post.
The Error at Heart
The problem is that the package is still on the system in an half-installed and half-configured state and needs to be explicitly removed.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
What its really saying is that the package mysql-server-5.7
is a dependency for mysql-server
, is already installed, but is not configured. So you need to purge
it to remove those breadcrumbs left behind by mysql-server-5.7
.
sudo apt purge mysql-server mysql-server-5.7
Rationale
When you install software using apt
, it automatically handles dependencies for you as well.
When you remove certain packages, it may not handle those same dependencies. In the case of this post, that dependency is mysql-server-5.7
.
You can check to see a package state by issuing the following command.
dpkg-query -l [package-name-here]
Usually if you see the code un
or rc
to the left of the package name, you'll be able to tell if it actually is a broken package.
When I experienced this issue, it was with libapache2-mod-php
and libapache2-mod-php7.0
. This was my output.
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===========================-==================-==================-============================================================
un libapache2-mod-php <none> <none> (no description available)
In my case, it claimed that the status of my package is unknown and that it is not installed (the code un
) on my system.
When you tell apt
to remove
something, it can leave packages, configuration files, and other items that can be problematic during automated installations.
When you tell apt
to purge
something it does it's best to remove any breadcrumbs that remove
might have left behind.
I originally stated that I assumed the process was still running, but most likely it was Inactive, or dead.
The best way to check if the service is interfering with your package removal is to check that service first.
1) Investigating the mysql
service
Using the system error given to us by apt
, we can actually use systemctl
to investigate the error by checking on the status of the mysql
service
sudo systemctl status [pattern]
In our case, we want to see if mysql is running so can type in
systemctl status mysql.service
You should see this output if the service is running
systemctl status mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2017-01-10 23:10:06 EST; 1h 3min ago
Main PID: 1206 (mysqld)
CGroup: /system.slice/mysql.service
└─1206 /usr/sbin/mysqld
note: If the service is dead, you'll see a short message indicating that there is no service by that name running and then skip to step 3.
2) Stopping the mysql
service using systemctl
note: [pattern] must be the name listed by service
or initctl
. the reason I use pattern
is because systemctl
uses regex matching, so be careful if you must use the kill
argument.
sudo systemctl stop [pattern]
where pattern
represents the mysql daemon/service name. if stop does not work try
sudo systemctl kill [pattern]
For example
sudo systemctl stop mysql
3) Uninstalling/purging mysql
if you need to totally purge, make sure the service or process is stopped first and then make sure you're removing the right files and directories!
Note: Make sure you are targeting the correct mysql
version. For example, if you use 5.5, adjust the version number appropriately.
WARNING: the following steps will delete your data! (the first command must be executed to do a backup)
source: How do I uninstall MySQL?
tar -zcvf ~/msql_backup.tar.gz /etc/mysql /var/lib/mysql
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-5.7 mysql-client-core-5.7
sudo rm -rfv /etc/mysql /var/lib/mysql
sudo apt autoremove
sudo apt autoclean
4) Fixing broken packages and handling missing dependencies
If the preceding steps did not work for you, you may need to run apt
with the --fix-broken
option to repair any damage done.
Make sure to apt update
first and then apt install
sudo apt update
sudo apt install mysql-server mysql-client --fix-broken --fix-missing
5) When all else fails, build and install mysql
yourself
If none of the above works, you'll have to manually download the source, compile, and use make or bash to install from there (not as painful as it sounds since its all automated).
"16.04 is riddled with loads of bugs right now." Works for me, including MySQL. It seems to me that most of the problems we see here arise from people doing something wrong, like trying torm
files belonging to packages.
– fkraiem
Apr 27 '16 at 10:03
1
Excellent Work buddy! thank you. i wasted my whole day by using some stupid instructions. Now this worked!
– Renjith VR
Jun 23 '16 at 15:25
I have followed your instructions and sudo systemctl stop mysql seemed to work. However after reboot it was broken again. start or stop does not work. sudo systemctl status mysql shows: Active: deactivating (stop-sigterm) since Mon 2016-06-27 11:05:22 BST; 8min ago Do I REALLY have to wait 10 minutes for mysql to stop? Aren't you surprised that people purge a service that didn't fully stop? Is it possible that Ubuntu 16.04 will fix it? What are the options, going back to previous LTS version or another distro?
– ruby_object
Jun 27 '16 at 10:22
Thanks removing and reinstalling this way worked perfectly!
– Louwki
Sep 23 '16 at 11:21
5
note:sudo rm -rf /var/lib/mysql
will remove all your databases in default location. DO a back up first!
– augusto
Oct 10 '16 at 10:54
|
show 6 more comments
The problem with the first post is you can't reconfigure a meta-package well not for the sql items. You need to specify the current release item.
Say use;
apt search mysql-server
That should display a list of packages namely
"mysql-server-5.7" "mysql-server-core-5.7" or later releases
then;
dpkg-reconfigure --force mysql-server-5.7 mysql-server-core-5.7
done.
add a comment |
This is the correct solution for you
First, you will have to remove all packages of mysql-server:
WARNING: the following steps will delete your data! Do a backup first!
sudo rm -rf /var/lib/mysql
Then install:
sudo apt-get install lamp-server^
Or you can do:
sudo apt-get install mysql-server
add a comment |
I saw this
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
as a clue that there was still an erroneous start-up script in existence.
Look for /etc/init.d/mysql
and any symlinks to it. Removing these appeared to fix my reinstall-after-purge problems.
add a comment |
This error also happened when switching from MySQL to MariaDB (https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1490071).
The MySQL binary data files were not compatible with MariaDB so I switched back to MySQL because I did not have time to mess with mysqldump.
First I had to move MariaDB data away from /var/lib/mysql
, then install MySQL and then move my original data from /var/lib/mysql-5.7
(this backup was automatically created before the error) to /var/lib/mysql
.
add a comment |
Try apt-get -f install
to fix your broken SQL package and if you are still in problem with package manager download SQL server source code and compile it !!
But try above command and also use dpkg -l | grep sql
to find out package manager still think you SQL or not ..
Did not work. I've also included the error I get when trying to install the package.
– Harry
Apr 27 '16 at 5:03
@Harry You should runapt-get -f install
by itself, without specifying a package name.
– fkraiem
Apr 27 '16 at 5:08
As fkraim said use it with out package name ...
– Ali Ghasempour
Apr 27 '16 at 5:18
Appended the output ofapt-get install -f
, no change.
– Harry
Apr 27 '16 at 5:21
Try synaptic application and check it says there is broken package or not ( on left column )[ if you have desktop ]
– Ali Ghasempour
Apr 27 '16 at 5:26
|
show 1 more comment
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f763534%2fcannot-reinstall-mysql-server-after-its-purge%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
Edited Jan 10 2017: This is a major review of this post to correct serious issues in this post.
The Error at Heart
The problem is that the package is still on the system in an half-installed and half-configured state and needs to be explicitly removed.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
What its really saying is that the package mysql-server-5.7
is a dependency for mysql-server
, is already installed, but is not configured. So you need to purge
it to remove those breadcrumbs left behind by mysql-server-5.7
.
sudo apt purge mysql-server mysql-server-5.7
Rationale
When you install software using apt
, it automatically handles dependencies for you as well.
When you remove certain packages, it may not handle those same dependencies. In the case of this post, that dependency is mysql-server-5.7
.
You can check to see a package state by issuing the following command.
dpkg-query -l [package-name-here]
Usually if you see the code un
or rc
to the left of the package name, you'll be able to tell if it actually is a broken package.
When I experienced this issue, it was with libapache2-mod-php
and libapache2-mod-php7.0
. This was my output.
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===========================-==================-==================-============================================================
un libapache2-mod-php <none> <none> (no description available)
In my case, it claimed that the status of my package is unknown and that it is not installed (the code un
) on my system.
When you tell apt
to remove
something, it can leave packages, configuration files, and other items that can be problematic during automated installations.
When you tell apt
to purge
something it does it's best to remove any breadcrumbs that remove
might have left behind.
I originally stated that I assumed the process was still running, but most likely it was Inactive, or dead.
The best way to check if the service is interfering with your package removal is to check that service first.
1) Investigating the mysql
service
Using the system error given to us by apt
, we can actually use systemctl
to investigate the error by checking on the status of the mysql
service
sudo systemctl status [pattern]
In our case, we want to see if mysql is running so can type in
systemctl status mysql.service
You should see this output if the service is running
systemctl status mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2017-01-10 23:10:06 EST; 1h 3min ago
Main PID: 1206 (mysqld)
CGroup: /system.slice/mysql.service
└─1206 /usr/sbin/mysqld
note: If the service is dead, you'll see a short message indicating that there is no service by that name running and then skip to step 3.
2) Stopping the mysql
service using systemctl
note: [pattern] must be the name listed by service
or initctl
. the reason I use pattern
is because systemctl
uses regex matching, so be careful if you must use the kill
argument.
sudo systemctl stop [pattern]
where pattern
represents the mysql daemon/service name. if stop does not work try
sudo systemctl kill [pattern]
For example
sudo systemctl stop mysql
3) Uninstalling/purging mysql
if you need to totally purge, make sure the service or process is stopped first and then make sure you're removing the right files and directories!
Note: Make sure you are targeting the correct mysql
version. For example, if you use 5.5, adjust the version number appropriately.
WARNING: the following steps will delete your data! (the first command must be executed to do a backup)
source: How do I uninstall MySQL?
tar -zcvf ~/msql_backup.tar.gz /etc/mysql /var/lib/mysql
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-5.7 mysql-client-core-5.7
sudo rm -rfv /etc/mysql /var/lib/mysql
sudo apt autoremove
sudo apt autoclean
4) Fixing broken packages and handling missing dependencies
If the preceding steps did not work for you, you may need to run apt
with the --fix-broken
option to repair any damage done.
Make sure to apt update
first and then apt install
sudo apt update
sudo apt install mysql-server mysql-client --fix-broken --fix-missing
5) When all else fails, build and install mysql
yourself
If none of the above works, you'll have to manually download the source, compile, and use make or bash to install from there (not as painful as it sounds since its all automated).
"16.04 is riddled with loads of bugs right now." Works for me, including MySQL. It seems to me that most of the problems we see here arise from people doing something wrong, like trying torm
files belonging to packages.
– fkraiem
Apr 27 '16 at 10:03
1
Excellent Work buddy! thank you. i wasted my whole day by using some stupid instructions. Now this worked!
– Renjith VR
Jun 23 '16 at 15:25
I have followed your instructions and sudo systemctl stop mysql seemed to work. However after reboot it was broken again. start or stop does not work. sudo systemctl status mysql shows: Active: deactivating (stop-sigterm) since Mon 2016-06-27 11:05:22 BST; 8min ago Do I REALLY have to wait 10 minutes for mysql to stop? Aren't you surprised that people purge a service that didn't fully stop? Is it possible that Ubuntu 16.04 will fix it? What are the options, going back to previous LTS version or another distro?
– ruby_object
Jun 27 '16 at 10:22
Thanks removing and reinstalling this way worked perfectly!
– Louwki
Sep 23 '16 at 11:21
5
note:sudo rm -rf /var/lib/mysql
will remove all your databases in default location. DO a back up first!
– augusto
Oct 10 '16 at 10:54
|
show 6 more comments
Edited Jan 10 2017: This is a major review of this post to correct serious issues in this post.
The Error at Heart
The problem is that the package is still on the system in an half-installed and half-configured state and needs to be explicitly removed.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
What its really saying is that the package mysql-server-5.7
is a dependency for mysql-server
, is already installed, but is not configured. So you need to purge
it to remove those breadcrumbs left behind by mysql-server-5.7
.
sudo apt purge mysql-server mysql-server-5.7
Rationale
When you install software using apt
, it automatically handles dependencies for you as well.
When you remove certain packages, it may not handle those same dependencies. In the case of this post, that dependency is mysql-server-5.7
.
You can check to see a package state by issuing the following command.
dpkg-query -l [package-name-here]
Usually if you see the code un
or rc
to the left of the package name, you'll be able to tell if it actually is a broken package.
When I experienced this issue, it was with libapache2-mod-php
and libapache2-mod-php7.0
. This was my output.
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===========================-==================-==================-============================================================
un libapache2-mod-php <none> <none> (no description available)
In my case, it claimed that the status of my package is unknown and that it is not installed (the code un
) on my system.
When you tell apt
to remove
something, it can leave packages, configuration files, and other items that can be problematic during automated installations.
When you tell apt
to purge
something it does it's best to remove any breadcrumbs that remove
might have left behind.
I originally stated that I assumed the process was still running, but most likely it was Inactive, or dead.
The best way to check if the service is interfering with your package removal is to check that service first.
1) Investigating the mysql
service
Using the system error given to us by apt
, we can actually use systemctl
to investigate the error by checking on the status of the mysql
service
sudo systemctl status [pattern]
In our case, we want to see if mysql is running so can type in
systemctl status mysql.service
You should see this output if the service is running
systemctl status mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2017-01-10 23:10:06 EST; 1h 3min ago
Main PID: 1206 (mysqld)
CGroup: /system.slice/mysql.service
└─1206 /usr/sbin/mysqld
note: If the service is dead, you'll see a short message indicating that there is no service by that name running and then skip to step 3.
2) Stopping the mysql
service using systemctl
note: [pattern] must be the name listed by service
or initctl
. the reason I use pattern
is because systemctl
uses regex matching, so be careful if you must use the kill
argument.
sudo systemctl stop [pattern]
where pattern
represents the mysql daemon/service name. if stop does not work try
sudo systemctl kill [pattern]
For example
sudo systemctl stop mysql
3) Uninstalling/purging mysql
if you need to totally purge, make sure the service or process is stopped first and then make sure you're removing the right files and directories!
Note: Make sure you are targeting the correct mysql
version. For example, if you use 5.5, adjust the version number appropriately.
WARNING: the following steps will delete your data! (the first command must be executed to do a backup)
source: How do I uninstall MySQL?
tar -zcvf ~/msql_backup.tar.gz /etc/mysql /var/lib/mysql
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-5.7 mysql-client-core-5.7
sudo rm -rfv /etc/mysql /var/lib/mysql
sudo apt autoremove
sudo apt autoclean
4) Fixing broken packages and handling missing dependencies
If the preceding steps did not work for you, you may need to run apt
with the --fix-broken
option to repair any damage done.
Make sure to apt update
first and then apt install
sudo apt update
sudo apt install mysql-server mysql-client --fix-broken --fix-missing
5) When all else fails, build and install mysql
yourself
If none of the above works, you'll have to manually download the source, compile, and use make or bash to install from there (not as painful as it sounds since its all automated).
"16.04 is riddled with loads of bugs right now." Works for me, including MySQL. It seems to me that most of the problems we see here arise from people doing something wrong, like trying torm
files belonging to packages.
– fkraiem
Apr 27 '16 at 10:03
1
Excellent Work buddy! thank you. i wasted my whole day by using some stupid instructions. Now this worked!
– Renjith VR
Jun 23 '16 at 15:25
I have followed your instructions and sudo systemctl stop mysql seemed to work. However after reboot it was broken again. start or stop does not work. sudo systemctl status mysql shows: Active: deactivating (stop-sigterm) since Mon 2016-06-27 11:05:22 BST; 8min ago Do I REALLY have to wait 10 minutes for mysql to stop? Aren't you surprised that people purge a service that didn't fully stop? Is it possible that Ubuntu 16.04 will fix it? What are the options, going back to previous LTS version or another distro?
– ruby_object
Jun 27 '16 at 10:22
Thanks removing and reinstalling this way worked perfectly!
– Louwki
Sep 23 '16 at 11:21
5
note:sudo rm -rf /var/lib/mysql
will remove all your databases in default location. DO a back up first!
– augusto
Oct 10 '16 at 10:54
|
show 6 more comments
Edited Jan 10 2017: This is a major review of this post to correct serious issues in this post.
The Error at Heart
The problem is that the package is still on the system in an half-installed and half-configured state and needs to be explicitly removed.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
What its really saying is that the package mysql-server-5.7
is a dependency for mysql-server
, is already installed, but is not configured. So you need to purge
it to remove those breadcrumbs left behind by mysql-server-5.7
.
sudo apt purge mysql-server mysql-server-5.7
Rationale
When you install software using apt
, it automatically handles dependencies for you as well.
When you remove certain packages, it may not handle those same dependencies. In the case of this post, that dependency is mysql-server-5.7
.
You can check to see a package state by issuing the following command.
dpkg-query -l [package-name-here]
Usually if you see the code un
or rc
to the left of the package name, you'll be able to tell if it actually is a broken package.
When I experienced this issue, it was with libapache2-mod-php
and libapache2-mod-php7.0
. This was my output.
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===========================-==================-==================-============================================================
un libapache2-mod-php <none> <none> (no description available)
In my case, it claimed that the status of my package is unknown and that it is not installed (the code un
) on my system.
When you tell apt
to remove
something, it can leave packages, configuration files, and other items that can be problematic during automated installations.
When you tell apt
to purge
something it does it's best to remove any breadcrumbs that remove
might have left behind.
I originally stated that I assumed the process was still running, but most likely it was Inactive, or dead.
The best way to check if the service is interfering with your package removal is to check that service first.
1) Investigating the mysql
service
Using the system error given to us by apt
, we can actually use systemctl
to investigate the error by checking on the status of the mysql
service
sudo systemctl status [pattern]
In our case, we want to see if mysql is running so can type in
systemctl status mysql.service
You should see this output if the service is running
systemctl status mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2017-01-10 23:10:06 EST; 1h 3min ago
Main PID: 1206 (mysqld)
CGroup: /system.slice/mysql.service
└─1206 /usr/sbin/mysqld
note: If the service is dead, you'll see a short message indicating that there is no service by that name running and then skip to step 3.
2) Stopping the mysql
service using systemctl
note: [pattern] must be the name listed by service
or initctl
. the reason I use pattern
is because systemctl
uses regex matching, so be careful if you must use the kill
argument.
sudo systemctl stop [pattern]
where pattern
represents the mysql daemon/service name. if stop does not work try
sudo systemctl kill [pattern]
For example
sudo systemctl stop mysql
3) Uninstalling/purging mysql
if you need to totally purge, make sure the service or process is stopped first and then make sure you're removing the right files and directories!
Note: Make sure you are targeting the correct mysql
version. For example, if you use 5.5, adjust the version number appropriately.
WARNING: the following steps will delete your data! (the first command must be executed to do a backup)
source: How do I uninstall MySQL?
tar -zcvf ~/msql_backup.tar.gz /etc/mysql /var/lib/mysql
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-5.7 mysql-client-core-5.7
sudo rm -rfv /etc/mysql /var/lib/mysql
sudo apt autoremove
sudo apt autoclean
4) Fixing broken packages and handling missing dependencies
If the preceding steps did not work for you, you may need to run apt
with the --fix-broken
option to repair any damage done.
Make sure to apt update
first and then apt install
sudo apt update
sudo apt install mysql-server mysql-client --fix-broken --fix-missing
5) When all else fails, build and install mysql
yourself
If none of the above works, you'll have to manually download the source, compile, and use make or bash to install from there (not as painful as it sounds since its all automated).
Edited Jan 10 2017: This is a major review of this post to correct serious issues in this post.
The Error at Heart
The problem is that the package is still on the system in an half-installed and half-configured state and needs to be explicitly removed.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
What its really saying is that the package mysql-server-5.7
is a dependency for mysql-server
, is already installed, but is not configured. So you need to purge
it to remove those breadcrumbs left behind by mysql-server-5.7
.
sudo apt purge mysql-server mysql-server-5.7
Rationale
When you install software using apt
, it automatically handles dependencies for you as well.
When you remove certain packages, it may not handle those same dependencies. In the case of this post, that dependency is mysql-server-5.7
.
You can check to see a package state by issuing the following command.
dpkg-query -l [package-name-here]
Usually if you see the code un
or rc
to the left of the package name, you'll be able to tell if it actually is a broken package.
When I experienced this issue, it was with libapache2-mod-php
and libapache2-mod-php7.0
. This was my output.
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===========================-==================-==================-============================================================
un libapache2-mod-php <none> <none> (no description available)
In my case, it claimed that the status of my package is unknown and that it is not installed (the code un
) on my system.
When you tell apt
to remove
something, it can leave packages, configuration files, and other items that can be problematic during automated installations.
When you tell apt
to purge
something it does it's best to remove any breadcrumbs that remove
might have left behind.
I originally stated that I assumed the process was still running, but most likely it was Inactive, or dead.
The best way to check if the service is interfering with your package removal is to check that service first.
1) Investigating the mysql
service
Using the system error given to us by apt
, we can actually use systemctl
to investigate the error by checking on the status of the mysql
service
sudo systemctl status [pattern]
In our case, we want to see if mysql is running so can type in
systemctl status mysql.service
You should see this output if the service is running
systemctl status mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2017-01-10 23:10:06 EST; 1h 3min ago
Main PID: 1206 (mysqld)
CGroup: /system.slice/mysql.service
└─1206 /usr/sbin/mysqld
note: If the service is dead, you'll see a short message indicating that there is no service by that name running and then skip to step 3.
2) Stopping the mysql
service using systemctl
note: [pattern] must be the name listed by service
or initctl
. the reason I use pattern
is because systemctl
uses regex matching, so be careful if you must use the kill
argument.
sudo systemctl stop [pattern]
where pattern
represents the mysql daemon/service name. if stop does not work try
sudo systemctl kill [pattern]
For example
sudo systemctl stop mysql
3) Uninstalling/purging mysql
if you need to totally purge, make sure the service or process is stopped first and then make sure you're removing the right files and directories!
Note: Make sure you are targeting the correct mysql
version. For example, if you use 5.5, adjust the version number appropriately.
WARNING: the following steps will delete your data! (the first command must be executed to do a backup)
source: How do I uninstall MySQL?
tar -zcvf ~/msql_backup.tar.gz /etc/mysql /var/lib/mysql
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-5.7 mysql-client-core-5.7
sudo rm -rfv /etc/mysql /var/lib/mysql
sudo apt autoremove
sudo apt autoclean
4) Fixing broken packages and handling missing dependencies
If the preceding steps did not work for you, you may need to run apt
with the --fix-broken
option to repair any damage done.
Make sure to apt update
first and then apt install
sudo apt update
sudo apt install mysql-server mysql-client --fix-broken --fix-missing
5) When all else fails, build and install mysql
yourself
If none of the above works, you'll have to manually download the source, compile, and use make or bash to install from there (not as painful as it sounds since its all automated).
edited Nov 6 '17 at 18:33
David Foerster
28.5k1366112
28.5k1366112
answered Apr 27 '16 at 8:46
user383919
"16.04 is riddled with loads of bugs right now." Works for me, including MySQL. It seems to me that most of the problems we see here arise from people doing something wrong, like trying torm
files belonging to packages.
– fkraiem
Apr 27 '16 at 10:03
1
Excellent Work buddy! thank you. i wasted my whole day by using some stupid instructions. Now this worked!
– Renjith VR
Jun 23 '16 at 15:25
I have followed your instructions and sudo systemctl stop mysql seemed to work. However after reboot it was broken again. start or stop does not work. sudo systemctl status mysql shows: Active: deactivating (stop-sigterm) since Mon 2016-06-27 11:05:22 BST; 8min ago Do I REALLY have to wait 10 minutes for mysql to stop? Aren't you surprised that people purge a service that didn't fully stop? Is it possible that Ubuntu 16.04 will fix it? What are the options, going back to previous LTS version or another distro?
– ruby_object
Jun 27 '16 at 10:22
Thanks removing and reinstalling this way worked perfectly!
– Louwki
Sep 23 '16 at 11:21
5
note:sudo rm -rf /var/lib/mysql
will remove all your databases in default location. DO a back up first!
– augusto
Oct 10 '16 at 10:54
|
show 6 more comments
"16.04 is riddled with loads of bugs right now." Works for me, including MySQL. It seems to me that most of the problems we see here arise from people doing something wrong, like trying torm
files belonging to packages.
– fkraiem
Apr 27 '16 at 10:03
1
Excellent Work buddy! thank you. i wasted my whole day by using some stupid instructions. Now this worked!
– Renjith VR
Jun 23 '16 at 15:25
I have followed your instructions and sudo systemctl stop mysql seemed to work. However after reboot it was broken again. start or stop does not work. sudo systemctl status mysql shows: Active: deactivating (stop-sigterm) since Mon 2016-06-27 11:05:22 BST; 8min ago Do I REALLY have to wait 10 minutes for mysql to stop? Aren't you surprised that people purge a service that didn't fully stop? Is it possible that Ubuntu 16.04 will fix it? What are the options, going back to previous LTS version or another distro?
– ruby_object
Jun 27 '16 at 10:22
Thanks removing and reinstalling this way worked perfectly!
– Louwki
Sep 23 '16 at 11:21
5
note:sudo rm -rf /var/lib/mysql
will remove all your databases in default location. DO a back up first!
– augusto
Oct 10 '16 at 10:54
"16.04 is riddled with loads of bugs right now." Works for me, including MySQL. It seems to me that most of the problems we see here arise from people doing something wrong, like trying to
rm
files belonging to packages.– fkraiem
Apr 27 '16 at 10:03
"16.04 is riddled with loads of bugs right now." Works for me, including MySQL. It seems to me that most of the problems we see here arise from people doing something wrong, like trying to
rm
files belonging to packages.– fkraiem
Apr 27 '16 at 10:03
1
1
Excellent Work buddy! thank you. i wasted my whole day by using some stupid instructions. Now this worked!
– Renjith VR
Jun 23 '16 at 15:25
Excellent Work buddy! thank you. i wasted my whole day by using some stupid instructions. Now this worked!
– Renjith VR
Jun 23 '16 at 15:25
I have followed your instructions and sudo systemctl stop mysql seemed to work. However after reboot it was broken again. start or stop does not work. sudo systemctl status mysql shows: Active: deactivating (stop-sigterm) since Mon 2016-06-27 11:05:22 BST; 8min ago Do I REALLY have to wait 10 minutes for mysql to stop? Aren't you surprised that people purge a service that didn't fully stop? Is it possible that Ubuntu 16.04 will fix it? What are the options, going back to previous LTS version or another distro?
– ruby_object
Jun 27 '16 at 10:22
I have followed your instructions and sudo systemctl stop mysql seemed to work. However after reboot it was broken again. start or stop does not work. sudo systemctl status mysql shows: Active: deactivating (stop-sigterm) since Mon 2016-06-27 11:05:22 BST; 8min ago Do I REALLY have to wait 10 minutes for mysql to stop? Aren't you surprised that people purge a service that didn't fully stop? Is it possible that Ubuntu 16.04 will fix it? What are the options, going back to previous LTS version or another distro?
– ruby_object
Jun 27 '16 at 10:22
Thanks removing and reinstalling this way worked perfectly!
– Louwki
Sep 23 '16 at 11:21
Thanks removing and reinstalling this way worked perfectly!
– Louwki
Sep 23 '16 at 11:21
5
5
note:
sudo rm -rf /var/lib/mysql
will remove all your databases in default location. DO a back up first!– augusto
Oct 10 '16 at 10:54
note:
sudo rm -rf /var/lib/mysql
will remove all your databases in default location. DO a back up first!– augusto
Oct 10 '16 at 10:54
|
show 6 more comments
The problem with the first post is you can't reconfigure a meta-package well not for the sql items. You need to specify the current release item.
Say use;
apt search mysql-server
That should display a list of packages namely
"mysql-server-5.7" "mysql-server-core-5.7" or later releases
then;
dpkg-reconfigure --force mysql-server-5.7 mysql-server-core-5.7
done.
add a comment |
The problem with the first post is you can't reconfigure a meta-package well not for the sql items. You need to specify the current release item.
Say use;
apt search mysql-server
That should display a list of packages namely
"mysql-server-5.7" "mysql-server-core-5.7" or later releases
then;
dpkg-reconfigure --force mysql-server-5.7 mysql-server-core-5.7
done.
add a comment |
The problem with the first post is you can't reconfigure a meta-package well not for the sql items. You need to specify the current release item.
Say use;
apt search mysql-server
That should display a list of packages namely
"mysql-server-5.7" "mysql-server-core-5.7" or later releases
then;
dpkg-reconfigure --force mysql-server-5.7 mysql-server-core-5.7
done.
The problem with the first post is you can't reconfigure a meta-package well not for the sql items. You need to specify the current release item.
Say use;
apt search mysql-server
That should display a list of packages namely
"mysql-server-5.7" "mysql-server-core-5.7" or later releases
then;
dpkg-reconfigure --force mysql-server-5.7 mysql-server-core-5.7
done.
answered Mar 16 '17 at 16:52
e8hffffe8hffff
7111
7111
add a comment |
add a comment |
This is the correct solution for you
First, you will have to remove all packages of mysql-server:
WARNING: the following steps will delete your data! Do a backup first!
sudo rm -rf /var/lib/mysql
Then install:
sudo apt-get install lamp-server^
Or you can do:
sudo apt-get install mysql-server
add a comment |
This is the correct solution for you
First, you will have to remove all packages of mysql-server:
WARNING: the following steps will delete your data! Do a backup first!
sudo rm -rf /var/lib/mysql
Then install:
sudo apt-get install lamp-server^
Or you can do:
sudo apt-get install mysql-server
add a comment |
This is the correct solution for you
First, you will have to remove all packages of mysql-server:
WARNING: the following steps will delete your data! Do a backup first!
sudo rm -rf /var/lib/mysql
Then install:
sudo apt-get install lamp-server^
Or you can do:
sudo apt-get install mysql-server
This is the correct solution for you
First, you will have to remove all packages of mysql-server:
WARNING: the following steps will delete your data! Do a backup first!
sudo rm -rf /var/lib/mysql
Then install:
sudo apt-get install lamp-server^
Or you can do:
sudo apt-get install mysql-server
edited Jan 26 at 13:18
Erfan Jazeb Nikoo
1034
1034
answered Jul 14 '17 at 11:21
RohanRohan
454
454
add a comment |
add a comment |
I saw this
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
as a clue that there was still an erroneous start-up script in existence.
Look for /etc/init.d/mysql
and any symlinks to it. Removing these appeared to fix my reinstall-after-purge problems.
add a comment |
I saw this
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
as a clue that there was still an erroneous start-up script in existence.
Look for /etc/init.d/mysql
and any symlinks to it. Removing these appeared to fix my reinstall-after-purge problems.
add a comment |
I saw this
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
as a clue that there was still an erroneous start-up script in existence.
Look for /etc/init.d/mysql
and any symlinks to it. Removing these appeared to fix my reinstall-after-purge problems.
I saw this
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
as a clue that there was still an erroneous start-up script in existence.
Look for /etc/init.d/mysql
and any symlinks to it. Removing these appeared to fix my reinstall-after-purge problems.
answered Jun 22 '16 at 21:04
ghatzhatghatzhat
11
11
add a comment |
add a comment |
This error also happened when switching from MySQL to MariaDB (https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1490071).
The MySQL binary data files were not compatible with MariaDB so I switched back to MySQL because I did not have time to mess with mysqldump.
First I had to move MariaDB data away from /var/lib/mysql
, then install MySQL and then move my original data from /var/lib/mysql-5.7
(this backup was automatically created before the error) to /var/lib/mysql
.
add a comment |
This error also happened when switching from MySQL to MariaDB (https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1490071).
The MySQL binary data files were not compatible with MariaDB so I switched back to MySQL because I did not have time to mess with mysqldump.
First I had to move MariaDB data away from /var/lib/mysql
, then install MySQL and then move my original data from /var/lib/mysql-5.7
(this backup was automatically created before the error) to /var/lib/mysql
.
add a comment |
This error also happened when switching from MySQL to MariaDB (https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1490071).
The MySQL binary data files were not compatible with MariaDB so I switched back to MySQL because I did not have time to mess with mysqldump.
First I had to move MariaDB data away from /var/lib/mysql
, then install MySQL and then move my original data from /var/lib/mysql-5.7
(this backup was automatically created before the error) to /var/lib/mysql
.
This error also happened when switching from MySQL to MariaDB (https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1490071).
The MySQL binary data files were not compatible with MariaDB so I switched back to MySQL because I did not have time to mess with mysqldump.
First I had to move MariaDB data away from /var/lib/mysql
, then install MySQL and then move my original data from /var/lib/mysql-5.7
(this backup was automatically created before the error) to /var/lib/mysql
.
edited Nov 6 '17 at 18:04
answered Nov 6 '17 at 16:52
baptxbaptx
1057
1057
add a comment |
add a comment |
Try apt-get -f install
to fix your broken SQL package and if you are still in problem with package manager download SQL server source code and compile it !!
But try above command and also use dpkg -l | grep sql
to find out package manager still think you SQL or not ..
Did not work. I've also included the error I get when trying to install the package.
– Harry
Apr 27 '16 at 5:03
@Harry You should runapt-get -f install
by itself, without specifying a package name.
– fkraiem
Apr 27 '16 at 5:08
As fkraim said use it with out package name ...
– Ali Ghasempour
Apr 27 '16 at 5:18
Appended the output ofapt-get install -f
, no change.
– Harry
Apr 27 '16 at 5:21
Try synaptic application and check it says there is broken package or not ( on left column )[ if you have desktop ]
– Ali Ghasempour
Apr 27 '16 at 5:26
|
show 1 more comment
Try apt-get -f install
to fix your broken SQL package and if you are still in problem with package manager download SQL server source code and compile it !!
But try above command and also use dpkg -l | grep sql
to find out package manager still think you SQL or not ..
Did not work. I've also included the error I get when trying to install the package.
– Harry
Apr 27 '16 at 5:03
@Harry You should runapt-get -f install
by itself, without specifying a package name.
– fkraiem
Apr 27 '16 at 5:08
As fkraim said use it with out package name ...
– Ali Ghasempour
Apr 27 '16 at 5:18
Appended the output ofapt-get install -f
, no change.
– Harry
Apr 27 '16 at 5:21
Try synaptic application and check it says there is broken package or not ( on left column )[ if you have desktop ]
– Ali Ghasempour
Apr 27 '16 at 5:26
|
show 1 more comment
Try apt-get -f install
to fix your broken SQL package and if you are still in problem with package manager download SQL server source code and compile it !!
But try above command and also use dpkg -l | grep sql
to find out package manager still think you SQL or not ..
Try apt-get -f install
to fix your broken SQL package and if you are still in problem with package manager download SQL server source code and compile it !!
But try above command and also use dpkg -l | grep sql
to find out package manager still think you SQL or not ..
answered Apr 27 '16 at 4:35
Ali GhasempourAli Ghasempour
35127
35127
Did not work. I've also included the error I get when trying to install the package.
– Harry
Apr 27 '16 at 5:03
@Harry You should runapt-get -f install
by itself, without specifying a package name.
– fkraiem
Apr 27 '16 at 5:08
As fkraim said use it with out package name ...
– Ali Ghasempour
Apr 27 '16 at 5:18
Appended the output ofapt-get install -f
, no change.
– Harry
Apr 27 '16 at 5:21
Try synaptic application and check it says there is broken package or not ( on left column )[ if you have desktop ]
– Ali Ghasempour
Apr 27 '16 at 5:26
|
show 1 more comment
Did not work. I've also included the error I get when trying to install the package.
– Harry
Apr 27 '16 at 5:03
@Harry You should runapt-get -f install
by itself, without specifying a package name.
– fkraiem
Apr 27 '16 at 5:08
As fkraim said use it with out package name ...
– Ali Ghasempour
Apr 27 '16 at 5:18
Appended the output ofapt-get install -f
, no change.
– Harry
Apr 27 '16 at 5:21
Try synaptic application and check it says there is broken package or not ( on left column )[ if you have desktop ]
– Ali Ghasempour
Apr 27 '16 at 5:26
Did not work. I've also included the error I get when trying to install the package.
– Harry
Apr 27 '16 at 5:03
Did not work. I've also included the error I get when trying to install the package.
– Harry
Apr 27 '16 at 5:03
@Harry You should run
apt-get -f install
by itself, without specifying a package name.– fkraiem
Apr 27 '16 at 5:08
@Harry You should run
apt-get -f install
by itself, without specifying a package name.– fkraiem
Apr 27 '16 at 5:08
As fkraim said use it with out package name ...
– Ali Ghasempour
Apr 27 '16 at 5:18
As fkraim said use it with out package name ...
– Ali Ghasempour
Apr 27 '16 at 5:18
Appended the output of
apt-get install -f
, no change.– Harry
Apr 27 '16 at 5:21
Appended the output of
apt-get install -f
, no change.– Harry
Apr 27 '16 at 5:21
Try synaptic application and check it says there is broken package or not ( on left column )[ if you have desktop ]
– Ali Ghasempour
Apr 27 '16 at 5:26
Try synaptic application and check it says there is broken package or not ( on left column )[ if you have desktop ]
– Ali Ghasempour
Apr 27 '16 at 5:26
|
show 1 more comment
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f763534%2fcannot-reinstall-mysql-server-after-its-purge%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It looks like
mysql-server-5.7
is in a bad state, try to reinstall it:sudo apt-get install --reinstall mysql-server-5.7
.– fkraiem
Apr 27 '16 at 5:30
Makes no difference, I get the same error line:
... invoke-rc.d: initscript mysql, action "start" failed. ...
that I'm getting with other flavors of install commands.– Harry
Apr 27 '16 at 5:48
Try to remove it, then...
sudo apt-get remove --purge mysql-server-5.7
. Note that this is reallymysql-server-5.7
we are talking about, notmysql-server
.– fkraiem
Apr 27 '16 at 5:49
@Harry Many times, I restart the system to get rid of this type of error.
– d a i s y
Apr 27 '16 at 6:22
My problem solved by following this post
– Raizal I.N. Pregnanta
Apr 7 '17 at 15:16