Data directory protected & MariaDB down

Hello,

I have a strange behavior for some time now regarding the accessibility of the cloud. I get the error message “Your data directory is write protected. Permissions can usually be corrected by giving the web server write access to the root directory.”

Interestingly, when I reboot the system, Nextcloud is accessible again. While at first it was only every few weeks, the error now occurs almost every day. Can anyone give me some advice here?

BTW:
After each reboot, the domain must be entered as trusted in config.php. Why is this not saved?

Here is an excerpt from the logfile (/var/log/syslog)

RaspberryPi 4B 4GB
Nextcloud 24.0.8
NextCoudPi v1.51.0

Read Upgrade manually — Nextcloud latest Administration Manual latest documentation

point 12.

1 Like

I had already executed the command “chown -R www-data:www-data nextcloud” two days ago.
Now I have added “find nextcloud/ -type d -exec chmod 750 {} {};” and “find nextcloud/ -type f -exec chmod 640 {} ;”. Let’s see if it helps.
But why is the entered domain in config.php not saved on reboot?

NCP provides following tool ncp-fix-permissions. Have you tried this already?
Please read https://help.nextcloud.com/t/menu-configuration-reference-for-backups-config-networking-security-system-tools-updates/126011#nc-fix-permissions-71

Have you tried to add the domain via nc-trusted-domains?
Please read https://help.nextcloud.com/t/menu-configuration-reference-for-backups-config-networking-security-system-tools-updates/126011#nc-trusted-domains-34

If your issues remain, please post the output of sudo ncp-report

Now I have another problem. Had the same problem this morning and reset the write permissions as stated above. After the reboot this time the RaspberryPi hung and I cut the power. After another reboot the database server does not start anymore:

root@nextcloudpi:/# service mariadb restart
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.

systemctl status mariadb.service

root@nextcloudpi:/# systemctl status mariadb.service
● mariadb.service - MariaDB 10.5.18 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 Sun 2023-03-05 19:06:23 GMT; 13s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 29774 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 29775 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 29777 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && >
Cntrl PID: 29872 (sleep)
      Tasks: 1 (limit: 4164)
        CPU: 186ms
     CGroup: /system.slice/mariadb.service
             └─29872 /bin/sleep 20

Mar 05 19:06:23 nextcloudpi systemd[1]: Starting MariaDB 10.5.18 database server...

journalctl -xe

root@nextcloudpi:/# journalctl -xe
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ An ExecStart= process belonging to unit mariadb.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Mar 05 19:06:43 nextcloudpi systemd[1]: mariadb.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The unit mariadb.service has entered the 'failed' state with result 'exit-code'.
Mar 05 19:06:43 nextcloudpi systemd[1]: Failed to start MariaDB 10.5.18 database server.
░░ Subject: A start job for unit mariadb.service has failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit mariadb.service has finished with a failure.
░░
░░ The job identifier is 8342 and the job result is failed.
Mar 05 19:06:45 nextcloudpi sudo[29941]:     root : PWD=/ ; USER=www-data ; COMMAND=/usr/bin/php /var/www/nextcloud/occ config:system:get overwrite.cli.url
Mar 05 19:06:45 nextcloudpi sudo[29941]: pam_unix(sudo:session): session opened for user www-data(uid=33) by (uid=0)
Mar 05 19:06:45 nextcloudpi bash[29942]: Cannot load Zend OPcache - it was already loaded
Mar 05 19:06:45 nextcloudpi sudo[29941]: pam_unix(sudo:session): session closed for user www-data
Mar 05 19:06:48 nextcloudpi sudo[29945]:     root : PWD=/ ; USER=www-data ; COMMAND=/usr/bin/php /var/www/nextcloud/occ config:system:get overwrite.cli.url
Mar 05 19:06:48 nextcloudpi sudo[29945]: pam_unix(sudo:session): session opened for user www-data(uid=33) by (uid=0)
Mar 05 19:06:48 nextcloudpi systemd[1]: mariadb.service: Scheduled restart job, restart counter is at 5.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ Automatic restarting of the unit mariadb.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Mar 05 19:06:48 nextcloudpi systemd[1]: Stopped MariaDB 10.5.18 database server.
░░ Subject: A stop job for unit mariadb.service has finished
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A stop job for unit mariadb.service has finished.
░░
░░ The job identifier is 8406 and the job result is done.
Mar 05 19:06:48 nextcloudpi systemd[1]: Starting MariaDB 10.5.18 database server...
░░ Subject: A start job for unit mariadb.service has begun execution
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit mariadb.service has begun execution.
░░
░░ The job identifier is 8406.
Mar 05 19:06:48 nextcloudpi bash[29946]: Cannot load Zend OPcache - it was already loaded
Mar 05 19:06:48 nextcloudpi sudo[29945]: pam_unix(sudo:session): session closed for user www-data
Mar 05 19:06:51 nextcloudpi sudo[30067]:     root : PWD=/ ; USER=www-data ; COMMAND=/usr/bin/php /var/www/nextcloud/occ config:system:get overwrite.cli.url
Mar 05 19:06:51 nextcloudpi sudo[30067]: pam_unix(sudo:session): session opened for user www-data(uid=33) by (uid=0)
Mar 05 19:06:51 nextcloudpi bash[30068]: Cannot load Zend OPcache - it was already loaded
Mar 05 19:06:52 nextcloudpi sudo[30067]: pam_unix(sudo:session): session closed for user www-data
Mar 05 19:06:55 nextcloudpi sudo[30071]:     root : PWD=/ ; USER=www-data ; COMMAND=/usr/bin/php /var/www/nextcloud/occ config:system:get overwrite.cli.url
Mar 05 19:06:55 nextcloudpi sudo[30071]: pam_unix(sudo:session): session opened for user www-data(uid=33) by (uid=0)
Mar 05 19:06:55 nextcloudpi bash[30072]: Cannot load Zend OPcache - it was already loaded
Mar 05 19:06:55 nextcloudpi sudo[30071]: pam_unix(sudo:session): session closed for user www-data

Jetzt kann ich vermutlich die Nextcloud neu aufsetzen… :frowning_face:

@schoetju “ncp-fix-permissions” habe ich bereits getestet gehabt:
2023-03-05_fix-permissions