6

I am trying to reinstall mysql-server on my wsl Ubuntu 18.04.

(I have MySQL server on Windows 10, but on port 3307. Idk if this matters but just in case!)

I couldn't sudo service mysql start nor sudo /etc/init.d/mysql start and it returned

No directory, logging in with HOME=/
mkdir: cannot create directory ‘//.cache’: Permission denied
-su: 19: /etc/profile.d/wsl-integration.sh: cannot create //.cache/wslu/integration: Directory nonexistent [Failed]

I googled about reinstalling mysql in Ubuntu and followed the following procedure.
- https://github.com/microsoft/WSL/issues/1761

sudo su
apt-get remove --purge 'mysql*'
apt-get autoremove
apt-get autoclean
rm -f /etc/mysql /var/lib/mysql
apt-get install mysql-server

But while trying apt-get install mysql-server I got the error below.

invoke-rc.d: could not determine current runlevel
 * Stopping MySQL database server mysqld                                                                         [ OK ]
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Cannot open /proc/net/unix: No such file or directory
Cannot stat file /proc/1/fd/5: Operation not permitted
Cannot stat file /proc/1/fd/10: Operation not permitted
Cannot stat file /proc/1/fd/6: Operation not permitted
Cannot stat file /proc/5/fd/7: Operation not permitted
Cannot stat file /proc/5/fd/10: Operation not permitted
Cannot stat file /proc/5/fd/5: Operation not permitted
Cannot stat file /proc/843/fd/7: Operation not permitted
Cannot stat file /proc/843/fd/10: Operation not permitted
Cannot stat file /proc/843/fd/5: Operation not permitted
dpkg: error processing package mysql-server-5.7 (--configure):
 installed mysql-server-5.7 package post-installation script subprocess 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.

I've been googling Cannot open /proc/net/unix: No such file or directory and invoke-rc.d: could not determine current runlevel problems but could not find the right solution for this issue.

I really appreciate if you could give me some advice on this. Thanks!

2 Answers 2

3

When I looked into the log file /var/log/mysql/error.log I found

[ERROR] [MY-012585] [InnoDB] Linux Native AIO interface is not supported on this platform. Please check your OS documentation and install appropriate binary of InnoDB.

I disabled the use of Native AIO by creating a new config file /etc/mysql/conf.d/no_native_aio.conf:

[mysqld]
innodb_use_native_aio = 0 

Then I was able to start the databse server like so:

sudo service mysql start

I also had to run

 sudo mysql_secure_installation

to set the password for the root user.

and I had to trick dpkg into believing that postinstall script had run successfully by:

  • adding exit 0 as the second line in /var/lib/dpkg/info/mysql-server-8.0.postinst
  • running sudo dpkg --configure -a
  • removing the exit 0 from /var/lib/dpkg/info/mysql-server-8.0.postinst
Sign up to request clarification or add additional context in comments.

Comments

1

This will be a WSL1 vs WSL2 issue. The /proc directory isn't fully populated with WSL1. To check your version run (from powershell) wsl -l -v. If it doesn't give you any version info, then you're on WSL1.

1 Comment

I'm using WSL1 as you mentioned! Should I upgrade it to WSL2 then? Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.