Script nc-datadir fails

I had a hardisk formated with ext4 and named DATA-SERVER connected to my Odroid XU4 while installing Nextcloud. The installation script asked, if I wanted to have my datadir on my harddisk and I said yes and the script continued.

After activating there was an error in nc-info: “nextcloud not running”. Datadir failure. Ok, we do it again: call nc-config, chose datadir and the window shows:
/media/DATA-SERVER/ncdata. Running the script shows some lines, where I can read “USBdrive” instead of “DATA-SERVER” and the server has still this datadir-failure. I called the script and logged:
NextCloudPi configuratione

Note that non Unix filesystems such as NTFS are not supported
because they do not provide a compatible user/permissions system                
                                           
<Nein>

Launching nc-datadir
Cannot load Zend OPcache - it was already loaded
PHP Warning:  fileperms(): stat failed for /media/USBdrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 137
{"reqId":"h4hg6pvx6513rcsLhvDG","level":3,"time":"2018-11-14T13:09:50+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/USBdrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#137","userAgent":"--","version":"14.0.3.0"}
{"reqId":"h4hg6pvx6513rcsLhvDG","level":2,"time":"2018-11-14T13:09:50+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":"14.0.3.0"}
PHP Warning:  fileperms(): stat failed for /media/USBdrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 137
{"reqId":"h4hg6pvx6513rcsLhvDG","level":3,"time":"2018-11-14T13:09:51+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#216","userAgent":"--","version":"14.0.3.0"}
PHP Warning:  fileperms(): stat failed for /media/USBdrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 137
{"reqId":"h4hg6pvx6513rcsLhvDG","level":3,"time":"2018-11-14T13:09:51+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/USBdrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#137","userAgent":"--","version":"14.0.3.0"}
{"reqId":"h4hg6pvx6513rcsLhvDG","level":2,"time":"2018-11-14T13:09:51+00:00","remoteAddr":"","user":"--","app":"news","method":"","url":"--","message":"Configuration invalid. Ignoring values.","userAgent":"--","version":"14.0.3.0"}
PHP Warning:  fileperms(): stat failed for /media/USBdrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 137
{"reqId":"h4hg6pvx6513rcsLhvDG","level":3,"time":"2018-11-14T13:09:51+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"mkdir(): Permission denied at \/var\/www\/nextcloud\/apps\/news\/lib\/AppInfo\/Application.php#143","userAgent":"--","version":"14.0.3.0"}
PHP Warning:  fileperms(): stat failed for /media/USBdrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 137
{"reqId":"h4hg6pvx6513rcsLhvDG","level":3,"time":"2018-11-14T13:09:51+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/USBdrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#137","userAgent":"--","version":"14.0.3.0"}
{"reqId":"h4hg6pvx6513rcsLhvDG","level":3,"time":"2018-11-14T13:09:51+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"chmod(): No such file or directory at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#138","userAgent":"--","version":"14.0.3.0"}
Error reading data directory. Is NextCloud running and configured?
Done. Press any key...

Why can I not run the script “nc-datadir” with “bash nc-datadir” (in /usr/local/etc/nc-config.d)??

Spielmops

Found the workaround myself:
in file /var/www/nextcloud/config/config.php there are two lines with “USBdrive” in it. I changed that to my “DATA-SERVER” and executed ncp-config/nc-datadir. All Ok. After the edit the file should still be owned by the user “www-data”.

But it is still a “workaround”! And there is at least one script running, that writes a directory “USBdrive” in the harddisk’s root.

Spielmops

continuation:

I searched further for scripts writing “USBdrive” to my harddisk. And I found:
“USBdrive” is written in:

/var/www/ncp-web/wizard/JS/wizard.js

in line 185

/etc/php/7.2/mods-available/opcache.ini

in line 10

/etc/php/7.2/fpm/php.ini

in line 821

/etc/php/7.2/cli/php.ini

also in line 821

  • And -as a reminder - “USBdrive” was in

/var/www/nextcloud/config/config.php
in lines 13 and 41

I could not find any author-name who is to blame for that.

Spielmops