Nextcloud new server - data directory invalid

hello,

I’ve migrated nexcloud to a new server and now I get the above error.

for the moment I don’t have an idea what I can do.

I tried:
giving rights (sudo chown -R web3:client2 /var/www/clients/client2/web3/cloud)
find cloud/ -type d -exec chmod 750 {} ;
find cloud/ -type f -exec chmod 640 {} ;

hope somebody can help - thank you! :slight_smile:

this is a strange combination for a web server user/group. sure that your web server is running as user web3? normally it’s something like www-data, nginx, httpd, apache2.

@Reiner_Nippes of cause - I’m using ISPConfig.

when I try

sudo -u web3 php occ

I get this error message:

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

An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /var/www/clients/client2/web3/cloud/lib/private/Console/Application. php:166
Stack trace:
#0 /var/www/clients/client2/web3/cloud/console.php(96): OC\Console\Application->loadCommands(Object(Symfony\Component \Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/clients/client2/web3/cloud/occ(11): require_once(‘/var/www/client…’)

wasn’t aware of this tool.

what else did you try?
where is your data directory?
ls -la /var/www/clients/client2/web3/cloud/
ls -la /var/www/clients/client2/web3/cloud/<data-dir>

centos? -> selinux?

debian 10
php7.2 for the moment

yes, my installation is in
/var/www/clients/client2/web3/cloud
and data folder is in
/var/www/clients/client2/web3/cloud/data

my config file points there.

is there a /var/www/clients/client2/web3/cloud/data/.ocdata file?

yes: check your web server logs.
no: nc isn’t properly installed.

imho

yes, I’ve deleted it and added it again, no effect.

which logs are the best to search for this issue?
apache log
website log

?

i don’t know isptool. sorry.

i would look in both. grep -i error ...

@Reiner_Nippes only thing I find is this:

mod_fcgid: stderr: PHP Deprecated: Function get_magic_quotes_runtime() is deprecated in /usr/local/ispconfig/interface/lib/config.inc.php on line 48

but I don’t think this helps.

where would you look normally?

does that mean you restored the database from another installation and change the data dir?

may here you find an answer: → HowTo: Change / Move data directory after installation

@Reiner_Nippes thanks - but I found it - it was in the config.php … thank you very much :slight_smile:

Hi @drakul,

What was it that you found in the config.php that meant you could solve the issue?

If you could post your fix here it will almost certainly help someone in the future.

Just in case someone got the same problem but could not solve it.

I run NextCloudPi in a VM on Proxmox
So it’s a Debian Nextcloud setup.

I encountered the issue discribed above and got this page when navigating to my instance:

datadir invalid

in my case this was due to a failed backup restore. I realised this as the used datadir space was smaller then the actual backup.tar.gz file.

After a renewed attempt, it worked fine.