[SOLVED] Nexcloud internal server error & mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql.sock'


Since some time I can’t open my nextcloud server in the browser anymore. The server was running on my Omnia since years and I found out that Kodi, which different installations on some computers use mysql databases and files at the Omnia, stopped working as well. All those installations have their data on a harddrive which is permanently mounted to /srv.

I found out when I checked why I couldn’t change some files names on NFS shares from /srv automounted on my KDE notebook, something I use since years, too. The owners/groups of some folders and files have been root:root, which doesn’t give permissions to my normal user on my notebook. I changed all permissions in /srv with
chown -r marwell:www-data /srv
Renaming files works now.

I thought my nextcloud problem would be something similar and checked the permissions. I hadn’t realized the the nextcloud folder is inside /srv/www. I had changed all owners:groups to marwell:www-data. That is wrong for sure … However, the problem with nextcloud was there before I changed the permissions.

Searching which owner:group nextcloud data files on Turris Omnia should have I didn’t find clear information.

Later I found out that mysql doesn’t start. If I try to enter mysql I get an error:

root@turris:/# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysql.sock’ (2)`

Trying to restart the service shows mistakes, too.

root@turris:/# mysqld restart
[Warning] option ‘table_open_cache’: unsigned value 4 adjusted to 10
[Note] mysqld (mysqld 10.2.18-MariaDB) starting as process 27161 …
mysqld: Please consult the Knowledge Base to find out how to run mysqld as root!
[ERROR] Aborting

Actually changing all the owners/groups was a mistake anyway, because my Kodi files and databases are inside this folder, too. They shouldn’t have been changed.

But at the moment the problem with mariadb is more important I think. I’ve found some information that the sock-file is made on runtime by mariadb, but why it’s not there and I get the mentioned error message I don’t understand.

/var/run is root:root 0777. This place is configured in the mariadb configuration, too. (Actually it’s linked to /tmp/run)

To be honest, my knowledge is restricted, about the structure of Turris Os (here 3.11.16), databases, their permission handling, what mariadb needs to run and more. As well Nextcloud is not easy to understand for me, even if I use it since many years and as if I am using linux since 2007. So any help explaining the basic structure of the problem is very welcome!

Thank You in advance!

There is also /srv/mysql that has to has correct owner - mysql:mysql. I think we might be running webserver as nobody - try that one for the Nextcloud directory.

Hi Miska,

Thank you so much! It’s solved! The right chown:

root@turris:~# chown -R mysql:mysql /srv/mysql

and Mysql is running!

root@turris:~# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.2.18-MariaDB Source distribution

Great! Changing the owner of /srv/www/nextcloud:

root@turris:~# chown -R nobody:nobody /srv/www/nextcloud
chown: unknown user/group nobody:nobody

Ups, didn’t work. There is only a user nobody but no group nobody.

cat /etc/group | grep no

This group is called nogroup! So it must be:

root@turris:~# chown -R nobody:nogroup /srv/www/nextcloud

And nextcloud works again! Thank you, Miska! Perfect help!

P.S.: By the way, I’ve only yesterday found out the I have a working schnapps running on my Omnia! See the docs!. It can be used to make a snapshot of installed hard drives, too! I don’t remember where I’ve heard about the first Indiegogo campaign, but that I’ve the same day ordered one. Still finding great ideas inside it. Thank you for this great peace of hardware and your ongoing support!

1 Like

A post was split to a new topic: Can not install Nextcloud via CLI