Internal Server Error on NextCloud after updating DietPi Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
mk33
Posts: 21
Joined: Thu Jun 11, 2020 10:13 pm

Re: Internal Server Error on NextCloud after updating DietPi

Post by mk33 »

And lastly (sorry for the extensive output, i had to delete some lines in the middle, they where the same error but for other directories):

Code: Select all

sudo cat /var/log/mysql/error.log
2020-07-14 13:33:14 0 [Note] InnoDB: Using Linux native AIO
2020-07-14 13:33:14 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-07-14 13:33:14 0 [Note] InnoDB: Uses event mutexes
2020-07-14 13:33:14 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-07-14 13:33:14 0 [Note] InnoDB: Number of pools: 1
2020-07-14 13:33:14 0 [Note] InnoDB: Using generic crc32 instructions
2020-07-14 13:33:14 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-07-14 13:33:14 0 [Note] InnoDB: Completed initialization of buffer pool
2020-07-14 13:33:14 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-07-14 13:33:14 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 0 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/gtid_slave_pos.ibd' OS error: 81
2020-07-14 13:33:14 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.

..... (more lines with the same access rights errors for other directories)

2020-07-14 13:33:14 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 0 [ERROR] InnoDB: Cannot open datafile for read-only: './nextcloud/oc_webauthn.ibd' OS error: 81
2020-07-14 13:33:14 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``nextcloud`.`oc_webauthn``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-07-14 13:33:14 0 [Warning] InnoDB: Ignoring tablespace for `nextcloud`.`oc_webauthn` because it could not be opened.
2020-07-14 13:33:14 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 0 [ERROR] InnoDB: Cannot open datafile for read-only: './nextcloud/oc_whats_new.ibd' OS error: 81
2020-07-14 13:33:14 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``nextcloud`.`oc_whats_new``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-07-14 13:33:14 0 [Warning] InnoDB: Ignoring tablespace for `nextcloud`.`oc_whats_new` because it could not be opened.
2020-07-14 13:33:14 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-07-14 13:33:14 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-07-14 13:33:14 0 [Note] InnoDB: 10.3.22 started; log sequence number 46552637; transaction id 115418
2020-07-14 13:33:14 0 [Note] InnoDB: Loading buffer pool(s) from /mnt/dietpi_userdata/mysql/ib_buffer_pool
2020-07-14 13:33:14 2 [ERROR] InnoDB: Failed to find tablespace for table `mysql`.`innodb_index_stats` in the cache. Attempting to load the tablespace with space id 2
2020-07-14 13:33:14 2 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 2 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 2 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/innodb_index_stats.ibd' OS error: 81
2020-07-14 13:33:14 2 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 2 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 2 [ERROR] InnoDB: Could not find a valid tablespace file for ``mysql`.`innodb_index_stats``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-07-14 13:33:14 4 [ERROR] InnoDB: Failed to find tablespace for table `nextcloud`.`oc_authtoken` in the cache. Attempting to load the tablespace with space id 57
2020-07-14 13:33:14 4 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 4 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 4 [ERROR] InnoDB: Cannot open datafile for read-only: './nextcloud/oc_authtoken.ibd' OS error: 81
2020-07-14 13:33:14 4 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 4 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-07-14 13:33:14 4 [ERROR] InnoDB: Could not find a valid tablespace file for ``nextcloud`.`oc_authtoken``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-07-14 13:33:14 2 [ERROR] InnoDB: Failed to find tablespace for table `mysql`.`innodb_table_stats` in the cache. Attempting to load the tablespace with space id 1
2020-07-14 13:33:14 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2020-07-14 13:33:14 2 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 2 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 2 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/innodb_table_stats.ibd' OS error: 81
2020-07-14 13:33:14 2 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 2 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 0 [Note] Recovering after a crash using tc.log
2020-07-14 13:33:14 2 [ERROR] InnoDB: Could not find a valid tablespace file for ``mysql`.`innodb_table_stats``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-07-14 13:33:14 0 [ERROR] Bad magic header in tc log
2020-07-14 13:33:14 0 [ERROR] Crash recovery failed. Either correct the problem (if it's, for example, out of memory error) and restart, or delete tc log and start mysqld with --tc-heuristic-recover={commit|rollback}
2020-07-14 13:33:14 0 [ERROR] Can't init tc log
2020-07-14 13:33:14 0 [ERROR] Aborting

2020-07-14 13:33:14 2 [ERROR] InnoDB: Failed to find tablespace for table `nextcloud`.`oc_appconfig` in the cache. Attempting to load the tablespace with space id 8
2020-07-14 13:33:14 2 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 2 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 2 [ERROR] InnoDB: Cannot open datafile for read-only: './nextcloud/oc_appconfig.ibd' OS error: 81
2020-07-14 13:33:14 2 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 2 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 2 [ERROR] InnoDB: Could not find a valid tablespace file for ``nextcloud`.`oc_appconfig``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-07-14 13:33:14 2 [ERROR] InnoDB: Failed to find tablespace for table `nextcloud`.`oc_jobs` in the cache. Attempting to load the tablespace with space id 40
2020-07-14 13:33:14 2 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 2 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 2 [ERROR] InnoDB: Cannot open datafile for read-only: './nextcloud/oc_jobs.ibd' OS error: 81
2020-07-14 13:33:14 2 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:14 2 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-07-14 13:33:14 2 [ERROR] InnoDB: Could not find a valid tablespace file for ``nextcloud`.`oc_jobs``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-07-14 13:33:14 0 [ERROR] InnoDB: Cannot open '/mnt/dietpi_userdata/mysql/ib_buffer_pool.incomplete' for writing: Permission denied
2020-07-14 13:33:17 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-07-14 13:33:17 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
User avatar
Joulinar
Posts: 2072
Joined: Sat Nov 16, 2019 12:49 am

Re: Internal Server Error on NextCloud after updating DietPi

Post by Joulinar »

I would recommend to use user root for the time being. This way you don't need to change user access for files and folder to be able to read them.

for lighttpd you would need to revert your changes back

Code: Select all

chown -R www-data:www-data /var/log/lighttpd
for database, pls post

Code: Select all

ls -la /mnt/dietpi_userdata/
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
mk33
Posts: 21
Joined: Thu Jun 11, 2020 10:13 pm

Re: Internal Server Error on NextCloud after updating DietPi

Post by mk33 »

Code: Select all

ls -la /mnt/dietpi_userdata/
total 32
drwxrwxr-x 8 dt dietpi   4096 Jun  7 21:50 .
drwxr-xr-x 7 dt root     4096 Jun 10 21:45 ..
drwxrwxr-x 2 dt dietpi   4096 Jun  7 20:32 downloads
drwxrwxr-x 2 dt dietpi   4096 Jun  7 20:32 Music
drwxr-xr-x 5 dt mysql    4096 Jun 11 08:34 mysql
drwxrwx--- 6 dt www-data 4096 Jun 11 23:29 nextcloud_data
drwxrwxr-x 2 dt dietpi   4096 Jun  7 20:32 Pictures
drwxrwxr-x 2 dt dietpi   4096 Jun  7 20:32 Video
User avatar
Joulinar
Posts: 2072
Joined: Sat Nov 16, 2019 12:49 am

Re: Internal Server Error on NextCloud after updating DietPi

Post by Joulinar »

it was on purpose to change user for all directories to td? Now, database user mysql doesn't have write access to database files anymore. Therefore your database is failing to start

drwxr-xr-x 5 dt mysql 4096 Jun 11 08:34 mysql

It seems you changed it for entire /mnt directory path
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
mk33
Posts: 21
Joined: Thu Jun 11, 2020 10:13 pm

Re: Internal Server Error on NextCloud after updating DietPi

Post by mk33 »

Maybe I ran that by mistake, i don't remember. How can I revert it back?

Note:

Code: Select all

ls -la /mnt/
total 28
drwxr-xr-x  7 dt   root   4096 Jun 10 21:45 .
drwxr-xr-x 21 root root   4096 Jul 13 22:01 ..
drwxr-xr-x  3 dt   root   4096 Jun 10 21:47 dietpi-backup
drwxrwxr-x  8 dt   dietpi 4096 Jun  7 21:50 dietpi_userdata
drwxr-xr-x  2 dt   root   4096 Jan  7  2020 ftp_client
drwxr-xr-x  2 dt   root   4096 Jan  7  2020 nfs_client
drwxr-xr-x  2 dt   root   4096 Jan  7  2020 samba
mk33
Posts: 21
Joined: Thu Jun 11, 2020 10:13 pm

Re: Internal Server Error on NextCloud after updating DietPi

Post by mk33 »

Should i run:
sudo chown -R mysql /mnt/dietpi_userdata/mysql
?
User avatar
Joulinar
Posts: 2072
Joined: Sat Nov 16, 2019 12:49 am

Re: Internal Server Error on NextCloud after updating DietPi

Post by Joulinar »

I would go to correct whole /mnt directory structure to avoid other issues.

pls do as user root

Code: Select all

chown root:root /mnt/ /mnt/samba
chown dietpi:dietpi /mnt/dietpi_userdata /mnt/ftp_client/ /mnt/nfs_client/
chown dietpi:dietpi /mnt/dietpi_userdata/Music /mnt/dietpi_userdata/Pictures /mnt/dietpi_userdata/Video /mnt/dietpi_userdata/downloads
This will change main folder only, as I'm not sure what kind of data you have inside.
For the following 2 folder, we will do a recursive adjustment to have them changed completely.

Code: Select all

chown -R mysql:mysql /mnt/dietpi_userdata/mysql
chown -R www-data:www-data /mnt/dietpi_userdata/nextcloud_data
A problem could be dietpi-backup folder, as you changed all files and permissions inside your backup as well. If you go to restore your system now, you will overwrite all your files with incorrect user settings. I would recommend to create a complete new backup and delete the current one, if all working fine.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
mk33
Posts: 21
Joined: Thu Jun 11, 2020 10:13 pm

Re: Internal Server Error on NextCloud after updating DietPi

Post by mk33 »

I ran those commands and restated RPI.

MariaDB server is still down but this time it doesn't show the "can't create test file" error.

Code: Select all

$ sudo dietpi-services status
 DietPi-Services
─────────────────────────────────────────────────────
 Mode: status 

[  OK  ] DietPi-Services | redis-server         active (running) since Tue 2020-07-14 21:11:50 BST; 6min ago
[FAILED] DietPi-Services | ● mariadb.service - MariaDB 10.3.22 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-07-14 21:11:54 BST; 6min ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 606 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
  Process: 607 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 613 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 670 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
 Main PID: 670 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"

Jul 14 21:11:50 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jul 14 21:11:51 DietPi mysqld[670]: 2020-07-14 21:11:51 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 670 ...
Jul 14 21:11:54 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 14 21:11:54 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jul 14 21:11:54 DietPi systemd[1]: Failed to start MariaDB 10.3.22 database server.
[  OK  ] DietPi-Services | php7.3-fpm           active (running) since Tue 2020-07-14 21:11:55 BST; 6min ago
[  OK  ] DietPi-Services | lighttpd             active (running) since Tue 2020-07-14 21:11:55 BST; 6min ago
[  OK  ] DietPi-Services | cron                 active (running) since Tue 2020-07-14 21:11:55 BST; 6min ago
[  OK  ] DietPi-Services | dropbear             active (running) since Tue 2020-07-14 21:11:49 BST; 6min ago
[  OK  ] DietPi-Services | dietpi-ramlog        active (exited) since Tue 2020-07-14 21:11:04 BST; 7min ago
[  OK  ] DietPi-Services | dietpi-preboot       active (exited) since Tue 2020-07-14 21:11:04 BST; 7min ago
[  OK  ] DietPi-Services | dietpi-boot          active (exited) since Tue 2020-07-14 21:11:49 BST; 6min ago
[  OK  ] DietPi-Services | dietpi-postboot      active (exited) since Tue 2020-07-14 21:11:49 BST; 6min ago
[ INFO ] DietPi-Services | dietpi-wifi-monitor  inactive (dead)


User avatar
Joulinar
Posts: 2072
Joined: Sat Nov 16, 2019 12:49 am

Re: Internal Server Error on NextCloud after updating DietPi

Post by Joulinar »

Pls this one again

Code: Select all

journalctl -u mariadb
cat /var/log/mysql/error.log
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
mk33
Posts: 21
Joined: Thu Jun 11, 2020 10:13 pm

Re: Internal Server Error on NextCloud after updating DietPi

Post by mk33 »

And for the backup folder, what i need to do is:

Code: Select all

rm - rf /mnt/dietpi-backup/*
And then i just run dietpi-backup right?
Post Reply