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

output of sudo ncp-report?

<–! Paste this in GitHub report -->

<details>

<summary>NextCloudPi diagnostics</summary>


Nextcloud is in maintenance mode - no apps have been loaded


I tried to disable maintenance mode and got this

Nextcloud is in maintenance mode - no apps have been loaded

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/13/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:148
Stack trace:
#0 /var/www/nextcloud/console.php(89): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

run the command, and give it a couple minutes to finish

<–! Paste this in GitHub report -->

NextCloudPi diagnostics

Nextcloud is in maintenance mode - no apps have been loaded

NextCloudPi version  v0.47.1
NextCloudPi image    NextCloudPi_12-04-17
distribution         Raspbian GNU/Linux 9 \n \l
automount            yes
USB devices          sda 
datadir              /media/USBdrive/ncdata (doesn't exist)
rootfs usage         1.9G/15G
swapfile             /var/swap
Nextcloud check      error
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
Postfix service      up
internet check       ok
port check 80        open
port check 443       open
IP                   10.0.1.4
gateway              10.0.1.1
interface            eth0
certificates         crewhudson.ddns.net 
certs due            53 days 
NAT loopback         no
uptime               10:55

Nextcloud configuration

Nextcloud is in maintenance mode - no apps have been loaded

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/13/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:148
Stack trace:
#0 /var/www/nextcloud/console.php(89): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#2 {main}
HTTPd logs

[Wed Mar 14 11:49:16.391728 2018] [authz_host:error] [pid 976:tid 1935332400] [client 10.0.1.9:62081] AH01753: access check of 'localhost' to /img/favicon.png failed, reason: unable to get the remote host name
[Wed Mar 14 11:49:16.956153 2018] [proxy_fcgi:error] [pid 976:tid 1943721008] [client 10.0.1.9:62081] AH01071: Got error 'PHP message: PHP Warning:  touch(): Utime failed: Permission denied in /var/www/ncp-web/ncp-output.php on line 81\n'
[Wed Mar 14 11:57:53.952012 2018] [authz_host:error] [pid 976:tid 1910166576] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:54.066090 2018] [authz_host:error] [pid 976:tid 1910166576] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:54.066497 2018] [authz_host:error] [pid 976:tid 1910166576] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /index.php failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:54.179807 2018] [authz_host:error] [pid 976:tid 1910166576] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /index.php failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:54.196920 2018] [proxy_fcgi:error] [pid 976:tid 1910166576] [client 10.0.1.9:63038] AH01071: Got error 'PHP message: PHP Warning:  fclose(): supplied resource is not a valid stream resource in /var/www/ncp-web/L10N.php on line 121\n'
[Wed Mar 14 11:57:54.201972 2018] [authz_host:error] [pid 976:tid 1893389360] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /minified.js failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:54.202894 2018] [authz_host:error] [pid 976:tid 1876612144] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /ncp.css failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:54.202894 2018] [authz_host:error] [pid 976:tid 1885000752] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /ncp.js failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:54.203447 2018] [authz_host:error] [pid 976:tid 1868223536] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /img/ncp-logo.svg failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:54.204107 2018] [authz_host:error] [pid 976:tid 1843057712] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /loading-small.gif failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:54.231665 2018] [authz_host:error] [pid 976:tid 1859834928] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /img/poweroff.svg failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:54.235199 2018] [authz_host:error] [pid 976:tid 1851446320] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /img/reboot.svg failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:54.315249 2018] [authz_host:error] [pid 976:tid 1834669104] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /img/wizard.svg failed, reason: unable to get the remote host name, referer: https://10.0.1.4:4443/ncp.css
[Wed Mar 14 11:57:54.317950 2018] [authz_host:error] [pid 976:tid 1826280496] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /img/menu.svg failed, reason: unable to get the remote host name, referer: https://10.0.1.4:4443/ncp.css
[Wed Mar 14 11:57:54.319943 2018] [authz_host:error] [pid 976:tid 1809503280] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /img/info.svg failed, reason: unable to get the remote host name, referer: https://10.0.1.4:4443/ncp.css
[Wed Mar 14 11:57:54.378085 2018] [authz_host:error] [pid 976:tid 1784337456] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /ncp-output.php failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:54.420563 2018] [authz_host:error] [pid 976:tid 1792726064] [client 10.0.1.9:63038] AH01753: access check of 'localhost' to /img/favicon.png failed, reason: unable to get the remote host name
[Wed Mar 14 11:57:55.025941 2018] [proxy_fcgi:error] [pid 976:tid 1784337456] [client 10.0.1.9:63038] AH01071: Got error 'PHP message: PHP Warning:  touch(): Utime failed: Permission denied in /var/www/ncp-web/ncp-output.php on line 81\n'

Database logs

2018-03-14 11:41:59 1988980736 [Note] InnoDB: Highest supported file format is Barracuda.
2018-03-14 11:41:59 1988980736 [Note] InnoDB: The log sequence numbers 1773958166 and 1773958166 in ibdata files do not match the log sequence number 1926557116 in the ib_logfiles!
2018-03-14 11:42:04 1988980736 [Note] InnoDB: Restoring possible half-written data pages from the doublewrite buffer...
2018-03-14 11:42:05 1988980736 [Note] InnoDB: 128 rollback segment(s) are active.
2018-03-14 11:42:05 1988980736 [Note] InnoDB: Waiting for purge to start
2018-03-14 11:42:05 1988980736 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.35-80.0 started; log sequence number 1926557116
2018-03-14 11:44:18 1438643008 [Note] InnoDB: Dumping buffer pool(s) not yet started
2018-03-14 11:44:18 1988980736 [Note] Plugin 'FEEDBACK' is disabled.
2018-03-14 11:44:18 1988980736 [Note] Recovering after a crash using tc.log
2018-03-14 11:44:18 1988980736 [Note] Starting crash recovery...
2018-03-14 11:44:18 1988980736 [Note] Crash recovery finished.
2018-03-14 11:44:18 1988980736 [Note] Server socket created on IP: '127.0.0.1'.
2018-03-14 11:44:18 1988980736 [ERROR] mysqld: Table './mysql/user' is marked as crashed and should be repaired
2018-03-14 11:44:18 1988980736 [Warning] Checking table:   './mysql/user'
2018-03-14 11:44:18 1988980736 [ERROR] mysql.user: 1 client is using or hasn't closed the table properly
2018-03-14 11:44:18 1988980736 [ERROR] mysqld: Table './mysql/db' is marked as crashed and should be repaired
2018-03-14 11:44:18 1988980736 [Warning] Checking table:   './mysql/db'
2018-03-14 11:44:18 1988980736 [ERROR] mysql.db: 1 client is using or hasn't closed the table properly
2018-03-14 11:44:19 1988980736 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.1.23-MariaDB-9+deb9u1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Raspbian 9.0

Nextcloud logs

tail: cannot open '/media/USBdrive/ncdata/nextcloud.log' for reading: No such file or directory

ls -l /media

and

systemctl status nc-automount-links

total 16
drwxr-xr-x 1 root root 270 Mar 14 11:13 myCloudDrive

systemctl status nc-automount-links

● nc-automount-links.service - Monitor /media for mountpoints and create USBdrive* symlinks
Loaded: loaded (/usr/lib/systemd/system/nc-automount-links.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-03-14 11:41:38 UTC; 12h ago
Main PID: 402 (nc-automount-li)
CGroup: /system.slice/nc-automount-links.service
├─402 /bin/bash /usr/local/etc/nc-automount-links-mon
├─417 inotifywait --monitor --event create --event delete --format %f %e /media/
├─418 grep --line-buffered ISDIR
└─419 /bin/bash /usr/local/etc/nc-automount-links-mon

Mar 14 11:41:38 nextcloudpi systemd[1]: Started Monitor /media for mountpoints and create USBdrive* symli
Mar 14 11:41:38 nextcloudpi nc-automount-links-mon[402]: Setting up watches.
Mar 14 11:41:38 nextcloudpi nc-automount-links-mon[402]: Watches established.
Mar 14 11:41:41 nextcloudpi nc-automount-links-mon[402]: myCloudDrive DELETE,ISDIR
Mar 14 11:41:41 nextcloudpi nc-automount-links-mon[402]: myCloudDrive CREATE,ISDIR

I’m having issues with the Data directory as well. I’m running on an Odroid HC-1. I’ve tried the fsck command but it tells me /dev/sda1 is in use.

Any thoughts?
Here is nc-report

NextCloudPi diagnostics

NextCloudPi version  v0.47.1
NextCloudPi image    NextCloudPi_11-22-17
distribution         Debian GNU/Linux 9 \n \l
automount            yes
USB devices          sda
datadir              /media/myCloudDrive/ncdata (doesn't exist)
rootfs usage         1.8G/7.1G
swapfile             /var/swap
Nextcloud check      error
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
Postfix service      up
internet check       ok
port check 80        open
port check 443       open
IP                   192.168.1.102
gateway              192.168.1.1
interface            enx001e0630ca1a
certificates         none
certs due            none
NAT loopback         no
uptime               3min

Nextcloud configuration

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/13/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:148
Stack trace:
#0 /var/www/nextcloud/console.php(89): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#2 {main}
HTTPd logs

[Sat Mar 03 06:25:07.000434 2018] [core:notice] [pid 3942:tid 3070013440] AH00094: Command line: '/usr/sbin/apache2'
[Sat Mar 03 14:10:16.452323 2018] [log_config:warn] [pid 14605:tid 2699031600] (28)No space left on device: [client 73.176.95.6:54338] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:12:20.319521 2018] [log_config:warn] [pid 14605:tid 2673865776] (28)No space left on device: [client 73.176.95.6:54383] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:14:22.605201 2018] [log_config:warn] [pid 14605:tid 2841637936] (28)No space left on device: [client 73.176.95.6:54433] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:16:24.235928 2018] [log_config:warn] [pid 14605:tid 2791306288] (28)No space left on device: [client 73.176.95.6:54469] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:18:25.472811 2018] [log_config:warn] [pid 14605:tid 2799694896] (28)No space left on device: [client 73.176.95.6:54492] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:20:26.930225 2018] [log_config:warn] [pid 14605:tid 2757751856] (28)No space left on device: [client 73.176.95.6:54508] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:22:27.872345 2018] [log_config:warn] [pid 14605:tid 2740974640] (28)No space left on device: [client 73.176.95.6:54539] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:24:30.303743 2018] [log_config:warn] [pid 14605:tid 2715808816] (28)No space left on device: [client 73.176.95.6:54580] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:26:33.079268 2018] [log_config:warn] [pid 14605:tid 2690642992] (28)No space left on device: [client 73.176.95.6:54595] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:28:35.583215 2018] [log_config:warn] [pid 14605:tid 2648699952] (28)No space left on device: [client 73.176.95.6:54617] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:30:37.628115 2018] [log_config:warn] [pid 14605:tid 2816472112] (28)No space left on device: [client 73.176.95.6:54663] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:32:38.969159 2018] [log_config:warn] [pid 14605:tid 2782917680] (28)No space left on device: [client 73.176.95.6:54685] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:34:41.255853 2018] [log_config:warn] [pid 14605:tid 2766140464] (28)No space left on device: [client 73.176.95.6:54703] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:36:43.137842 2018] [log_config:warn] [pid 14605:tid 2724197424] (28)No space left on device: [client 73.176.95.6:54718] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:38:46.383287 2018] [log_config:warn] [pid 14605:tid 2690642992] (28)No space left on device: [client 73.176.95.6:54744] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:40:49.193276 2018] [log_config:warn] [pid 14605:tid 2665477168] (28)No space left on device: [client 73.176.95.6:54762] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:42:52.259785 2018] [log_config:warn] [pid 14605:tid 2640311344] (28)No space left on device: [client 73.176.95.6:54777] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Mar 03 14:44:54.058460 2018] [log_config:warn] [pid 14605:tid 2816472112] (28)No space left on device: [client 73.176.95.6:54795] AH00646: Error writing to /var/log/apache2/other_vhosts_access.log
[Sat Ma
Database logs


Nextcloud logs

tail: cannot open '/media/myCloudDrive/ncdata/nextcloud.log' for reading: No such file or directory

it happened to me as well. I remove everything. want to buy pi 3 + and try again.

your case is different. What is the output of lsblk -f?

Ok, the links part is not working for you. We have two options

  • make it work for you as soon as possible -> edit the file /var/www/nextcloud/config/config.php and fix the line datadir to point to /media/myCloudDrive/ncdata

  • help me see if I can reproduce the error on my pi and fix it for everybody

NAME FSTYPE LABEL UUID MOUNTPOINT
sda
└─sda1 btrfs myCloudDrive cd58e1a1-1f8f-4884-abf3-7eb59a2c45bc /media/myCloudDrive1
mmcblk1
└─mmcblk1p1 ext4 9c3994d1-1158-45c6-8ea4-271afd4ecf64 /

Seems somehow automount got mixed up and mounted a second data drive. I disable Automount in Webui, then rebooted and then re-enable automount. All is working again.

Sorry to have bothered you.
Robert

Thank you Robert.
I will try what you did.

Nacho, if you want my help in anyway please let me know.

Turns out Roberts method did not work for me unfortunately.

Nacho,
I havent changed my config yet so let me know what I can do to help you.

I think I was able to reproduce, so I am working on this now.

You can change your config to have your instance working again. In any case, it is recommended to use the labels but USBdrive should also work

Thanks for the help

1 Like

Hi Nacho,

Im glad to hear that.
I tried to change the config a little earlier but it says I dont have the permissions to change the config and when I try to change the permissions in the panel it wont work.

Do have any suggestions?

Thanks for all of your help by the way!

that’s ok then, let me push the fix, and we can try it see if it solves your issue.

stay tuned, I’ll write you in a couple hours

ok, I provided a fix for the issue that I could reproduce. Please upgrade to v0.47.3 with sudo ncp-update or similar, and reboot

if still doesn’t work, please output of ls -l /media

1 Like

It is back up and running!
Thank you very much sir!

What was the solution, if you dont mind me asking?