Problems after migrateing nextcloud to a new webspace

Hi,

my old web space would be disabled so I have to move to a new one.

I have copied all the files to the new web space and also save and copy the whole database.

The new web space has a different directory layout then the old one. So I have modified the data dir path in the config.php and also in the database itself in the oc_starges table.

All seems to be fine, all files are there, all contacts, calendars and task are there.

Then I have upgrade nc from 18.10 to 19.04 over the web updater without a problem.
Now after login, nc means I have to modify some database tables, so I tried.

cloud$ /opt/plesk/php/7.3/bin/php occ db:add-missing-indices
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 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 /owncloud/lib/private/Console/Application.php:168
Stack trace:
#0 /owncloud/console.php(99): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /owncloud/occ(11): require_once(’/owncloud/conso…’)
#2 {main}

But what next, I didn’t understand what I have done wrong and how can I solve this.
Is there a way that occ can tell me were it looks for the data folder?

In fact, .ocdata is there and I have tried to remove and recreate it, without luck.

I’m out of Ideas.

Any help?

Micha

From the data folder moving manual (HowTo: Change / Move data directory after installation), the oc_storages table should be enough. If you still have a dump of the database, perhaps you can check if there are other references to the old file location. Perhaps some apps?

Unfortunately the error messages is not very clear, it doesn’t state the folder it was looking in, you could make a feature request on github to give more specific information (https://github.com/nextcloud/server/issues).

Here is the code:

Perhaps you can modify one line (untested, not sure about the syntax):

'error' => $l->t('Your data directory is invalid: %s', [$dataDirectory]),

seems to work,

/opt/plesk/php/7.3/bin/php occ db:add-missing-indices
Your data directory is invalid: /var/www/vhosts/******/owncloud/data
Ensure there is a file called “.ocdata” in the root of the data directory.

That confuses me even more, because this is the right place. But I haven’t understand the whole thing,
I I logged in in the server I land on / which the correct path would be /owncloud/data. It would save many time it would show, on which path it searches.

So it drives my crazy, now the occ command is working fine, now the web interface tells me

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

So, now I have /var/www/vhosts/******/owncloud/data in the oc_storages and /owncloud/data in the config.php.
What now?
Changing the path in oc_stoarges dosen’t work

It could be a permission issue, either for the folder (or parent folder) or the file itself.