Missing .ocdata only when running occ

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version : 25.0.3
Operating system and version: ? Hosted Server
Apache or nginx version : ?
PHP version: 8.1.4

The issue you are facing:

When i try to execute the occ comand i get the following message:

Your data directory is invalid.
Ensure there is a file called ".ocdata" in the root of the data directory.

Cannot create "data" directory.
This can usually be fixed by giving the web server write access to the root directory. See https://docs.nextcloud.com/server/25/go.php?to=admin-dir_permissions

I tried already setting permissions for the folders and resetting my background jobs, which worked for some users.
Note: Nextcloud does not belong to http-www as it is hosted on a netcup plesk setup, which is weird in this regard.
The issue appeared after migrating the Server to a new domain.
The Change was otherwise no problem. For example, the Webinterface works without problem and I can create files there. To copy the files I used in absence of the rsync, even logging me in per ssh, is cp -a, which should preserve every ownership.

Here are the outputs of ls -la (Note i changed already the ownership permissions around to experiment)

drwxrwxrwx 18 hosting101455 psaserv  4096 Oct 23 10:17 .
drwxrwxrwx  3 hosting101455 psaserv  4096 Oct 12 14:59 ..
-rw-r--r--  1 hosting101455 psacln   3345 Oct 11 10:10 .htaccess
-rw-r--r--  1 hosting101455 psacln    101 Jan 17  2023 .user.ini
drwxrwxrwx  3 hosting101455 psacln   4096 Oct  8  2019 .well-known
drwxr-xr-x 47 hosting101455 psacln   4096 Jan 20  2023 3rdparty
-rw-r--r--  1 hosting101455 psacln  19327 Jan 17  2023 AUTHORS
-rw-r--r--  1 hosting101455 psacln  34520 Jan 17  2023 COPYING
drwxr-xr-x 84 hosting101455 psacln   4096 Oct 23 01:42 apps
drwxrwxrwx  2 hosting101455 psacln   4096 Oct 23 03:43 config
-rw-r--r--  1 hosting101455 psacln   4095 Jan 17  2023 console.php
drwxr-xr-x 23 hosting101455 psacln   4096 Jan 20  2023 core
-rw-r--r--  1 hosting101455 psacln   6317 Jan 17  2023 cron.php
drwxrwxrwx 37 hosting101455 psacln   4096 Oct 23 11:06 data
drwxr-xr-x  2 hosting101455 psacln  12288 Jan 20  2023 dist
-rw-r--r--  1 hosting101455 psacln    156 Jan 17  2023 index.html
-rw-r--r--  1 hosting101455 psacln   3456 Jan 17  2023 index.php
drwxr-xr-x  6 hosting101455 psacln   4096 Jan 20  2023 lib
drwxr-xr-x  3 hosting101455 psacln   4096 Apr 22  2023 nextcloud-data
-rw-r--r--  1 hosting101455 psacln    283 Jan 17  2023 occ
drwxr-xr-x  2 hosting101455 psacln   4096 Jan 20  2023 ocm-provider
drwxr-xr-x  2 hosting101455 psacln   4096 Jan 20  2023 ocs
drwxr-xr-x  2 hosting101455 psacln   4096 Jan 20  2023 ocs-provider
-rw-r--r--  1 hosting101455 psacln   3139 Jan 17  2023 public.php
-rw-r--r--  1 hosting101455 psacln   5549 Jan 17  2023 remote.php
drwxr-xr-x  4 hosting101455 psacln   4096 Jan 20  2023 resources
-rw-r--r--  1 hosting101455 psacln     26 Jan 17  2023 robots.txt
-rw-r--r--  1 hosting101455 psacln   2452 Jan 17  2023 status.php
drwxrwxrwx  3 hosting101455 psacln   4096 Jan 20  2023 themes
drwxr-xr-x  2 hosting101455 psacln   4096 Oct 23 01:40 tmp
drwxrwxrwx  2 hosting101455 psacln   4096 Jan 20  2023 updater
-rw-r--r--  1 hosting101455 psacln    383 Jan 17  2023 version.php

The Cloud is in the folder httpdocs

drwxrwxrwx 18 hosting101455 psaserv 4096 Oct 23 10:17 httpdocs

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

The output of your Nextcloud log in Admin > Logging:
Latest log immediatly afte rtrying to execute occ

{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OC\\Core\\BackgroundJobs\\BackgroundCleanupUpdaterBackupsJob job with ID 24376","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":1,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Could not find updater directory /var/www/vhosts/hosting101455.af996.netcup.net/cloud.stammkirkias.de/httpdocs/data/updater-oclqv2c2y8oz/backups - cleanup step not needed","userAgent":"--","version":"25.0.3.2","data":[]}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OC\\Core\\BackgroundJobs\\BackgroundCleanupUpdaterBackupsJob job with ID 24376 in 0 seconds","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 24377","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OC\\Core\\BackgroundJobs\\LookupServerSendCheckBackgroundJob job with ID 24377","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OC\\Core\\BackgroundJobs\\LookupServerSendCheckBackgroundJob job with ID 24377 in 0 seconds","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 18","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\UpdateNotification\\ResetTokenBackgroundJob job with ID 18","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\UpdateNotification\\ResetTokenBackgroundJob job with ID 18 in 0 seconds","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 2941","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob job with ID 2941","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob job with ID 2941 in 0 seconds","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 2942","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob job with ID 2942","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob job with ID 2942 in 0 seconds","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 2943","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob job with ID 2943","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob job with ID 2943 in 0 seconds","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"CLI cron call has selected job with ID 2944","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}
{"reqId":"SyjlkvLGG63opNGBABAY","level":0,"time":"2023-10-22T23:06:26+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\Files_Sharing\\BackgroundJob\\FederatedSharesDiscoverJob job with ID 2944","userAgent":"--","version":"25.0.3.2","data":{"app":"cron"}}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => '***,
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' => 
  array (
    0 => 'cloud.domain.de',
    1 => 'cloud.domain.me',
    2 => 'cloud.domain.de',
  ),
  'datadirectory' => '/var/www/vhosts/hostingadress/cloud.domain.de/httpdocs/data',
  'dbtype' => 'mysql',
  'version' => '25.0.3.2',
  'overwrite.cli.url' => 'https://cloud.domain.de',
  'dbname' => 'k59766_ks_cloud',
  'dbhost' => 'ip:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'db_user',
  'dbpassword' => '***',
  'mysql.utf8mb4' => true,
  'installed' => true,
  'maintenance' => false,
  'logtimezone' => 'UTC',
  'theme' => '',
  'loglevel' => 0,
  'skeletondirectory' => '',
  'updater.release.channel' => 'stable',
  'default_phone_region' => 'DE',
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_from_address' => 'cloud',
  'mail_domain' => 'domain.de',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'domain.netcup.net',
  'mail_smtpport' => '465',
  'trashbin_retention_obligation' => 'auto',
  'check_data_directory_permissions' => false,
  'app_install_overwrite' => 
  array (
    0 => 'occweb',
    1 => 'impersonate',
  ),
  'mail_sendmailmode' => 'smtp',
  'mail_smtpname' => 'cloud@domain.de',
  'mail_smtppassword' => '****',
);

Thank you already

Ok, for anyone in my Situation with a plesk netcup setup, here is the solution