0

I decided to sign up to askubuntu.com, because i really need an advice from experts: I made, with mkusb, a persistent USB Live installation of Ubuntu 16.10, since I'd like to have a portable development environment. Everything went good, and I'm writing from that Live right now.

Now the question: I managed to install apache2, but after hours and hours of searching in the web, and also on this site, I cannot still properly install MySQL server. After re-executing many time the installation, I continue to get this error:

 Setting up mysql-server-5.7 (5.7.17-0ubuntu0.16.10.1) ...
ERROR: Unable to start MySQL server:
mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Once the problem is resolved, run apt-get --fix-broken install to retry.
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 127
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)

And if I run

sudo mysqld --initialize

The terminal still reports

mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

So i thought to search for this "libaio.so.1" as well, and I finished up installing the libraries "libaio1" and "libaio-dev" (which seems to be the same). The result, however didn't change even if those libraries are correctly installed.

Is this caused from the fact that I'm in a LiveUSB? Or is there another procedure to install/make MySQL recognize (since it's already installed, and I verified that the file exists) libaio.so.1?

I really hope you can help me, because i tried everything. I apologize in advance for any possible mistake made in this question. Thank you.

Oh, and there is an unanswered duplicate on the Ubuntu community made by me, so feel free to remove this question if it stays unanswered. Thank you in advance again.

Community
  • 1
  • 1

3 Answers3

3

After more many hours of research, i found that the problem wasn't the LiveUSB or the library itself. The problem was AppArmor, who blocked MySQL to use that library. So I disabled it:

sudo /etc/init.d/apparmor stop
sudo /etc/init.d/apparmor teardown
sudo update-rc.d -f apparmor remove

And a not-so-orthodox way, I completely removed AppArmor, to prevent future problems with:

sudo apt-get purge apparmor

Then I uninstalled and reinstalled MySQL Server flawlessy. It works!

  • When I ran first three commands but did not uninstall apparmor, still it went all good. Then I restarted my system, then the problem persisted. I have to run all the three commands everythime i reboot my system. And somewhere else, I read that uninstalling apparmor is not recommended. What can I do in this case? – Kalpashree V. Bal Mar 09 '20 at 10:24
3

If you got here while installing MariaDB, you can install the libaio1 using below command. The above solutions did not work for me

sudo apt-get install libaio1

Reference is here

Rodgers Andati
  • 121
  • 1
  • 11
0

maybe you should uninstall mysql and install it again using these command

remove mysql -

sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean

reinstall

sudo apt-get update
sudo apt-get install mysql-server
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
mohammed
  • 26
  • 1
  • 9
  • First of all, thank you. I'm sorry, but this didn't solve the problem. I got _"Job for mysql.service failed because the control process exited with error code. See systemctk status mysql.service and journalctl -xe for details"_. And when i ran _"sudo mysqld -- initialize"_ (since _mysql_install_db is deprecated_) i got again the same error with the missing/not recognized libaio.so.1. The secure installation process started, but after inserting password, it says _"Can't connect to local MySQL server through socket /var/run/mysqld.sock (2)"_, probably because the server isn't active. – Giulio Ganzerli Feb 24 '17 at 13:10
  • sorry to hear that but it did work for me i recommend you to check http://stackoverflow.com/questions/11657829/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run – mohammed Feb 24 '17 at 13:34
  • Thanks again. I tried the solutions, and none of them really worked. I ended up purging and reinstalling mysql several times, but it cannot still complete the installation correctly, and so the solutions related to mySQL often aren't usable. I'm still trying to understand why, during installation, MySQL does not find libaio.so.1, since, if i send _locate libaio.so.1_ it returns some files with that name. I hope we will find the problem... P.S.: I can install MySQL client correctly – Giulio Ganzerli Feb 24 '17 at 14:33