Error reading data directory. Is NextCloud running and configured?

Just installed NextCloudPi on raspberry pi4.

NextCloudPi version v1.30.0
NextCloudPi image NextCloudPi_09-05-20

When trying to move the data to an external USB. getting this error.

[ nc-automount ] (Sun Sep 20 10:49:45 BST 2020)
automount enabled

[ nc-format-USB ] (Sun Sep 20 10:49:50 BST 2020)
/dev/sda: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/sda: 8 bytes were erased at offset 0x773c255e00 (gpt): 45 46 49 20 50 41 52 54
/dev/sda: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
WARNING: failed to open /dev/btrfs-control, skipping device registration: No such device
Drive sda formatted successfuly and labeled myCloudDrive

[ nc-datadir ] (Sun Sep 20 10:49:52 BST 2020)
{“reqId”:“Bk40LmEUbRWAy24wykQ0”,“level”:2,“time”:“2020-09-20T09:49:53+00:00”,“remoteAddr”:"",“user”:"–",“app”:“no app in context”,“method”:"",“url”:"–",“message”:“Temporary directory /media/USBdrive/ncdata/tmp is not present or writable”,“userAgent”:"–",“version”:“”}
{“reqId”:“Bk40LmEUbRWAy24wykQ0”,“level”:3,“time”:“2020-09-20T09:49:54+00:00”,“remoteAddr”:"",“user”:"–",“app”:“PHP”,“method”:"",“url”:"–",“message”:“file_get_contents(/media/USBdrive/ncdata/news/config/config.ini): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#272”,“userAgent”:"–",“version”:“”}
{“reqId”:“Bk40LmEUbRWAy24wykQ0”,“level”:2,“time”:“2020-09-20T09:49:54+00:00”,“remoteAddr”:"",“user”:"–",“app”:“news”,“method”:"",“url”:"–",“message”:“Configuration invalid. Ignoring values.”,“userAgent”:"–",“version”:“”}
{“reqId”:“Bk40LmEUbRWAy24wykQ0”,“level”:3,“time”:“2020-09-20T09:49:54+00:00”,“remoteAddr”:"",“user”:"–",“app”:“PHP”,“method”:"",“url”:"–",“message”:“mkdir(): Permission denied at /var/www/nextcloud/apps/news/lib/AppInfo/Application.php#140”,“userAgent”:"–",“version”:“”}
{“reqId”:“Bk40LmEUbRWAy24wykQ0”,“level”:3,“time”:“2020-09-20T09:49:54+00:00”,“remoteAddr”:"",“user”:"–",“app”:“PHP”,“method”:"",“url”:"–",“message”:“fopen(/media/USBdrive/ncdata/nextcloud.log): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Log/File.php#84”,“userAgent”:"–",“version”:“”}
Error reading data directory. Is NextCloud running and configured?

Tried to manually mount it. but still no luck.

root@nextcloudpi:~# blkid

/dev/mmcblk0p1: LABEL_FATBOOT=“boot” LABEL=“boot” UUID=“4BBD-D3E7” TYPE=“vfat” PARTUUID=“738a4d67-01”

/dev/mmcblk0p2: LABEL=“rootfs” UUID=“45e99191-771b-4e12-a526-0779148892cb” TYPE=“ext4” PARTUUID=“738a4d67-02”

/dev/sda1: LABEL=“myDrive” UUID=“c5fb7998-e239-46f2-ae7a-687c8325ead1” UUID_SUB=“4a5ba01f-6963-4463-9160-db6d2bc4743b” TYPE=“btrfs” PARTLABEL=“primary” PARTUUID="8b82815e-d1c5-4ec3-93b0-3bf32a8b3cec"

/dev/mmcblk0: PTUUID=“738a4d67” PTTYPE=“dos”
root@nextcloudpi:~# sudo mount /dev/sda1 /media/USBdrive

mount: /media/USBdrive1: unknown filesystem type ‘btrfs’.

Any help on this would be appreciated. Thank you!

Check what is in /media with

sudo ls -lh /media

You’ll find USBdrive and USBdrive1 are symbolic links created by nc-automount.

It works fine for 1st time users with a single external drive, but mixes things up when plugging in and out a second one.
It is probably preferable to learn a little bit on how Linux mounts drives, and mount your drives by it’s UUID and editing /etc/fstab to mount it persistently.
There is the a section in docs on Mounting an external drive, at the end of page, destined to docker users, but it will work for any use you make of it.

Thanks! Oliver. Here is the output of sudo ls -lh /media. I see only one drive.

root@nextcloudpi:~# sudo ls -lh /media
total 16K
drwxr-xr-x 1 root root 0 Sep 20 10:49 myCloudDrive
lrwxrwxrwx 1 root root 19 Sep 20 10:36 USBdrive -> /media/myCloudDrive

And when I go inside, myCloudDrive (USBdrive), I see nothing. If I am not mistaken, this should have ncdata folder.

root@nextcloudpi:~# cd /media/myCloudDrive
root@nextcloudpi:/media/myCloudDrive# ls
root@nextcloudpi:/media/myCloudDrive# cd

root@nextcloudpi:~# cd /media/USBdrive/
root@nextcloudpi:/media/USBdrive# ls

Data directory from config.php.
'datadirectory' => '/media/USBdrive/ncdata',

Is there a configuration missing?

Looks like something went wrong when formatting and mounting your drive

In which case nc-datadir could not move nc’s datadir and wll likely still be in


Normally nc-datadir will create a btrfs subvolume as part of the it’s process

You can try running as root or with sudo:

btrfs create subvolume /media/myCloudDrive/ncdata

After which you can either try nc-datadir again or move data manually and adjust its location in config.php to the new location once it has been moved/copied.

Run ncp-report and share output via pastebin or similar, if need further assistance.

Note: I rather use /media/myCloudDrive the actual location instead of the symbolic link, which can change when adding a drive and/or rebooting.

Yes, I see the data file at /var/www/nextcloud/data location.

Created the subvolume using
root@nextcloudpi:~# btrfs subvolume create /media/myCloudDrive/ncdata Create subvolume '/media/myCloudDrive/ncdata' root@nextcloudpi:~# cd /media/myCloudDrive/ncdata root@nextcloudpi:/media/myCloudDrive/ncdata# ls -lrt total 0 root@nextcloudpi:/media/myCloudDrive/ncdata# pwd /media/myCloudDrive/ncdata

Tried to move data to USB using wizard, got this error -

[ nc-datadir ] (Mon Sep 21 03:22:23 BST 2020) {"reqId":"sSnQKCV0ylIGXKwv7wIA","level":2,"time":"2020-09-21T02:22:24+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory /media/USBdrive/ncdata/tmp is not present or writable","userAgent":"--","version":""} {"reqId":"sSnQKCV0ylIGXKwv7wIA","level":3,"time":"2020-09-21T02:22:25+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"file_get_contents(/media/USBdrive/ncdata/news/config/config.ini): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#272","userAgent":"--","version":""} {"reqId":"sSnQKCV0ylIGXKwv7wIA","level":2,"time":"2020-09-21T02:22:25+00:00","remoteAddr":"","user":"--","app":"news","method":"","url":"--","message":"Configuration invalid. Ignoring values.","userAgent":"--","version":""} {"reqId":"sSnQKCV0ylIGXKwv7wIA","level":3,"time":"2020-09-21T02:22:25+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"mkdir(): Permission denied at /var/www/nextcloud/apps/news/lib/AppInfo/Application.php#140","userAgent":"--","version":""} {"reqId":"sSnQKCV0ylIGXKwv7wIA","level":3,"time":"2020-09-21T02:22:25+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fopen(/media/USBdrive/ncdata/data_dir_writability_test_5f680e6120f69.tmp): failed to open stream: Permission denied at /var/www/nextcloud/lib/private/legacy/OC_Util.php#790","userAgent":"--","version":""} {"reqId":"sSnQKCV0ylIGXKwv7wIA","level":3,"time":"2020-09-21T02:22:25+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fopen(/media/USBdrive/ncdata/nextcloud.log): failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#84","userAgent":"--","version":""}

Error reading data directory. Is NextCloud running and configured?

Moved the data manually to /media/USBdrive/ncdata.
config.php already pointing to /media/USBdrive/ncdata

'datadirectory' => '/media/USBdrive/ncdata',

I am still getting Nextcloud check error in the system info, and when trying to access the nextloud, getting this error.

Here is the ncp-report.

Though I have already tried 2 times, I won’t mind to recreate the image and try a fresh configuration?
Thanks for all your help!

What command did you use to move the datadir ?
Clearly something went wrong there, as it is complaining about invalid datadir and missing .ocdata.
Best to use rsync in archive mode to make sure everything is copied, including /tmp , .ocdata and ownership is maintained by www-data.

Also as mentioned: better use the absolute PATH to point to ncdata in config.php, not the symlink.

You can also check docs, as suggested by on screen error message.

Thanks! Using rsync, I was able to copy the entire folder and was able to move the data to external HDD. Thanks again!

Oliver - I am getting another issue … tried searching the forum, but could not get much help. Let me know if I should create a new thread.

When I am trying to sync the files through MAC client or through browser, Getting this error on the client
server replied 503 service unavailable to GET

When I checked the server logs -

Sabre\DAV\Exception\ServiceUnavailable: Could not open file

0. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 90:OCA\DAV\Connector\Sabre\File->get()
1. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php - line 89:Sabre\DAV\CorePlugin->httpGet(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 474:Sabre\DAV\Server->emit("method:GET", [ Sabre\HTTP ... }])
3. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 251:Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
4. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 319:Sabre\DAV\Server->start()
5. /var/www/nextcloud/apps/dav/lib/Server.php - line 320:Sabre\DAV\Server->exec()
6. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:OCA\DAV\Server->exec()
7. /var/www/nextcloud/remote.php - line 167:require_once("/var/www/ne ... p")

looks like a permission issue but not sure where. Tried running sudo chown -R www-data:www-data /media/myCloudDrive, did not fix the issue.

Thanks for your help!

You’re welcome.
Best use a new thread and add [solved] to title of this one.
Dont use Mac so cant be of any help on that. Someone else maybe :wink: