Message is claiming .ocdata is missing but it is not

Nextcloud version (eg, 12.0.2):
Operating system and version (eg, Ubuntu 17.04): raspbian/nextcloudpi
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.25
PHP version (eg, 7.1): 7.2.13

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. open browser and try to login to nextcloud

Update: the english version might be more helpful:

Data directory is invalid. Please check that the data directory contains a file “.ocdata” in its root.

When trying to login a message is claiming that .ocdata does not exist in the data folder but it does and has 770 permissions for user www-data.
This occured after a reboot (due to a power failure).
Interestingly I can see this in the nextcloud.log:

{“reqId”:“XCn4BX8AAQEAAAT@3sUAAAAN”,“level”:2,“time”:“2018-12-31T11:05:41+00:00”,“remoteAddr”:“ip address”,“user”:"–",“app”:“no app in context”,“method”:“GET”,“url”:"/status.php",“message”:“Temporary directory /media/USBdrive/ncdata/tmp is not present or writable”,“userAgent”:“Mozilla/5.0 (Linux) mirall/2.3.3 (Nextcloud)”,“version”:“”}

But again /tmp in the data folder does exist.

A “df -l” shows me that the disk with the data folder is mounted correctly and it is not full.

Update: The android app claims that the server is in maintenance mode - which is also not true.
Update: Some things I have tried - no luck at all:

sudo -u www-data php occ files:scan --all
sudo -u www-data php occ maintenance:repair
sudo -u www-data php occ maintenance:update:htaccess
Checking file/folder owner and permissions:
sudo chown -R www-data:www-data ncdata/
sudo find ncdata/ -type d -exec chmod 750 {} ;
sudo find ncdata/ -type f -exec chmod 640 {} ;

Thank you for any kind of help!


Temporary directory /media/USBdrive/ncdata/tmp is not present or writable

check rights and ownership on files location.

All files and folders are owned by www-data, all files are 744, all folders are 750.

I have the same problem, and tried the same ways. Does anybody have a solution yet?

Nevermind, someone posted the solution already if somebody needs it: