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

Internal Server Error on NextCloud after updating DietPi

Post by mk33 »

After updating my DietPi to the last version, i tried to access NC but im getting this error:

Code: Select all

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 can't find were is the log file to check more details about this error.

Note: I did a backup before update the DietPi.
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: Internal Server Error on NextCloud after updating DietPi

Post by Joulinar »

Hi,

I guess this is the error message on your web browser. If you are running lighttpd, logs can be found at /var/log/lighttpd

pls can you check if all services are running correctly (like database)

Code: Select all

dietpi-services status
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 »

Hi Joulinar,

Yes that error appears in the browser, sorry for not being clear.

The output of DietPi-Services:

Code: Select all

 DietPi-Services
─────────────────────────────────────────────────────
 Mode: status 

[  OK  ] DietPi-Services | redis-server         active (running) since Tue 2020-07-14 09:09:14 BST; 1min 51s 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 09:09:19 BST; 1min 47s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 648 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
  Process: 653 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 655 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: 712 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
 Main PID: 712 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"

Jul 14 09:09:14 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jul 14 09:09:15 DietPi mysqld[712]: 2020-07-14  9:09:15 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 712 ...
Jul 14 09:09:15 DietPi mysqld[712]: 2020-07-14  9:09:15 0 [Warning] Can't create test file /var/lib/mysql/DietPi.lower-test
Jul 14 09:09:19 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 14 09:09:19 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jul 14 09:09:19 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 09:09:19 BST; 1min 47s ago
[  OK  ] DietPi-Services | lighttpd             active (running) since Tue 2020-07-14 09:09:19 BST; 1min 47s ago
[  OK  ] DietPi-Services | cron                 active (running) since Tue 2020-07-14 09:09:19 BST; 1min 47s ago
[  OK  ] DietPi-Services | dropbear             active (running) since Tue 2020-07-14 09:09:14 BST; 1min 52s ago
[  OK  ] DietPi-Services | dietpi-ramlog        active (exited) since Tue 2020-07-14 00:03:33 BST; 9h ago
[  OK  ] DietPi-Services | dietpi-preboot       active (exited) since Tue 2020-07-14 00:03:33 BST; 9h ago
[  OK  ] DietPi-Services | dietpi-boot          active (exited) since Tue 2020-07-14 09:09:14 BST; 1min 52s ago
[  OK  ] DietPi-Services | dietpi-postboot      active (exited) since Tue 2020-07-14 09:09:14 BST; 1min 52s ago
[ INFO ] DietPi-Services | dietpi-wifi-monitor  inactive (dead)

It looks like the problem is in the DB...

The output of nano /var/log/lighttpd/error.log :

Code: Select all

2020-07-14 09:09:19: (server.c.1464) server started (lighttpd/1.4.53)
2020-07-14 09:10:01: (mod_fastcgi.c.421) FastCGI-stderr: PHP message: {"reqId":"i0fjRZs33m286ea6dqR9","level":3,"time":"2020-07-1$
Do you have any idea of how can i solve this?

Thank you.
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: Internal Server Error on NextCloud after updating DietPi

Post by Joulinar »

ok let's check what is wrong with your database. Do you moved something to an external HDD or is everything located on your SD card?

There is an error massage pointing to some issues on creating a test file

Code: Select all

Can't create test file /var/lib/mysql/DietPi.lower-test
pls can you do following. This will give some more inside into you system.

Code: Select all

systemctl restart mariadb.service
journalctl -u mariadb
cat /var/log/mysql/error.log
readlink /var/lib/mysql
readlink -f /var/lib/mysql
sudo -u mysql -g mysql touch /var/lib/mysql/demo.file
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've turned my RPI on and I was about to test you commands in your last answer, but before I start trying those commands, I tried one more time to access my nextcloud in the Browser.
Unexpectedly, i got this message: Unable to connect. Browser can’t establish a connection to the server at "my-ip-here".

I ran DietPi-Services, and now i got this:

Code: Select all

DietPi-Services
─────────────────────────────────────────────────────
 Mode: status 

[  OK  ] DietPi-Services | redis-server         active (running) since Tue 2020-07-14 12:41:39 BST; 5min 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 12:41:43 BST; 5min ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 654 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
  Process: 655 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 657 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: 714 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
 Main PID: 714 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"

Jul 14 12:41:39 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jul 14 12:41:40 DietPi mysqld[714]: 2020-07-14 12:41:40 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 714 ...
Jul 14 12:41:40 DietPi mysqld[714]: 2020-07-14 12:41:40 0 [Warning] Can't create test file /var/lib/mysql/DietPi.lower-test
Jul 14 12:41:43 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 14 12:41:43 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jul 14 12:41:43 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 12:41:43 BST; 5min ago
[FAILED] DietPi-Services | ● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-07-14 12:41:46 BST; 5min ago
  Process: 800 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
  Process: 805 ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf (code=exited, status=255/EXCEPTION)
 Main PID: 805 (code=exited, status=255/EXCEPTION)

Jul 14 12:41:46 DietPi systemd[1]: lighttpd.service: Service RestartSec=100ms expired, scheduling restart.
Jul 14 12:41:46 DietPi systemd[1]: lighttpd.service: Scheduled restart job, restart counter is at 5.
Jul 14 12:41:46 DietPi systemd[1]: Stopped Lighttpd Daemon.
Jul 14 12:41:46 DietPi systemd[1]: lighttpd.service: Start request repeated too quickly.
Jul 14 12:41:46 DietPi systemd[1]: lighttpd.service: Failed with result 'exit-code'.
Jul 14 12:41:46 DietPi systemd[1]: Failed to start Lighttpd Daemon.
[  OK  ] DietPi-Services | cron                 active (running) since Tue 2020-07-14 12:41:43 BST; 5min ago
[  OK  ] DietPi-Services | dropbear             active (running) since Tue 2020-07-14 12:41:38 BST; 5min ago
[  OK  ] DietPi-Services | dietpi-ramlog        active (exited) since Tue 2020-07-14 09:19:30 BST; 3h 28min ago
[  OK  ] DietPi-Services | dietpi-preboot       active (exited) since Tue 2020-07-14 09:19:30 BST; 3h 28min ago
[  OK  ] DietPi-Services | dietpi-boot          active (exited) since Tue 2020-07-14 12:41:38 BST; 5min ago
[  OK  ] DietPi-Services | dietpi-postboot      active (exited) since Tue 2020-07-14 12:41:38 BST; 5min ago
[ INFO ] DietPi-Services | dietpi-wifi-monitor  inactive (dead) 
Server is not even running now...

Note: I didn't ran the commands of your last answer yet.
Last edited by mk33 on Tue Jul 14, 2020 2:04 pm, edited 1 time in total.
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: Internal Server Error on NextCloud after updating DietPi

Post by Joulinar »

You have 2 failing services now. Both web server as well as database are not working. But we would need to fix one by one. Pls can you check if you have sufficient space on your SD card
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 »

Yes I have:

Code: Select all

Filesystem     Type     1K-blocks     Used Available Use% Mounted on
/dev/root      ext4     122648040 42840088  74800256  37% /
devtmpfs       devtmpfs   1991700        0   1991700   0% /dev
tmpfs          tmpfs      2025492        0   2025492   0% /dev/shm
tmpfs          tmpfs      2025492    16664   2008828   1% /run
tmpfs          tmpfs         5120        0      5120   0% /run/lock
tmpfs          tmpfs      2025492        0   2025492   0% /sys/fs/cgroup
tmpfs          tmpfs        51200      100     51100   1% /var/log
tmpfs          tmpfs      2025472        0   2025472   0% /tmp
/dev/mmcblk0p1 vfat        258095    53701    204394  21% /boot
mk33
Posts: 21
Joined: Thu Jun 11, 2020 10:13 pm

Re: Internal Server Error on NextCloud after updating DietPi

Post by mk33 »

I have 128 Gb Sdcard Samsung pro
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: Internal Server Error on NextCloud after updating DietPi

Post by Joulinar »

ok space is not an issue and all data seems to located on the SD card as well. Pls can you perform the checks I ask for above to be able to have a look into database first

Code: Select all

systemctl restart mariadb.service
journalctl -u mariadb
cat /var/log/mysql/error.log
readlink /var/lib/mysql
readlink -f /var/lib/mysql
sudo -u mysql -g mysql touch /var/lib/mysql/demo.file
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 »

systemctl restart mariadb.service

Code: Select all

Failed to connect to bus: No such file or directory
Then i ran again as sudo:

Code: Select all

sudo systemctl restart mariadb.service
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.

Code: Select all

sudo journalctl -u mariadb
-- Logs begin at Thu 2019-02-14 10:11:58 GMT, end at Tue 2020-07-14 13:34:14 BST. --
Jul 14 12:41:39 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jul 14 12:41:40 DietPi mysqld[714]: 2020-07-14 12:41:40 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as p
rocess 714 ...
Jul 14 12:41:40 DietPi mysqld[714]: 2020-07-14 12:41:40 0 [Warning] Can't create test file /var/lib/mysql/DietPi.lower-test
Jul 14 12:41:43 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 14 12:41:43 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jul 14 12:41:43 DietPi systemd[1]: Failed to start MariaDB 10.3.22 database server.
Jul 14 13:33:14 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jul 14 13:33:14 DietPi mysqld[1160]: 2020-07-14 13:33:14 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as 
process 1160 ...
Jul 14 13:33:14 DietPi mysqld[1160]: 2020-07-14 13:33:14 0 [Warning] Can't create test file /var/lib/mysql/DietPi.lower-test
Jul 14 13:33:17 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 14 13:33:17 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jul 14 13:33:17 DietPi systemd[1]: Failed to start MariaDB 10.3.22 database server.

Code: Select all

readlink /var/lib/mysql
/mnt/dietpi_userdata/mysql

readlink -f /var/lib/mysql
/mnt/dietpi_userdata/mysql


sudo -u mysql -g mysql touch /var/lib/mysql/demo.file
touch: cannot touch '/var/lib/mysql/demo.file': Permission denied

Note: Yesterday i couldn't access /var/log/lighttpd so i ran sudo chown -R my_username /var/log/lighttpd . Maybe this caused some side effects...
Post Reply