1

I just wanted to re-install the MySQL from my Ubuntu. So I have purge the MySQL but when I am trying to install it, it shows dependencies unmet error.

sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server is already the newest version (5.7.22-0ubuntu0.17.10.1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.7 but it is not going to be installed
 mysql-testsuite-5.7 : Depends: mysql-server-5.7 (= 5.7.22-0ubuntu0.17.10.1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

When I try to update it shows:

sudo apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu artful InRelease
Hit:2 http://de.archive.ubuntu.com/ubuntu artful InRelease
Hit:3 http://security.ubuntu.com/ubuntu artful-security InRelease
Err:4 http://ppa.launchpad.net/canonical-kernel-team/pti/ubuntu artful InRelease
403  Forbidden
Ign:5 http://archive.ubuntu.com/ubuntu trusty InRelease
Hit:6 http://de.archive.ubuntu.com/ubuntu artful-updates InRelease
Hit:7 http://archive.ubuntu.com/ubuntu trusty Release
Hit:8 http://de.archive.ubuntu.com/ubuntu artful-backports InRelease
Hit:9 http://ppa.launchpad.net/mutlaqja/ppa/ubuntu artful InRelease
Reading package lists... Done
E: Failed to fetch http://ppa.launchpad.net/canonical-kernel-team/pti/ubuntu/dists/artful/InRelease  403  Forbidden
E: Some index files failed to download. They have been ignored, or old ones used instead.

When I try to fix the dependency problem, nothing happens:

sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  mysql-server-5.7
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  mysql-server-5.7
0 upgraded, 1 newly installed, 0 to remove and 105 not upgraded.
3 not fully installed or removed.
Need to get 3,189 kB of archives.
After this operation, 48.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://de.archive.ubuntu.com/ubuntu artful-updates/main amd64 mysql-server-5.7 amd64 5.7.22-0ubuntu0.17.10.1 [3,189 kB]
Fetched 3,189 kB in 0s (14.9 MB/s)
Preconfiguring packages ...
(Reading database ... 158292 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.22-0ubuntu0.17.10.1_amd64.deb ...
grep: /etc/mysql/: No such file or directory
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
invoke-rc.d returned 5
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.7_5.7.22-0ubuntu0.17.10.1_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.7_5.7.22-0ubuntu0.17.10.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

None of the fix worked for me.

Thanks in advance.

singrium
  • 6,880
  • Did you run sudo apt --fix-broken install ? – singrium May 19 '18 at 23:19
  • I am getting this error- ubuntu0.17.10.1_amd64.deb (--unpack): subprocess new pre-installation script returned error exit status 1 Errors were encountered while processing: /var/cache/apt/archives/mysql-server-5.7_5.7.22-0ubuntu0.17.10.1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) – Verneet Singh May 19 '18 at 23:26
  • According to what you posted, it says "There is a MySQL server running, but we failed in our attempts to stop it.", so try to stop MySQL by running sudo service mysql stop then run sudo apt --fix-broken install. – singrium May 19 '18 at 23:34
  • Thanks for help. Here is the result of it Failed to stop mysql.service: Unit mysql.service not loaded. – Verneet Singh May 19 '18 at 23:36
  • sudo service mysql start Failed to start mysql.service: Unit mysql.service not found. SAME error :/ – Verneet Singh May 19 '18 at 23:37
  • I think the best way is to uninstall it then install it again. To do that : sudo apt-get remove --purge *mysql\* then sudo apt-get autoremove then sudo apt-get autoclean To install it again : sudo apt-get install mysql-server. – singrium May 19 '18 at 23:40
  • Still same error when i run the purge command. run 'apt --fix-broken install' to correct these. unmet dependencies:libgdal20 : Depends: libmysqlclient20 (>= 5.7.11) but it is not going to be installed postfixadmin : Depends: php-mysql but it is not going to be installed or php-mysqlnd orphp-pgsql orphp-sqlite3 E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). – Verneet Singh May 19 '18 at 23:47
  • if apt --fix-broken install didn't work, so try to install them one by one : sudo apt-get install libmysqlclient20 sudo apt-get install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php and sudo apt-get install libgdal20. – singrium May 19 '18 at 23:55
  • Same shitty error! unmet dependencies: mysql-server : Depends: mysql-server-5.7 but it is not going to be installed mysql-testsuite-5.7 : Depends: mysql-server-5.7 (= 5.7.22-0ubuntu0.17.10.1) but it is not going to be installed – Verneet Singh May 20 '18 at 00:19
  • Take a look at this: https://askubuntu.com/questions/809202/error-in-installing-mysql-server-in-ubuntu-16-04?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa], it looks the same as your problem. – singrium May 20 '18 at 00:28
  • it did't work!. :/ i have created a mysql.txt file. still same unmet dependency error. It has to do something with update error i am getting from ppa.launchpad.net? – Verneet Singh May 20 '18 at 10:11

0 Answers0