Trouble with ocdata after power outage

Hello there ,
I have an issue with my nextcloud server since yesterday I’ve tried to access it but it keeps showing me this error message:
Ihr Datenverzeichnis ist ungültig. Stellen Sie sicher, dass eine Datei “.ocdata” im Wurzelverzeichnis des data-Verzeichnisses existiert. Your data directory is not writable Berechtigungen können zumeist korrigiert werden indem dem Web-Server Schreibzugriff auf das Wurzel-Verzeichnis eingeräumt wird. Siehe auch https://docs.nextcloud.com/server/19/go.php?to=admin-dir_permissions.
Nextcloud version (19.0.2.2):
Operating system and version (Raspian GNU Linux 10):

The issue occured after a power outage, is that a conincidence ?

Further logs and information:

nexcloud log:

NextCloudPi diagnostics

{“reqId”:“dD35tA19UzmJg4gZHhCF”,“level”:2,“time”:“2020-10-31T13:40:06+00:00”,“remoteAddr”:"",“user”:"–",“app”:“no app in context”,“method”:"",“url”:"–",“message”:“Temporary directory /media/myCloudDrive/ncdata/tmp is not present or writable”,“userAgent”:"–",“version”:“19.0.2.2”}

Nextcloud is in maintenance mode - no apps have been loaded

{„reqId":“dD35tA19UzmJg4gZHhCF”,“level”:3,“time”:“2020-10-31T13:40:07+00:00”,“remoteAddr”:"",“user”:"–",“app”:“PHP”,“method”:"",“url”:"–",“message”:"fopen(/media/myCloudDrive/ncdata/

data_dir_writability_test_5f9d6937218c3.tmp): failed to open stream: Permission denied at /var/www/nextcloud/lib/private/legacy/OC_Util.php#790",“userAgent”:"–",“version”:“19.0.2.2”}

{“reqId”:“dD35tA19UzmJg4gZHhCF”,“level”:3,“time”:“2020-10-31T13:40:07+00:00”,“remoteAddr”:"",“user”:"–",“app”:“PHP”,“method”:"",“url”:"–",“message”:“fopen(/media/myCloudDrive/ncdata/nextcloud.log): failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#84”,“userAgent”:"–",“version”:“19.0.2.2”}

NextCloudPi version v1.31.0

Nextcloud configuration

{“reqId”:“F05B6APXkoihqIu5ORDc”,“level”:2,“time”:“2020-10-31T13:40:12+00:00”,“remoteAddr”:"",“user”:"–",“app”:“no app in context”,“method”:"",“url”:"–",“message”:“Temporary directory /media/myCloudDrive/ncdata/tmp is not present or writable”,“userAgent”:"–",“version”:“19.0.2.2”}

Nextcloud is in maintenance mode - no apps have been loaded

{„reqId":“F05B6APXkoihqIu5ORDc”,“level”:3,“time”:“2020-10-31T13:40:12+00:00”,“remoteAddr”:"",“user”:"–",“app”:“PHP”,“method”:"",“url”:"–",“message”:"fopen(/media/myCloudDrive/ncdata/

data_dir_writability_test_5f9d693ca06a9.tmp): failed to open stream: Permission denied at /var/www/nextcloud/lib/private/legacy/OC_Util.php#790“,“userAgent”:"–",“version”:“19.0.2.2”}

Your data directory is invalid

Ensure there is a file called “.ocdata” in the root of the data directory.

Your data directory is not writable

Permissions can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/19/go.php?to=admin-dir_permissions.

An unhandled exception has been thrown:

Exception: Environment not properly prepared. in /var/www/nextcloud/lib/private/Console/Application.php:168

Stack trace:

#0 /var/www/nextcloud/console.php(99): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

#1 /var/www/nextcloud/occ(11): require_once(’/var/www/nextcl…’)

#2 {main}

{“reqId”:“F05B6APXkoihqIu5ORDc”,“level”:3,“time”:“2020-10-31T13:40:12+00:00”,“remoteAddr”:"",“user”:"–",“app”:“PHP”,“method”:"",“url”:"–",“message”:“fopen(/media/myCloudDrive/ncdata/nextcloud.log): failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#84”,“userAgent”:"–",“version”:“19.0.2.2”}

[Sat Oct 31 13:24:04.810572 2020] [authz_host:error] [pid 928:tid 2764440608] [client 192.168.178.73:49440] AH01753: access check of ‘localhost’ to /img/settings-white.svg failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/css/ncp.css

[Sat Oct 31 13:25:13.657207 2020] [proxy_fcgi:error] [pid 928:tid 2764440608] [client 192.168.178.73:49440] AH01067: Failed to read FastCGI header

[Sat Oct 31 13:25:13.657343 2020] [proxy_fcgi:error] [pid 928:tid 2764440608] (104)Connection reset by peer: [client 192.168.178.73:49440] AH01075: Error dispatching request to :4443:

[

Sat Oct 31 13:25:13.850357 2020] [mpm_event:notice] [pid 927:tid 3070157328] AH00491: caught SIGTERM, shutting down

[Sat Oct 31 13:25:34.855437 2020] [ssl:warn] [pid 740:tid 3069248016] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name

[Sat Oct 31 13:25:34.892156 2020] [ssl:warn] [pid 892:tid 3069248016] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name

[Sat Oct 31 13:25:34.897979 2020] [mpm_event:notice] [pid 892:tid 3069248016] AH00489: Apache/2.4.38 (Raspbian) OpenSSL/1.1.1d configured – resuming normal operations

[Sat Oct 31 13:25:34.898092 2020] [core:notice] [pid 892:tid 3069248016] AH00094: Command line: ‚/usr/sbin/apache2’

tail: cannot open ‘/media/myCloudDrive/ncdata/nextcloud.log’ for reading: No such file or directory

The output of my config.php file 
?php
$CONFIG = array (
  'passwordsalt' =>xxx ,
  'secret' => xxx,
  'trusted_domains' => 
  array (
    0 => 'xxx',
    11 => 'xxx',
    1 => 'xxx',
    5 => 'xxx.local',
    7 => 'xxx',
    8 => 'xxx',
    12 => xxx,
  ),
  'datadirectory' => '/media/myCloudDrive/ncdata',
  'dbtype' => 'mysql',
  'version' => '19.0.2.2',
  'overwrite.cli.url' => xxx,
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => 'xxx',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' =>xxx,
  'dbpassword' => xxx,
  'installed' => true,
  'instanceid' => 'oct62j5rv71k',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => '1dDX1SR5uGxhm07FhShqJUvjXNO+cSRO2YAMiEkpZJw=',
  ),
  'tempdirectory' => '/media/myCloudDrive/ncdata/tmp',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
'mail_from_address' => 'admin',
  'mail_domain' => 'xxx',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'overwriteprotocol' => 'https',
  'maintenance' => true,
  'logfile' => '/media/myCloudDrive/ncdata/nextcloud.log',
);

It would be great if someone could help me here :)

Do you have the .ocdata in your

?

As far as I can see yes and it is empty.

root@nextcloudpi:~# ls -a /var/www/nextcloud/data/
appdata_oct62j5rv71k .htaccess ncp nextcloud.log .opcache
files_external index.html news .ocdata tmp

Silly question, but do you have any backups?

  1. You can try executing commands using the full/path/to/each/part if the system cannot locate them. Might get commands running properly.
  2. If ncdata directory contains your /data you will be able to restore your system, potentially with a re-install.

Chat is at https://t.me/nextcloudpi

Is your data directory

mounted?

yes it is mounted tried that.

thanks for the chat, my backup doesn’t work unfortunately but I will try to reinitialize the server tomorrow.

Share your actual mount config with us please, including permissions

I reinitialized nextcloud yesterday evening.
Now it’s working again.
Thanks to everybody