[Nextcloudpi] not starting anymore

Hi!
Without understanding why, after a reboot Nextcloudpi is suddenly not starting properly anymore.
This is the output of the system info in ncp-web:

|NextCloudPi version|v0.53.27|
|---|---|
|NextCloudPi image|NextCloudPi_12-04-17|
|distribution|Raspbian GNU/Linux 9 \n \l|
|automount|yes|
|USB devices|sda|
|datadir|/media/myCloudDrive/ncdata|
|data in SD|no|
|data filesystem|btrfs|
|data disk usage|94G/299G|
|rootfs usage|1.8G/15G|
|swapfile|/var/swap|
|Nextcloud check|error|
|HTTPD service|up|
|PHP service|up|
|MariaDB service|down|
|Redis service|up|
|Postfix service|up|
|internet check|ok|
|port check 80|open|
|port check 443|open|
|IP|192.168.178.15|
|gateway|192.168.178.1|
|interface|eth0|
|certificates|cloud.mydomain.de|
|NAT loopback|no|
|uptime|2min|

nc-datadir is pointing to /media/USBdrive/ncdata. This folder does also still exist and look fine when I look via ftp or ssh
However its output is

[ nc-datadir ]
Error reading data directory. Is NextCloud running and configured?

And nc-fix-permissions says “data dir not found”

I can still access the files via the NextCloud samby share. However nextcloud is not accessible via web browser. It just stays with a blank page.

Why is Nextcloud not starting anymore and why can’t it somehow not find my data directory?

Your database is down. Paste the output of sudo ncp-report and systemctl status mysqld, let’s see if we see something.

Thanks,

ncp-report:

NextCloudPi diagnostics

NextCloudPi version  v0.53.27
NextCloudPi image    NextCloudPi_12-04-17
distribution         Raspbian GNU/Linux 9 \n \l
automount            yes
USB devices          sda
datadir              /media/myCloudDrive/ncdata
data in SD           no
data filesystem      btrfs
data disk usage      94G/299G
rootfs usage         1.8G/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                   192.168.178.15
gateway              192.168.178.1
interface            eth0
certificates         cloud.mydomain.de
NAT loopback         no
uptime               0min

Nextcloud configuration

An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /var/www/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /var/www/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#6 /var/www/nextcloud/lib/private/DB/ConnectionFactory.php(152): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#7 /var/www/nextcloud/lib/private/Server.php(628): OC\DB\ConnectionFactory->getConnection('mysql', Array)
#8 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#9 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(116): Pimple\Container->offsetGet('OCP\\IDBConnecti...')
#10 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OCP\\IDBConnecti...')
#11 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(164): OC\ServerContainer->query('OCP\\IDBConnecti...')
#12 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(109): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#13 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(116): Pimple\Container->offsetGet('DatabaseConnect...')
#14 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...')
#15 /var/www/nextcloud/lib/private/Server.php(1511): OC\ServerContainer->query('DatabaseConnect...')
#16 /var/www/nextcloud/lib/private/Server.php(332): OC\Server->getDatabaseConnection()
#17 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#18 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(116): Pimple\Container->offsetGet('OC\\Authenticati...')
#19 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...')
#20 /var/www/nextcloud/lib/private/Server.php(336): OC\ServerContainer->query('OC\\Authenticati...')
#21 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#22 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(116): Pimple\Container->offsetGet('OC\\Authenticati...')
#23 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...')
#24 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(164): OC\ServerContainer->query('OC\\Authenticati...')
#25 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(109): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#26 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(116): Pimple\Container->offsetGet('OC\\Authenticati...')
#27 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...')
#28 /var/www/nextcloud/lib/private/Server.php(352): OC\ServerContainer->query('OC\\Authenticati...')
#29 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#30 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(116): Pimple\Container->offsetGet('OCP\\IUserSessio...')
#31 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OCP\\IUserSessio...')
#32 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(164): OC\ServerContainer->query('OCP\\IUserSessio...')
#33 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(109): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#34 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(116): Pimple\Container->offsetGet('UserSession')
#35 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('UserSession')
#36 /var/www/nextcloud/lib/private/Server.php(1380): OC\ServerContainer->query('UserSession')
#37 /var/www/nextcloud/lib/private/Server.php(688): OC\Server->getUserSession()
#38 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#39 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(116): Pimple\Container->offsetGet('OC\\App\\AppManag...')
#40 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\App\\AppManag...')
#41 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(164): OC\ServerContainer->query('OC\\App\\AppManag...')
#42 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(109): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#43 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(116): Pimple\Container->offsetGet('AppManager')
#44 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('AppManager')
#45 /var/www/nextcloud/lib/private/Server.php(1684): OC\ServerContainer->query('AppManager')
#46 /var/www/nextcloud/lib/private/legacy/app.php(332): OC\Server->getAppManager()
#47 /var/www/nextcloud/lib/private/legacy/app.php(113): OC_App::getEnabledApps()
#48 /var/www/nextcloud/lib/base.php(661): OC_App::loadApps(Array)
#49 /var/www/nextcloud/lib/base.php(1080): OC::init()
#50 /var/www/nextcloud/console.php(46): require_once('/var/www/nextcl...')
#51 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#52 {main}
HTTPd logs

[Mon Apr 16 01:47:50.914628 2018] [authz_host:error] [pid 976:tid 1969218608] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /minified.js failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:50.915030 2018] [authz_host:error] [pid 976:tid 1960830000] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /ncp.js failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:50.918804 2018] [authz_host:error] [pid 976:tid 1935664176] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /img/loading-small.gif failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:50.918826 2018] [authz_host:error] [pid 976:tid 1944052784] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /img/ncp-logo.svg failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:51.022619 2018] [authz_host:error] [pid 976:tid 1927275568] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /img/poweroff.svg failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:51.027290 2018] [authz_host:error] [pid 976:tid 1918886960] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /img/reboot.svg failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:51.066275 2018] [authz_host:error] [pid 976:tid 1910498352] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /core/img/actions/triangle-s.svg failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:51.067238 2018] [authz_host:error] [pid 976:tid 1902109744] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /img/nc-button.svg failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:51.068087 2018] [authz_host:error] [pid 976:tid 1893721136] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /img/dashboard.svg failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:51.068811 2018] [authz_host:error] [pid 976:tid 1885332528] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /img/settings-white.svg failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:51.069465 2018] [authz_host:error] [pid 976:tid 1876943920] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /img/wizard.svg failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:51.070745 2018] [authz_host:error] [pid 976:tid 1868555312] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /img/info-white.svg failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:51.085157 2018] [authz_host:error] [pid 976:tid 1860166704] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /ncp-output.php failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:51.100270 2018] [authz_host:error] [pid 976:tid 1851778096] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:52.009212 2018] [authz_host:error] [pid 976:tid 1843389488] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /favicon.ico failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:52.009792 2018] [authz_host:error] [pid 976:tid 1843389488] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /favicon.ico failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:52.175266 2018] [proxy_fcgi:error] [pid 976:tid 1860166704] [client 192.168.178.187:50091] AH01071: Got error 'PHP message: PHP Warning:  touch(): Utime failed: Permission denied in /var/www/ncp-web/ncp-output.php on line 81\n'
[Mon Apr 16 01:47:57.114457 2018] [proxy_fcgi:error] [pid 976:tid 1851778096] [client 192.168.178.187:50091] 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 163\n'
[Mon Apr 16 01:47:57.159916 2018] [authz_host:error] [pid 976:tid 1826612272] [client 192.168.178.187:50091] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Mon Apr 16 01:47:59.122374 2018] [proxy_fcgi:error] [pid 976:tid 1826612272] [client 192.168.178.187:50091] 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 163\n'

Database logs

key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 351335 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x0 thread_stack 0x30000
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
2018-04-16  1:48:03 1989095424 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2018-04-16  1:48:03 1989095424 [Note] InnoDB: The InnoDB memory heap is disabled
2018-04-16  1:48:03 1989095424 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-04-16  1:48:03 1989095424 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-04-16  1:48:03 1989095424 [Note] InnoDB: Compressed tables use zlib 1.2.8
2018-04-16  1:48:03 1989095424 [Note] InnoDB: Using Linux native AIO
2018-04-16  1:48:03 1989095424 [Note] InnoDB: Using generic crc32 instructions
2018-04-16  1:48:03 1989095424 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-04-16  1:48:03 1989095424 [Note] InnoDB: Completed initialization of buffer pool
2018-04-16 16:40:30 1989095424 [Note] InnoDB: Highest supported file format is Barracuda.

Nextcloud logs

{"reqId":"WtA2g38AAQEAAEhcLzAAAAAO","level":2,"time":"2018-04-13T04:48:03+00:00","remoteAddr":"18.194.122.105","user":"--","app":"core","method":"GET","url":"\/webman\/pingpong.php?action=cors","message":"Trusted domain error. \"18.194.122.105\" tried to access using \"217.230.113.166\" as host.","userAgent":"--","version":"13.0.1.1"}
{"reqId":"WtA2g38AAQEAAEhdpCUAAABG","level":2,"time":"2018-04-13T04:48:03+00:00","remoteAddr":"18.194.122.105","user":"--","app":"core","method":"GET","url":"\/webman\/pingpong.php?action=cors","message":"Trusted domain error. \"18.194.122.105\" tried to access using \"pigeldi.mooo.com\" as host.","userAgent":"--","version":"13.0.1.1"}
{"reqId":"WtBFOH8AAQEAAEhdpCYAAABH","level":2,"time":"2018-04-13T05:50:48+00:00","remoteAddr":"185.35.63.105","user":"--","app":"core","method":"GET","url":"\/","message":"Trusted domain error. \"185.35.63.105\" tried to access using \"syno.frhode.de\" as host.","userAgent":"jk","version":"13.0.1.1"}
{"reqId":"WtB1X38AAQEAAFVHZBAAAAAM","level":2,"time":"2018-04-13T09:16:15+00:00","remoteAddr":"46.17.47.102","user":"--","app":"core","method":"GET","url":"\/","message":"Trusted domain error. \"46.17.47.102\" tried to access using \"217.230.113.166\" as host.","userAgent":"libwww-perl\/6.31","version":"13.0.1.1"}
{"reqId":"WtB3Kn8AAQEAAFVHZBEAAAAN","level":2,"time":"2018-04-13T09:23:54+00:00","remoteAddr":"46.17.47.102","user":"--","app":"core","method":"GET","url":"\/","message":"Trusted domain error. \"46.17.47.102\" tried to access using \"217.230.113.166:443\" as host.","userAgent":"libwww-perl\/6.31","version":"13.0.1.1"}
{"reqId":"WtCwNH8AAQEAAFVHZBIAAAAO","level":2,"time":"2018-04-13T13:27:16+00:00","remoteAddr":"184.105.139.67","user":"--","app":"core","method":"GET","url":"\/","message":"Trusted domain error. \"184.105.139.67\" tried to access using \"217.230.113.166\" as host.","userAgent":"--","version":"13.0.1.1"}
{"reqId":"tP14Gpk7h3CGNj0h52lG","level":3,"time":"2018-04-13T15:00:21+00:00","remoteAddr":"","user":"--","app":"PHP","method":"--","url":"--","message":"PDOStatement::execute(): MySQL server has gone away at \/var\/www\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOStatement.php#105","userAgent":"--","version":"13.0.1.1"}
{"reqId":"tP14Gpk7h3CGNj0h52lG","level":3,"time":"2018-04-13T15:00:21+00:00","remoteAddr":"","user":"--","app":"PHP","method":"--","url":"--","message":"PDOStatement::execute(): Error reading result set's header at \/var\/www\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOStatement.php#105","userAgent":"--","version":"13.0.1.1"}
{"reqId":"tP14Gpk7h3CGNj0h52lG","level":4,"time":"2018-04-13T15:00:21+00:00","remoteAddr":"","user":"--","app":"cron","method":"--","url":"--","message":"An exception occurred while executing 'UPDATE `oc_jobs` SET `reserved_at` = ?, `last_checked` = ? WHERE (`id` = ?) AND (`reserved_at` = ?) AND (`last_checked` = ?)' with params [1523631604, 1523631604, \"5\", \"0\", \"1523630704\"]:\n\nSQLSTATE[HY000]: General error: 2006 MySQL server has gone away","userAgent":"--","version":"13.0.1.1"}
{"reqId":"WtEJ0n8AAQEAAFVI5TAAAABO","level":2,"time":"2018-04-13T19:49:39+00:00","remoteAddr":"155.94.222.12","user":"--","app":"core","method":"GET","url":"\/","message":"Trusted domain error. \"155.94.222.12\" tried to access using \"217.230.113.166\" as host.","userAgent":"Mozilla\/5.0 zgrab\/0.x","version":"13.0.1.1"}
{"reqId":"WtEk@H8AAQEAAFVI5TIAAABR","level":2,"time":"2018-04-13T21:45:28+00:00","remoteAddr":"139.162.116.133","user":"--","app":"core","method":"GET","url":"\/","message":"Trusted domain error. \"139.162.116.133\" tried to access using \"217.230.113.166\" as host.","userAgent":"Mozilla\/5.0 (Windows NT 10.0; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/50.0.2661.102 Safari\/537.36","version":"13.0.1.1"}
{"reqId":"WtGIBn8AAQEAAFVI5TMAAABU","level":2,"time":"2018-04-14T04:48:06+00:00","remoteAddr":"18.194.122.105","user":"--","app":"core","method":"GET","url":"\/webman\/pingpong.php?action=cors","message":"Trusted domain error. \"18.194.122.105\" tried to access using \"pigeldi.mooo.com\" as host.","userAgent":"--","version":"13.0.1.1"}
{"reqId":"WtGIBn8AAQEAAFVI5TMAAABV","level":2,"time":"2018-04-14T04:48:06+00:00","remoteAddr":"18.194.122.105","user":"--","app":"core","method":"GET","url":"\/webman\/pingpong.php?action=cors","message":"Trusted domain error. \"18.194.122.105\" tried to access using \"217.230.117.196\" as host.","userAgent":"--","version":"13.0.1.1"}
{"reqId":"WtGIHX8AAQEAAFVI5TYAAABY","level":2,"time":"2018-04-14T04:48:29+00:00","remoteAddr":"18.194.122.105","user":"--","app":"core","method":"GET","url":"\/webman\/pingpong.php?action=cors","message":"Trusted domain error. \"18.194.122.105\" tried to access using \"217.230.117.196\" as host.","userAgent":"--","version":"13.0.1.1"}
{"reqId":"WtGIHX8AAQEAAFVI5TcAAABA","level":2,"time":"2018-04-14T04:48:29+00:00","remoteAddr":"18.194.122.105","user":"--","app":"core","method":"GET","url":"\/webman\/pingpong.php?action=cors","message":"Trusted domain error. \"18.194.122.105\" tried to access using \"pigeldi.mooo.com\" as host.","userAgent":"--","version":"13.0.1.1"}
{"reqId":"WtJs738AAQEAAAOZweYAAAAN","level":2,"time":"2018-04-14T21:04:47+00:00","remoteAddr":"46.161.55.106","user":"--","app":"core","method":"GET","url":"\/_asterisk\/","message":"Trusted domain error. \"46.161.55.106\" tried to access using \"87.148.231.252\" as host.","userAgent":"python-requests\/2.18.4","version":"13.0.1.1"}
{"reqId":"WtKVWH8AAQEAAAOZwecAAAAP","level":2,"time":"2018-04-14T23:57:12+00:00","remoteAddr":"84.95.214.222","user":"--","app":"core","method":"GET","url":"\/cgi-bin\/webcm?getpage=..\/html\/menus\/menu2.html&var:lang=%26%20allcfgconv%20-C%20voip%20-c%20-o%20-%20..\/..\/..\/..\/..\/var\/tmp\/voip.cfg%20%26","message":"Trusted domain error. \"84.95.214.222\" tried to access using \"87.148.231.252\" as host.","userAgent":"Mozilla\/5.0 (Windows NT 6.2; WOW64; rv:37.0) Gecko\/20100101 Firefox\/37.0","version":"13.0.1.1"}
{"reqId":"RMPoAYzGYCqnR7EnD8CC","level":3,"time":"2018-04-15T00:15:23+00:00","remoteAddr":"","user":"--","app":"PHP","method":"--","url":"--","message":"PDOStatement::execute(): MySQL server has gone away at \/var\/www\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOStatement.php#105","userAgent":"--","version":"13.0.1.1"}
{"reqId":"RMPoAYzGYCqnR7EnD8CC","level":3,"time":"2018-04-15T00:15:23+00:00","remoteAddr":"","user":"--","app":"PHP","method":"--","url":"--","message":"PDOStatement::execute(): Error reading result set's header at \/var\/www\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/PDOStatement.php#105","userAgent":"--","version":"13.0.1.1"}
{"reqId":"RMPoAYzGYCqnR7EnD8CC","level":4,"time":"2018-04-15T00:15:24+00:00","remoteAddr":"","user":"--","app":"cron","method":"--","url":"--","message":"An exception occurred while executing 'UPDATE `oc_jobs` SET `reserved_at` = ?, `last_checked` = ? WHERE (`id` = ?) AND (`reserved_at` = ?) AND (`last_checked` = ?)' with params [1523751301, 1523751301, \"2\", \"0\", \"1523750404\"]:\n\nSQLSTATE[HY000]: General error: 2006 MySQL server has gone away","userAgent":"--","version":"13.0.1.1"}

systemctl status mysqld:
â—Ź mariadb.service - MariaDB database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset:
Active: activating (start) since Mon 2018-04-16 16:43:49 UTC; 54s ago
Process: 2311 ExecStartPre=/bin/sleep 20 (code=exited, status=0/SUCCESS)
Process: 2213 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR
Process: 2209 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START
Process: 2206 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/ru
Main PID: 2313 (mysqld)
CGroup: /system.slice/mariadb.service
└─2313 /usr/sbin/mysqld

Apr 16 16:43:49 nextcloudpi systemd[1]: Starting MariaDB database server…
Apr 16 16:44:11 nextcloudpi mysqld[2313]: 2018-04-16 16:44:11 1988579328 [Note]

Status of mariadb changes between up and down when sometimes updating the system info.

Your mariadb is crashing… I suspect a corrupt SD card. Try reinstalling with apt, but be careful not to remove the Nextcloud database, unless you have a backup.