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

Hi There I am getting this error message.
Running the nexcloudpi image on the nexcloud WD box set up with raspbery 2

anyone can help ??

thank yoy

1 Like


Any idea?



Didn’t see because it wasn’t in the ‘apliaces’ category

Was it working fine for you before? were you doing anything when this happened?


thanks Jimmy!

1 Like

it worked very good actually and then one morning it stopped no idea why the pi was running

ok, let’s see

What’s the output of

sudo grep datadirectory /var/www/nextcloud/config/config.php


sudo ls -ld $( sudo grep datadirectory /var/www/nextcloud/config/config.php | awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 )


ls -l /media/


systemctl status nc-automount-links

after the first command

I got this

after ls -l /media/
I get
“total 0”

and after the last one
systemctl status nc-automount-links

I get
"Unit nc-automount-links could not be found "

you misstyped this one

systemctl status nc-automount-links

in any case, if you have automount on, which I assume you have, it seems like you have no USB drive present.

Output of

lsblk -f


ohh I see tou are right
now i got this

btw I got this error when trying to access it from outside of LAN

well, at some point you USB drive was extracted or umounted (DELETE,ISDIR line).

have you tried rebooting?

yes … it didn’t help
It could be there was a power outage last week

That can easily cause SD card corruption. Maybe we can try to rule that option out.

Maybe you can try to check for SD card integrity

Also, even after reboot the output of systemctl status nc-automount-links is the same?

yep still the same

how about the SD card? is it fine? did you check for errors? (link)

SD card is ok… did move the image out and copy back to the card… and all good… no errors and the pi booted …

ok, what happens if you unplug it and plug it again, is the folder in

ls -l /media


Maybe some systemd update broke the thing again? in that case I’ll have to retest it