Problem with nextcloudpi after reboot

Hi,

I had issues with my NCP server lately, such as 503 error for some apps (calendar, task, the monitor section in the admin page, and a few others).
So I just thought that rebooting might fix this. So I reboot with sudo reboot, but then I can’t connect to the server anymore.

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/12/go.php?to=admin-dir_permissions

I believe there is an issue with the datadir, and I tried to change the name of the datadir in the web admin GUI (which I have access to), but I have an error: Error reading data directory. Is NextCloud running and configured?

I guess there is not much to do to fix this issue, since my ncdata are under the wrong directory, but I wouldn’t risk trying something I’m unsure.

I’m thinking of doing a mv /media/myCloudDrive/ncdata /media/USBdrive/ncdata or something with ln.
Or maybe a cp would be safer ?
Could anyone gives me some insights on this ?

Any help appreciated ! @nachoparker or anyone else.

Thanks.
Here is the output of ncp-report:

    <--! Paste this in GitHub report -->

    <details>
    <summary>NextCloudPi diagnostics</summary>

    ```


    NextCloudPi version  v0.44.15
    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         2.1G/3.6G
    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.0.4
    gateway              192.168.0.254
    interface            eth0
    certificates         none
    certs due            none
    NAT loopback         no
    uptime               47min

    ```
    </details>


    <details>
    <summary>Nextcloud configuration</summary>

    ```

    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/12/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:145
    Stack trace:
    #0 /var/www/nextcloud/console.php(99): 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}
    ```
    </details>


    <details>
    <summary>HTTPd logs</summary>

    ```

    [Sun Jan 21 22:20:11.601834 2018] [authz_host:error] [pid 753:tid 1876509744] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /wizard/ failed, reason: unable to get the remote host name
    [Sun Jan 21 22:20:11.606115 2018] [authz_host:error] [pid 753:tid 1876509744] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /wizard/index.php failed, reason: unable to get the remote host name
    [Sun Jan 21 22:20:11.816343 2018] [authz_host:error] [pid 753:tid 1876509744] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /wizard/index.php failed, reason: unable to get the remote host name
    [Sun Jan 21 22:20:12.628906 2018] [authz_host:error] [pid 753:tid 1884898352] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /wizard/bootstrap/css/bootstrap.min.css failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:12.628923 2018] [authz_host:error] [pid 753:tid 1826178096] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /wizard/img/nc-logo.png failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:12.629553 2018] [authz_host:error] [pid 753:tid 1801012272] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /wizard/img/ncp-logo.svg failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:12.629927 2018] [authz_host:error] [pid 753:tid 1792623664] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /wizard/JS/wizard.js failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:12.630025 2018] [authz_host:error] [pid 753:tid 1809400880] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /wizard/bootstrap/js/bootstrap.min.js failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:12.630177 2018] [authz_host:error] [pid 753:tid 1817789488] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /wizard/JS/jquery.bootstrap.wizard.js failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:12.630287 2018] [authz_host:error] [pid 753:tid 1834566704] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /wizard/JS/jquery-latest.js failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:12.630512 2018] [authz_host:error] [pid 753:tid 1985561648] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /wizard/CSS/wizard.css failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:12.788040 2018] [authz_host:error] [pid 753:tid 1977173040] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /img/menu.svg failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/CSS/wizard.css
    [Sun Jan 21 22:20:12.888780 2018] [authz_host:error] [pid 753:tid 1968784432] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /ncp-output.php failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:23.520143 2018] [authz_host:error] [pid 753:tid 1918452784] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:44.889126 2018] [authz_host:error] [pid 753:tid 1952007216] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:45.160871 2018] [authz_host:error] [pid 753:tid 1952007216] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:45.161683 2018] [authz_host:error] [pid 753:tid 1952007216] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /index.php failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:45.380669 2018] [authz_host:error] [pid 753:tid 1952007216] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /index.php failed, reason: unable to get the remote host name, referer: https://nextcloudpi.local:4443/wizard/
    [Sun Jan 21 22:20:46.022198 2018] [authz_host:error] [pid 753:tid 1842955312] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /ncp-output.php failed, reason: unable to get the remote host name
    [Sun Jan 21 22:21:04.747221 2018] [authz_host:error] [pid 753:tid 1784235056] [client 192.168.0.5:53212] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name

    ```
    </details>


    <details>
    <summary>Database logs</summary>

    ```

    2018-01-21 21:34:05 1977856832 [Note] /usr/sbin/mysqld: Shutdown complete

    2018-01-21 21:34:40 1988874240 [Note] InnoDB: Using mutexes to ref count buffer pool pages
    2018-01-21 21:34:40 1988874240 [Note] InnoDB: The InnoDB memory heap is disabled
    2018-01-21 21:34:40 1988874240 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2018-01-21 21:34:40 1988874240 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
    2018-01-21 21:34:40 1988874240 [Note] InnoDB: Compressed tables use zlib 1.2.8
    2018-01-21 21:34:40 1988874240 [Note] InnoDB: Using Linux native AIO
    2018-01-21 21:34:40 1988874240 [Note] InnoDB: Using generic crc32 instructions
    2018-01-21 21:34:40 1988874240 [Note] InnoDB: Initializing buffer pool, size = 128.0M
    2018-01-21 21:34:40 1988874240 [Note] InnoDB: Completed initialization of buffer pool
    2018-01-21 21:34:40 1988874240 [Note] InnoDB: Highest supported file format is Barracuda.
    2018-01-21 21:34:41 1988874240 [Note] InnoDB: 128 rollback segment(s) are active.
    2018-01-21 21:34:41 1988874240 [Note] InnoDB: Waiting for purge to start
    2018-01-21 21:34:41 1988874240 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.35-80.0 started; log sequence number 615849517
    2018-01-21 21:34:41 1447031616 [Note] InnoDB: Dumping buffer pool(s) not yet started
    2018-01-21 21:34:41 1988874240 [Note] Plugin 'FEEDBACK' is disabled.
    2018-01-21 21:34:41 1988874240 [Note] Server socket created on IP: '127.0.0.1'.
    2018-01-21 21:34:41 1988874240 [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

    ```
    </details>


    <details>
    <summary>Nextcloud logs</summary>

    ```

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

    ```
    </details>

no one here can tell me what I can do or what I can’t do ?

I eventually chose the option of changing the path in the config file. (/var/www/nextcloud/config.php), in the lines corresponding to 'datadirectory' and 'logfile'.

So, it worked, I had bunch of errors in the admin panels, probably due to the fact that everything was not running in the correct place. Errors disappeared after a while.

Only one error remains in the log:
Temporary directory /media/USBdrive/ncdata/tmp is not present or writable
Which is the former location, but I can’t find where to change that.

I have an update to 12.0.5, I’ll try to update and see if it solves this latter error.

So I updated to 12.0.5. But I still have the error (which is just a Warning actually). But it’s annoying since I have this warning for every interaction that any of my computers have with nextcloud. For instance, if I have the activity monitor panel in the admin tab open, I have this kind of log every second the activity panel refreshes to draw the graph.

Any idea how to get rid of this ?

hi,

sorry I have been traveling for a few weeks.

your solution is right. Probably you run into some glitch with the old version of nc-automount. I guess you had a amazing uptime!

for the temporary dir you have to edit /etc/php/7.0/fpm/php.ini, the entry is called upload_tmp_dir

please, mark as solved if it works

Hi,

Thanks for reply. Can you comment on the mv / cp solutions, would those have worked ?

I’ve modified the php.ini file but I still have the same error in the log. Should I reboot or something ?

Thanks

yes, reboot to apply the change

Ok thank you very much !