NextCloudPi Crashes When Downloading Files

Hi, I just started trying NextCloudPi on a Raspberry Pi 3 a couple of days ago but I keep encountering some issues.

I installed NC 18 by flashing the official image into a micro SD card for the pi. I plugged a 500 GB hard drive through a powered USB hub connected to the pi. It is only accessible from within my house network. Also keep in mind that I have virtually no knowledge of system administration, servers, databases or the like. I know Python and zero php.

My issue is that the server seems very unstable and can crash by very simple actions. The most common is when I attempt to download an item from the server to my computer or to my phone using the app, the server will crash. However, it does not happen all the time. It seems to happen mainly when the file to download is bigger than 70 MB in size. In these cases, I need to reboot the pi and it will restart and everything is fine until I need to download a file again.

Sometimes when downloading multiple items, I will get a zip file containing only a subset of the files and sometimes some files like videos get partially downloaded.

Also, I’m not sure if it is related, but I can never play videos directly from the server and they don’t have thumbnails from the web view. A few times when I click on a video to stream from the server, it will only playback the first 1 or 2 seconds and stop or the server crashes completely.

Just now I attempted to download a 90 MB video file that I have on the server and it only managed to download a few seconds (only 7 MB) and then the server crashed with the following message on the web view:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.


Below I am including the output of running sudo ncp-report on the pi through ssh right after the crash and before rebooting. I can see that it says it cannot find a file for datadir nor dbdir. However, when I followed the setup wizard it seemed to configure the disk correctly and I:

<–! Paste this in GitHub report -->

NextCloudPi diagnostics

PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"volVf4DBID73lxqzOm2j","level":3,"time":"2019-11-09T03:29:53+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/myCloudDrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#140","userAgent":"--","version":"16.0.3.0"}
{"reqId":"volVf4DBID73lxqzOm2j","level":2,"time":"2019-11-09T03:29:53+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory \/media\/myCloudDrive\/ncdata\/tmp is not present or writable","userAgent":"--","version":"16.0.3.0"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"volVf4DBID73lxqzOm2j","level":3,"time":"2019-11-09T03:29:54+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"file_get_contents(\/media\/myCloudDrive\/ncdata\/news\/config\/config.ini): failed to open stream: No such file or directory at \/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Local.php#217","userAgent":"--","version":"16.0.3.0"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"volVf4DBID73lxqzOm2j","level":3,"time":"2019-11-09T03:29:54+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/myCloudDrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#140","userAgent":"--","version":"16.0.3.0"}
{"reqId":"volVf4DBID73lxqzOm2j","level":2,"time":"2019-11-09T03:29:54+00:00","remoteAddr":"","user":"--","app":"news","method":"","url":"--","message":"Configuration invalid. Ignoring values.","userAgent":"--","version":"16.0.3.0"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"volVf4DBID73lxqzOm2j","level":3,"time":"2019-11-09T03:29:54+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"mkdir(): Permission denied at \/var\/www\/nextcloud\/apps\/news\/lib\/AppInfo\/Application.php#141","userAgent":"--","version":"16.0.3.0"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"volVf4DBID73lxqzOm2j","level":3,"time":"2019-11-09T03:29:54+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/myCloudDrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#140","userAgent":"--","version":"16.0.3.0"}
{"reqId":"volVf4DBID73lxqzOm2j","level":3,"time":"2019-11-09T03:29:54+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"chmod(): No such file or directory at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#141","userAgent":"--","version":"16.0.3.0"}
NextCloudPi version  v1.18.0
NextCloudPi image    NextCloudPi_07-21-19
distribution         Raspbian GNU/Linux 10 \n \l
automount            yes
USB devices          sdb
datadir              /media/myCloudDrive/ncdata (doesn't exist)
rootfs usage         2.0G/15G
swapfile             /var/swap
dbdir                /media/USBdrive/ncdatabase (doesn't exist)
Nextcloud check      error
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
Postfix service      up
internet check       ok
port check 80        closed
port check 443       closed
IP                   ***REMOVED SENSITIVE VALUE***
gateway              ***REMOVED SENSITIVE VALUE***
interface            eth0
certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
uptime               17min

Nextcloud configuration

PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"z4HDUuwShkN9QGVrsQqw","level":3,"time":"2019-11-09T03:30:00+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/myCloudDrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#140","userAgent":"--","version":"16.0.3.0"}
{"reqId":"z4HDUuwShkN9QGVrsQqw","level":2,"time":"2019-11-09T03:30:00+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory \/media\/myCloudDrive\/ncdata\/tmp is not present or writable","userAgent":"--","version":"16.0.3.0"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"z4HDUuwShkN9QGVrsQqw","level":3,"time":"2019-11-09T03:30:01+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"file_get_contents(\/media\/myCloudDrive\/ncdata\/news\/config\/config.ini): failed to open stream: No such file or directory at \/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Local.php#217","userAgent":"--","version":"16.0.3.0"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"z4HDUuwShkN9QGVrsQqw","level":3,"time":"2019-11-09T03:30:01+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/myCloudDrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#140","userAgent":"--","version":"16.0.3.0"}
{"reqId":"z4HDUuwShkN9QGVrsQqw","level":2,"time":"2019-11-09T03:30:01+00:00","remoteAddr":"","user":"--","app":"news","method":"","url":"--","message":"Configuration invalid. Ignoring values.","userAgent":"--","version":"16.0.3.0"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"z4HDUuwShkN9QGVrsQqw","level":3,"time":"2019-11-09T03:30:01+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"mkdir(): Permission denied at \/var\/www\/nextcloud\/apps\/news\/lib\/AppInfo\/Application.php#141","userAgent":"--","version":"16.0.3.0"}
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/16/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:166
Stack trace:
#0 /var/www/nextcloud/console.php(96): 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}PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"z4HDUuwShkN9QGVrsQqw","level":3,"time":"2019-11-09T03:30:02+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/myCloudDrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#140","userAgent":"--","version":"16.0.3.0"}
{"reqId":"z4HDUuwShkN9QGVrsQqw","level":3,"time":"2019-11-09T03:30:02+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"chmod(): No such file or directory at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#141","userAgent":"--","version":"16.0.3.0"}

HTTPd logs

[Fri Nov 08 01:17:50.205638 2019] [mpm_event:notice] [pid 761:tid 1995973136] AH00489: Apache/2.4.38 (Raspbian) OpenSSL/1.1.1c configured -- resuming normal operations
[Fri Nov 08 01:17:50.205780 2019] [core:notice] [pid 761:tid 1995973136] AH00094: Command line: '/usr/sbin/apache2'
[Fri Nov 08 20:03:26.047467 2019] [mpm_event:notice] [pid 761:tid 1995973136] AH00491: caught SIGTERM, shutting down
[Fri Nov 08 20:03:42.576906 2019] [ssl:warn] [pid 590:tid 1995891216] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 08 20:03:42.582695 2019] [ssl:error] [pid 590:tid 1995891216] AH02217: ssl_stapling_init_cert: can't retrieve issuer certificate! [subject: CN=archlinux / issuer: CN=archlinux / serial: 4D0D69071A363DCC66467D909ABB2563623E84FC / notbefore: Jul 21 02:33:51 2019 GMT / notafter: Jul 18 02:33:51 2029 GMT]
[Fri Nov 08 20:03:42.583229 2019] [ssl:error] [pid 590:tid 1995891216] AH02604: Unable to configure certificate localhost:4443:0 for stapling
[Fri Nov 08 20:03:42.641251 2019] [ssl:warn] [pid 767:tid 1995891216] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 08 20:03:42.641844 2019] [ssl:error] [pid 767:tid 1995891216] AH02217: ssl_stapling_init_cert: can't retrieve issuer certificate! [subject: CN=archlinux / issuer: CN=archlinux / serial: 4D0D69071A363DCC66467D909ABB2563623E84FC / notbefore: Jul 21 02:33:51 2019 GMT / notafter: Jul 18 02:33:51 2029 GMT]
[Fri Nov 08 20:03:42.641937 2019] [ssl:error] [pid 767:tid 1995891216] AH02604: Unable to configure certificate localhost:4443:0 for stapling
[Fri Nov 08 20:03:42.647572 2019] [mpm_event:notice] [pid 767:tid 1995891216] AH00489: Apache/2.4.38 (Raspbian) OpenSSL/1.1.1c configured -- resuming normal operations
[Fri Nov 08 20:03:42.647742 2019] [core:notice] [pid 767:tid 1995891216] AH00094: Command line: '/usr/sbin/apache2'
[Fri Nov 08 23:12:44.895274 2019] [mpm_event:notice] [pid 767:tid 1995891216] AH00491: caught SIGTERM, shutting down
[Fri Nov 08 23:13:01.465203 2019] [ssl:warn] [pid 571:tid 1995833872] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 08 23:13:01.469689 2019] [ssl:error] [pid 571:tid 1995833872] AH02217: ssl_stapling_init_cert: can't retrieve issuer certificate! [subject: CN=archlinux / issuer: CN=archlinux / serial: 4D0D69071A363DCC66467D909ABB2563623E84FC / notbefore: Jul 21 02:33:51 2019 GMT / notafter: Jul 18 02:33:51 2029 GMT]
[Fri Nov 08 23:13:01.469771 2019] [ssl:error] [pid 571:tid 1995833872] AH02604: Unable to configure certificate localhost:4443:0 for stapling
[Fri Nov 08 23:13:01.517401 2019] [ssl:warn] [pid 752:tid 1995833872] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 08 23:13:01.518343 2019] [ssl:error] [pid 752:tid 1995833872] AH02217: ssl_stapling_init_cert: can't retrieve issuer certificate! [subject: CN=archlinux / issuer: CN=archlinux / serial: 4D0D69071A363DCC66467D909ABB2563623E84FC / notbefore: Jul 21 02:33:51 2019 GMT / notafter: Jul 18 02:33:51 2029 GMT]
[Fri Nov 08 23:13:01.518416 2019] [ssl:error] [pid 752:tid 1995833872] AH02604: Unable to configure certificate localhost:4443:0 for stapling
[Fri Nov 08 23:13:01.525491 2019] [mpm_event:notice] [pid 752:tid 1995833872] AH00489: Apache/2.4.38 (Raspbian) OpenSSL/1.1.1c configured -- resuming normal operations
[Fri Nov 08 23:13:01.525687 2019] [core:notice] [pid 752:tid 1995833872] AH00094: Command line: '/usr/sbin/apache2'

Database logs

Resource Limits:
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             7732                 7732                 processes
Max open files            16364                16364                files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       7732                 7732                 signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us
Core pattern: core


Nextcloud logs

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

When I go to the admin panel on the web view I see under CONFIG in nc-datadir a green text “path exists”. The same with nc-database. However, if I click on the little refresh button, the path to nc-database changes to “/var/lib/mysql” and the text is now in red and says that the path does not exist. I will add some captures below in case they are helpful:

I should also add that uploading to the server has not caused issues so far, or none that I have noticed except once when it crashed while trying to upload about 50 files and 3 GB total but I uploaded them in three parts and everything was fine after.

I will appreciate any help I can get. It would be great to get this working reliably to have my own private cloud.

I’d check the powersource and
try using a self powered hub to see if that resolves the issue.

1 Like