[NCP] NextCloud and MariaDB down

Hello,
I have nextcloutpi running on a raspberry pi for a longer time already.
A few days ago nextcloud and the database were suddenly down, I did not change anything.

NextCloudPi version v0.67.5
NextCloudPi image NextCloudPi_03-18-18
distribution Raspbian GNU/Linux 9 \n \l
automount yes
USB devices sda
datadir /media/USBdrive/ncdata
data in SD no
data filesystem btrfs
data disk usage 463G/1.9T
rootfs usage 1.9G/15G
swapfile /var/swap
dbdir /media/USBdrive/ncdatabase
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 22:53

Also a restart does not change anything.
I have an older backup of the SD card from the time I was using nextcloud 13. When I loaded that on a new SD card, Nextcloud started and MariaDB were up, but the database was not used (“dbdir does not exist”), so nextcloud did not knew any users and I could not log on. Also the lets encrypt script in ncp-web threw an error:
./letsencrypt.sh: line 63: letsencrypt: command not found.

Long story short, any way to get things up again? I am even struggling with finding out why database and nextcloud do not start. Luckily I can still access my files via samba and nfs.

systemctl status mariadb.service shows

mariadb.service - MariaDB 10.1.37 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-12-01 08:15:05 UTC; 1 day 6h ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 825 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 574 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=/usr/bin/galera_recovery; [ $? -eq 0 ] && syste
Process: 535 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 524 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 825 (code=exited, status=1/FAILURE)
Status: “MariaDB server is down”

Dec 01 08:15:02 nextcloudpi systemd[1]: Starting MariaDB 10.1.37 database server…
Dec 01 08:15:04 nextcloudpi mysqld[825]: 2018-12-01 8:15:04 1996299680 [Note] /usr/sbin/mysqld (mysqld 10.1.37-MariaDB-0+deb9u1) starting as
Dec 01 08:15:04 nextcloudpi mysqld[825]: 2018-12-01 8:15:04 1996299680 [Warning] Can’t create test file /media/USBdrive/ncdatabase/nextcloud
Dec 01 08:15:04 nextcloudpi mysqld[825]: [102B blob data]
Dec 01 08:15:04 nextcloudpi mysqld[825]: 2018-12-01 8:15:04 1996299680 [ERROR] Aborting
Dec 01 08:15:05 nextcloudpi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Dec 01 08:15:05 nextcloudpi systemd[1]: Failed to start MariaDB 10.1.37 database server.
Dec 01 08:15:05 nextcloudpi systemd[1]: mariadb.service: Unit entered failed state.
Dec 01 08:15:05 nextcloudpi systemd[1]: mariadb.service: Failed with result ‘exit-code’.

Thanks for any help! :slight_smile:

This looks to me like mariadb expects an external USB disk drive, and can’t find it.

That makes no sense to me, but now I see that also nc-fix-permissions says „data dir not found„.
How can this be? The drive is mounted, I can access it via samba, nfs and ftp, why should it suddenly not be accessible to ncp anymore?

Are you using more than one external drive? If so check out this wiki page.
What is output of:

ls -lh /media/

and

df -h

No, there is just one single usb drive attached and that never changed. I could provide the output of the commands this evening when I am at home again.

Maybe same issue i had:
https://help.nextcloud.com/t/after-last-update-mariadb-doesnt-start-after-reboot/42092/2

Thanks, that sounds like a possible candidate, so it would have tried to access the mounted drive before it was actually mounted?! (although I would then expect that many more people have the issue, unless they did not reboot for a long time).
Can you help me out where the file is that I need to maintain?

When i am home again i will do.

ok, back home now…

try following:

ssh into your pi
following commands with sudo or go root:

systemctl disable mariadb
cp /lib/systemd/system/mariadb.service /etc/systemd/system/mariadb.service 
nano /etc/systemd/system/mariadb.service

paste ExecStartPre=/bin/sleep 20 between this lines:

ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
***!HERE!***
ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \
 VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] \
 && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1"

systemctl daemon-reload
systemctl enable mariadb.service

reboot

copying the .service file to /etc/systemd/system will override the system default in /lib/systemd/system, so when the default file will get an update it will not been loaded by your system.
Clean solution would be a correct update by the distribution (does it come upstream from armbian?)

3 Likes

Hooray, that works!
Thank you very much, I would not have figured that out. Nextcloud running again, time for a full backup :slight_smile:

Many thanks. Issue seemed to have surfaced after updating to v0.67.8 for me.

are you using automount?

@pigeldi @jdc7789

can you share the contents of /lib/systemd/system/mariadb.service?

Yes, using automount and DB on USB disk.

Here’s the file after adding the command referred above…

/etc/systemd/system/mariadb.service

This file is free software; you can redistribute it and/or modify it

under the terms of the GNU Lesser General Public License as published by

the Free Software Foundation; either version 2.1 of the License, or

(at your option) any later version.

Thanks to:

Daniel Black

Erkan Yanar

David Strauss

and probably others

[Unit]
Description=MariaDB 10.1.37 database server
Documentation=man:mysqld(8)
Documentation=https://mariadb.com/kb/en/library/systemd/
After=network.target

[Install]
WantedBy=multi-user.target
Alias=mysql.service
Alias=mysqld.service

[Service]

##############################################################################

Core requirements

Type=notify

Setting this to true can break replication and the Type=notify settings

See also bind-address mysqld option.

PrivateNetwork=false

##############################################################################

Package maintainers

User=mysql
Group=mysql

To allow memlock to be used as non-root user if set in configuration

CapabilityBoundingSet=CAP_IPC_LOCK

Prevent writes to /usr, /boot, and /etc

ProtectSystem=full

Doesn’t yet work properly with SELinux enabled

NoNewPrivileges=true

PrivateDevices=true

Prevent accessing /home, /root and /run/user

ProtectHome=true

Execute pre and post scripts as root, otherwise it does it as User=

PermissionsStartOnly=true

ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld

Perform automatic wsrep recovery. When server is started without wsrep,

galera_recovery simply returns an empty string. In any case, however,

the script is not expected to return with a non-zero status.

It is always safe to unset _WSREP_START_POSITION environment variable.

Do not panic if galera_recovery script is not available. (MDEV-10538)

ExecStartPre=/bin/sh -c “systemctl unset-environment _WSREP_START_POSITION”
ExecStartPre=/bin/sh -c “[ ! -e /usr/bin/galera_recovery ] && VAR= ||
VAR=/usr/bin/galera_recovery; [ $? -eq 0 ]
&& systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1”

Needed to create system tables etc.

ExecStartPre=/usr/bin/mysql_install_db -u mysql

Start main service

MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf

Use the [Service] section and Environment=“MYSQLD_OPTS=…”.

This isn’t a replacement for my.cnf.

_WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster

ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
ExecStartPost=/etc/mysql/debian-start

Unset _WSREP_START_POSITION environment variable.

ExecStartPost=/bin/sh -c “systemctl unset-environment _WSREP_START_POSITION”

KillSignal=SIGTERM

Don’t want to see an automated SIGKILL ever

SendSIGKILL=no

Restart crashed server only, on-failure would also restart, for example, when

my.cnf contains unknown option

Restart=on-abort
RestartSec=5s

UMask=007

##############################################################################

USERs can override

by creating a file in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf

and adding/setting the following under [Service] will override this file’s

settings.

Useful options not previously available in [mysqld_safe]

Kernels like killing mysqld when out of memory because its big.

Lets temper that preference a little.

OOMScoreAdjust=-600

Explicitly start with high IO priority

BlockIOWeight=1000

If you don’t use the /tmp directory for SELECT … OUTFILE and

LOAD DATA INFILE you can enable PrivateTmp=true for a little more security.

PrivateTmp=false

Options previously available to be set via [mysqld_safe]

that now needs to be set by systemd config files as mysqld_safe

isn’t executed.

Number of files limit. previously [mysqld_safe] open-file-limit

LimitNOFILE=16364

Maximium core size. previously [mysqld_safe] core-file-size

LimitCore=

Nice priority. previously [mysqld_safe] nice

Nice=-5

Timezone. previously [mysqld_safe] timezone

Environment=“TZ=UTC”

Library substitutions. previously [mysqld_safe] malloc-lib with explicit paths

(in LD_LIBRARY_PATH) and library name (in LD_PRELOAD).

Environment=“LD_LIBRARY_PATH=/path1 /path2” "LD_PRELOAD=

Flush caches. previously [mysqld_safe] flush-caches=1

ExecStartPre=sync

ExecStartPre=sysctl -q -w vm.drop_caches=3

numa-interleave=1 equalivant

Change ExecStart=numactl --interleave=all /usr/sbin/mysqld…

crash-script equalivent

FailureAction=

Thanks. This also fixed my problem. NextcloudPi wasn’t running since end of november.
Launching nc-info
Gathering information…
NextCloudPi version v0.67.8
NextCloudPi image NextCloudPi_02-06-18
distribution Raspbian GNU/Linux 9 \n \l
automount yes
USB devices sda
datadir /media/USBdrive/ncdata
data in SD no
data filesystem ext2/ext3
data disk usage 74G/2.7T
rootfs usage 2.0G/15G
swapfile /media/c9af4f9f-f6c6-4304-b1b9-38c32ac2569a/swap
dbdir /media/USBdrive/ncdatabase
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

fixed in v1.3.6. This shouldn’t get overriden again

Hello I 'm quite new to the NextCloud community and have the same problem described above.

NCP was working fine for quite some time now but since late August it is down.
I can access the NCP WebUI but not the Nextcloud WebUI (page stays blanc)
I have mount on the RaspberryPi one single external USB disk drive with my data (hopefully not lost)

I tried to fix it as described but had no luck.

here my configuration

NextCloudPi version v1.15.3
NextCloudPi image NextCloudPi_03-04-19
distribution Raspbian GNU/Linux 9 \n \l
automount yes
USB devices sda
datadir /media/USBdrive/ncdata (doesn’t exist)
rootfs usage 2.7G/7.3G
swapfile /var/swap
dbdir /media/USBdrive/ncdatabase (doesn’t exist)
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.XX.XX
gateway 192.168.XX.XX
interface eth0
certificates XXXXXX.ddns.net
NAT loopback no
uptime 30min

systemctl status mariadb.service shows

● mariadb.service - MariaDB 10.1.37 database server
Loaded: loaded (/etc/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─ncp-delay-automount.conf
Active: activating (start-pre) since Sun 2019-09-29 01:10:45 BST; 9s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 18172 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 18169 ExecStartPre=/bin/sleep 20 (code=exited, status=0/SUCCESS)
Process: 18044 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=/usr/bin/galera_recovery; [ $? -eq 0 ] && systemctl set-envir
Process: 18211 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 18208 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 18172 (code=exited, status=1/FAILURE); Control PID: 18215 (sleep)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/mariadb.service
└─control
└─18215 /bin/sleep 20

As i say i tried the solution nachoparker described but it still not working

Thanks for any help!

your hard drive is having some problem, maybe it’s not mounting. Try to mount it manually, maybe will need to fix it.

i’m quite new here so be patient, can you help me manually mount the drive?

after some trial and error the status is that mariadb is running but nextcloud not

Running nc-info
<–! Paste this in GitHub report -->

NextCloudPi diagnostics

Cannot load Zend OPcache - it was already loaded
NextCloudPi version  v1.15.3
NextCloudPi image    NextCloudPi_03-04-19
distribution         Raspbian GNU/Linux 9 \n \l
automount            yes
USB devices          sda
datadir              /media/USBdrive/ncdata (doesn't exist)
rootfs usage         2.2G/7.3G
swapfile             /var/swap
dbdir                /media/USBdrive/ncdatabase
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                   ***REMOVED SENSITIVE VALUE***
gateway              ***REMOVED SENSITIVE VALUE***
interface            eth0
certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
uptime               1:16

Nextcloud configuration

Cannot load Zend OPcache - it was already loaded
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1698] Access denied for user 'ncadmin'@'localhost' 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(158): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#7 /var/www/nextcloud/lib/private/Server.php(641): OC\DB\ConnectionFactory->getConnection('mysql', Array)
#8 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#9 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): 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(165): OC\ServerContainer->query('OCP\\IDBConnecti...')
#12 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#13 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): 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(1552): OC\ServerContainer->query('DatabaseConnect...')
#16 /var/www/nextcloud/lib/private/Server.php(360): OC\Server->getDatabaseConnection()
#17 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#18 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): 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/AppFramework/Utility/SimpleContainer.php(68): OC\ServerContainer->query('OC\\Authenticati...')
#21 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(98): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#22 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(119): OC\AppFramework\Utility\SimpleContainer->resolve('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(68): OC\ServerContainer->query('OC\\Authenticati...')
#25 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(98): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#26 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(119): OC\AppFramework\Utility\SimpleContainer->resolve('OC\\Authenticati...')
#27 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...')
#28 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(165): OC\ServerContainer->query('OC\\Authenticati...')
#29 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#30 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('OC\\Authenticati...')
#31 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...')
#32 /var/www/nextcloud/lib/private/Server.php(372): OC\ServerContainer->query('OC\\Authenticati...')
#33 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#34 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('OC\\User\\Session')
#35 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\User\\Session')
#36 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(165): OC\ServerContainer->query('OC\\User\\Session')
#37 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#38 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('UserSession')
#39 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('UserSession')
#40 /var/www/nextcloud/lib/private/Server.php(1428): OC\ServerContainer->query('UserSession')
#41 /var/www/nextcloud/lib/private/Server.php(694): OC\Server->getUserSession()
#42 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#43 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('OC\\App\\AppManag...')
#44 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\App\\AppManag...')
#45 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(165): OC\ServerContainer->query('OC\\App\\AppManag...')
#46 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#47 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(117): Pimple\Container->offsetGet('AppManager')
#48 /var/www/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('AppManager')
#49 /var/www/nextcloud/lib/private/Server.php(1723): OC\ServerContainer->query('AppManager')
#50 /var/www/nextcloud/lib/private/legacy/app.php(342): OC\Server->getAppManager()
#51 /var/www/nextcloud/lib/private/legacy/app.php(113): OC_App::getEnabledApps()
#52 /var/www/nextcloud/lib/base.php(654): OC_App::loadApps(Array)
#53 /var/www/nextcloud/lib/base.php(1068): OC::init()
#54 /var/www/nextcloud/console.php(46): require_once('/var/www/nextcl...')
#55 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#56 {main}
HTTPd logs

[Sun Sep 29 10:51:33.006432 2019] [core:notice] [pid 1242:tid 1996042480] AH00094: Command line: '/usr/sbin/apache2'
[Sun Sep 29 11:35:20.509308 2019] [mpm_event:notice] [pid 1242:tid 1996042480] AH00491: caught SIGTERM, shutting down
[Sun Sep 29 11:46:12.824479 2019] [ssl:warn] [pid 4824:tid 1996378352] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun Sep 29 11:46:13.130561 2019] [ssl:warn] [pid 4825:tid 1996378352] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun Sep 29 11:46:14.007995 2019] [mpm_event:notice] [pid 4825:tid 1996378352] AH00489: Apache/2.4.25 (Raspbian) OpenSSL/1.0.2s configured -- resuming normal operations
[Sun Sep 29 11:46:14.008412 2019] [core:notice] [pid 4825:tid 1996378352] AH00094: Command line: '/usr/sbin/apache2'
[Sun Sep 29 11:47:07.752750 2019] [proxy_fcgi:error] [pid 4847:tid 1842570288] [client 192.168.2.28:50063] AH01071: Got error 'PHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 238\nPHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 244\n'
[Sun Sep 29 12:16:24.490073 2019] [proxy_fcgi:error] [pid 4847:tid 1842570288] [client 192.168.2.28:50063] AH01071: Got error 'PHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 238\nPHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 244\n'
[Sun Sep 29 12:16:53.228732 2019] [proxy_fcgi:error] [pid 4847:tid 1708254256] [client 192.168.2.28:50063] AH01067: Failed to read FastCGI header
[Sun Sep 29 12:16:53.229009 2019] [proxy_fcgi:error] [pid 4847:tid 1708254256] (104)Connection reset by peer: [client 192.168.2.28:50063] AH01075: Error dispatching request to :4443:
[Sun Sep 29 12:16:53.702276 2019] [mpm_event:notice] [pid 4825:tid 1996378352] AH00491: caught SIGTERM, shutting down
[Sun Sep 29 12:21:43.154167 2019] [ssl:warn] [pid 2215:tid 1995604208] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun Sep 29 12:21:44.113204 2019] [ssl:warn] [pid 2220:tid 1995604208] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sun Sep 29 12:21:45.007819 2019] [mpm_event:notice] [pid 2220:tid 1995604208] AH00489: Apache/2.4.25 (Raspbian) OpenSSL/1.0.2s configured -- resuming normal operations
[Sun Sep 29 12:21:45.008250 2019] [core:notice] [pid 2220:tid 1995604208] AH00094: Command line: '/usr/sbin/apache2'
[Sun Sep 29 12:21:56.842670 2019] [proxy_fcgi:error] [pid 2242:tid 1682277424] [client 192.168.2.28:50261] AH01071: Got error 'PHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 238\nPHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 244\n'
[Sun Sep 29 12:22:17.261743 2019] [proxy_fcgi:error] [pid 2242:tid 1690678320] [client 192.168.2.28:50261] AH01071: Got error 'PHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 238\nPHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 244\n'
[Sun Sep 29 12:49:40.423596 2019] [proxy_fcgi:error] [pid 2242:tid 1699079216] [client 192.168.2.28:50261] AH01071: Got error 'PHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 238\nPHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 244\n'
[Sun Sep 29 12:50:30.935101 2019] [proxy_fcgi:error] [pid 2242:tid 1690678320] [client 192.168.2.28:50261] AH01071: Got error 'PHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 238\nPHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 244\n'
[Sun Sep 29 12:53:03.653770 2019] [proxy_fcgi:error] [pid 2242:tid 1715881008] [client 192.168.2.28:50261] AH01071: Got error 'PHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 238\nPHP message: PHP Notice:  Undefined index: app in /var/www/ncp-web/index.php on line 244\n'

Database logs

2019-09-29 12:16:56 1970905920 [Note] /usr/sbin/mysqld: Shutdown complete

2019-09-29 12:18:00 1995448112 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2019-09-29 12:18:00 1995448112 [Note] InnoDB: The InnoDB memory heap is disabled
2019-09-29 12:18:00 1995448112 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-09-29 12:18:00 1995448112 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-09-29 12:18:00 1995448112 [Note] InnoDB: Compressed tables use zlib 1.2.8
2019-09-29 12:18:00 1995448112 [Note] InnoDB: Using Linux native AIO
2019-09-29 12:18:00 1995448112 [Note] InnoDB: Using generic crc32 instructions
2019-09-29 12:18:00 1995448112 [Note] InnoDB: Initializing buffer pool, size = 370.0M
2019-09-29 12:18:00 1995448112 [Note] InnoDB: Completed initialization of buffer pool
2019-09-29 12:18:00 1995448112 [Note] InnoDB: Highest supported file format is Barracuda.
2019-09-29 12:18:00 1995448112 [Note] InnoDB: 128 rollback segment(s) are active.
2019-09-29 12:18:00 1995448112 [Note] InnoDB: Waiting for purge to start
2019-09-29 12:18:00 1995448112 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.42-84.2 started; log sequence number 1616747
2019-09-29 12:18:00 1111487296 [Note] InnoDB: Dumping buffer pool(s) not yet started
2019-09-29 12:18:00 1995448112 [Note] Plugin 'FEEDBACK' is disabled.
2019-09-29 12:18:00 1995448112 [Note] Server socket created on IP: '127.0.0.1'.
2019-09-29 12:18:00 1995448112 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.1.38-MariaDB-0+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

the df -h coomand gives
Filesystem Size Used Avail Use% Mounted on
/dev/root 7.3G 2.2G 4.8G 32% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 464M 0 464M 0% /dev/shm
tmpfs 464M 47M 417M 11% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 464M 0 464M 0% /sys/fs/cgroup
/dev/mmcblk0p1 44M 23M 21M 52% /boot
tmpfs 93M 0 93M 0% /run/user/1000

and the lsblk command gives
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 236G 0 disk
└─sda1 8:1 0 236G 0 part
mmcblk0 179:0 0 7.4G 0 disk
├─mmcblk0p1 179:1 0 43.9M 0 part /boot
└─mmcblk0p2 179:2 0 7.4G 0 part /

try sudo mount /dev/sda1 /mnt