Hardware: Old laptop or computer YunoHost version: 11.2.15 I have access to my server : terminal and web. Physical and ssh Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no
Description of my issue
I get this error in the Nextcloud front page:
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/21/go.php?to=admin-dir_permissions.
My memory is a bit fuzzy on the details, but I did an update of everything about 2 weeks ago.
System first, everything ok, then Nextcloud. Also ok.
1 - I got some error logs indicating my user files could be accessible from outside.
2 - I also had some indexing error reccomending running an occ command.
Somehow I got led to move my data folder to secure my files. I did, and moved them back since the reccomendation did not work.
Running occ complained about wrong php version.
The .ocdata file exists.
chatGPT pointed me to this:
sudo find /home/yunohost.app/nextcloud -type d -exec chmod 750 {} \;
sudo find /home/yunohost.app/nextcloud -type f -exec chmod 640 {} \;
Same result, but then I cantt run occ
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/29/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:167
Stack trace:
#0 /var/www/nextcloud/console.php(101): OC\Console\Application->loadCommands()
#1 /var/www/nextcloud/occ(11): require_once('...')
#2 {main}{"reqId":"KdV4U26KP9P0gTw8B7tu","level":3,"time":"2024-07-04T20:15:31+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"Optional parameter $userId declared before required parameter $path is implicitly treated as a required parameter at /var/www/nextcloud/apps/deck/lib/Service/ConfigService.php#234","userAgent":"--","version":"29.0.2.2","data":{"app":"PHP"}}
Edit:
I reverted back to the permissions prior to this and occ working and the error:
Configuration was not read or initialized correctly, not overwriting /var/www/nextcloud/config/config.php
Oohh… It’s working again. And Nextcloud is as fast as never before.
Don’t know exactly what solved it, but a couple of restores of system and nextcloud along with some owner/permission settings for data and config folder made it. Guess I finally got lucky
@jarod5001, you pointed me towards the solution. Thanks.
And thanks to myself for making backups.