Next cloud internal server error

when check the status of the service

● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-01-31 09:51:30 HST; 38s ago
Process: 1003 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Jan 31 09:51:30 raspberrypi systemd[1]: Starting The Apache HTTP Server…
Jan 31 09:51:30 raspberrypi apachectl[1003]: AH00526: Syntax error on line 33 of /etc/apache2/sites-enabled/default-ssl.conf:
Jan 31 09:51:30 raspberrypi apachectl[1003]: SSLCertificateKeyFile: file ‘/etc/apache/ssl/apache.key’ does not exist or is empty
Jan 31 09:51:30 raspberrypi apachectl[1003]: Action ‘start’ failed.
Jan 31 09:51:30 raspberrypi apachectl[1003]: The Apache error log may have more information.
Jan 31 09:51:30 raspberrypi systemd[1]: apache2.service: Control process exited, code=exited status=1
Jan 31 09:51:30 raspberrypi systemd[1]: Failed to start The Apache HTTP Server.
Jan 31 09:51:30 raspberrypi systemd[1]: apache2.service: Unit entered failed state.
Jan 31 09:51:30 raspberrypi systemd[1]: apache2.service: Failed with result ‘exit-code’.

here is the log from /var/log/apache2

[Thu Jan 31 08:25:09.406037 2019] [mpm_event:notice] [pid 1730:tid 1995976704] AH00489: Apache/2.4.25 (Raspbian) configured – resuming normal operations
[Thu Jan 31 08:25:09.408833 2019] [core:notice] [pid 1730:tid 1995976704] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Jan 31 08:26:40.560322 2019] [mpm_event:notice] [pid 1730:tid 1995976704] AH00491: caught SIGTERM, shutting down
[Thu Jan 31 08:26:40.724291 2019] [mpm_prefork:notice] [pid 11892] AH00163: Apache/2.4.25 (Raspbian) configured – resuming normal operations
[Thu Jan 31 08:26:40.724703 2019] [core:notice] [pid 11892] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Jan 31 08:26:41.655317 2019] [mpm_prefork:notice] [pid 11892] AH00169: caught SIGTERM, shutting down
[Thu Jan 31 08:26:42.261394 2019] [mpm_prefork:notice] [pid 11949] AH00163: Apache/2.4.25 (Raspbian) configured – resuming normal operations
[Thu Jan 31 08:26:42.261823 2019] [core:notice] [pid 11949] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Jan 31 08:27:02.244094 2019] [mpm_prefork:notice] [pid 11949] AH00169: caught SIGTERM, shutting down
[Thu Jan 31 08:27:02.555111 2019] [mpm_prefork:notice] [pid 11997] AH00163: Apache/2.4.25 (Raspbian) configured – resuming normal operations
[Thu Jan 31 08:27:02.555328 2019] [core:notice] [pid 11997] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Jan 31 08:34:28.018230 2019] [:error] [pid 12071] [client 192.168.100.34:4019] creating sqlite db
[Thu Jan 31 08:50:28.222485 2019] [:error] [pid 12003] [client 192.168.100.34:22696] PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [14] unable to open database file in /var/www/html/nextcloud/lib/private/DB/Connection.php:64\nStack trace:\n#0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(992): OC\DB\Connection->connect()\n#1 /var/www/html/nextcloud/lib/private/DB/Connection.php(216): Doctrine\DBAL\Connection->executeUpdate(‘PRAGMA read_unc…’, Array, Array)\n#2 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): OC\DB\Connection->executeUpdate(‘PRAGMA read_unc…’)\n#3 /var/www/html/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)\n#4 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOSqlite\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))\n#5 /var/www/html/nextcloud/lib in /var/www/html/nextcloud/lib/private/DB/Connection.php on line 64
[Thu Jan 31 08:50:28.225343 2019] [:error] [pid 12003] [client 192.168.100.34:22696] PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [14] unable to open database file in /var/www/html/nextcloud/lib/private/DB/Connection.php:64\nStack trace:\n#0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(992): OC\DB\Connection->connect()\n#1 /var/www/html/nextcloud/lib/private/DB/Connection.php(216): Doctrine\DBAL\Connection->executeUpdate(‘PRAGMA read_unc…’, Array, Array)\n#2 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): OC\DB\Connection->executeUpdate(‘PRAGMA read_unc…’)\n#3 /var/www/html/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)\n#4 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOSqlite\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))\n#5 /var/www/html/nextcloud/lib in /var/www/html/nextcloud/lib/private/DB/Connection.php on line 64
[Thu Jan 31 08:52:14.122071 2019] [mpm_prefork:notice] [pid 11997] AH00169: caught SIGTERM, shutting down
[Thu Jan 31 08:52:14.461543 2019] [mpm_prefork:notice] [pid 12332] AH00163: Apache/2.4.25 (Raspbian) configured – resuming normal operations
[Thu Jan 31 08:52:14.461805 2019] [core:notice] [pid 12332] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Jan 31 09:22:09.636083 2019] [mpm_prefork:notice] [pid 12332] AH00169: caught SIGTERM, shutting down
[Thu Jan 31 09:22:09.951096 2019] [mpm_prefork:notice] [pid 12610] AH00163: Apache/2.4.25 (Raspbian) configured – resuming normal operations
[Thu Jan 31 09:22:09.951287 2019] [core:notice] [pid 12610] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Jan 31 09:29:33.149010 2019] [mpm_prefork:notice] [pid 12610] AH00169: caught SIGTERM, shutting down

It seems to be an issue with certificate. Looks like Apache cannot be startet, because the config tries to read a certificate which does not exist in expected place ( /etc/apache/ssl/apache.key).

Check if key is present:

ls -alF /etc/apache/ssl/

i’ve managed to resolve. The problem was when i was trying to transfer the nextcloud data folder to an External HDD.

Can somebody please help me do it.

Data directory will be defined in config.php. But it is not that easy as the database is affected as well. This topic might be helpful…

i guess its best to do when configuring the nextcloud itself and the way i know is to reinstall the whole thing again.

I would re-install as well. And I did really often in the beginning. :wink:

ok so next cloud is up and running.
how do i add an external hdd.

Disk /dev/sda: 1.8 TiB, 2000365289472 bytes, 3906963456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xce89cfe4

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 3906963455 3906961408 1.8T 83 Linux

i can see the above when using the command " sudo fdisk -l"

and i can see the following files

pi@raspberrypi:/media $ ls
nextcloud pi

would the hdd be ready to transfer the data directory from var/www/html/data to media/nextcloud ?

i just learned it had to be unmounted first and formated to delete the contents. I did it and now how do i mount it ?

It depends on your system. I need to add the UUID of the disk to /etc/fstab and then I mount it.

This is the way like I do:

UUID=`blkid | grep -v "vfat" | cut -d '"' -f2`
mkdir /media/usbhdd-a
echo "UUID="$UUID" /media/usbhdd-a ext4 defaults 0 0" >> /etc/fstab
mount -a

# creation of Nextcloud data directory
mkdir /media/usbhdd-a/nextcloud
mkdir /media/usbhdd-a/nextcloud/data
chown -R www-data:www-data /media/usbhdd-a/nextcloud

Thanks. i’v got the HDD mounted. but after moving the data directory from the initially created folder

/var/www/html/nextcloud/data to 'media/pi/nc_dataStore/data

and the page does not load anymore. The webpage navigates to

http://192.168.100.188/nextcloud/index.php

and stops. what could be wrong ?

Do you remember last screen to finish the setup? There you need to define your data directory.

https://docs.nextcloud.com/server/15/admin_manual/installation/installation_wizard.html#data-directory-location-label

Use /media/pi/nc_dataStore/data instead of /opt/nextcloud as given in the example.

iv’e done that as well but from the /config.php

I dot not get that screen when navigating to the webpage. That page was completed during the initial setup and does not showup when moving the files.

this is what it shows with ls

pi@raspberrypi:~ $ sudo ls -la /media/pi/nc_dataStore/data
total 1012
drwxr-x— 6 www-data www-data 4096 Feb 1 11:54 .
drwxr-xr-x 3 www-data www-data 4096 Feb 1 11:58 …
drwxr-xr-x 10 www-data www-data 4096 Feb 1 10:40 appdata_ocbhjbhnbccz
drwxr-xr-x 2 www-data www-data 4096 Feb 1 10:39 files_external
drwxr-xr-x 5 www-data www-data 4096 Feb 1 10:41 george
-rw-r–r-- 1 www-data www-data 324 Feb 1 10:39 .htaccess
-rw-r–r-- 1 www-data www-data 0 Feb 1 10:39 index.html
drwxr-xr-x 4 www-data www-data 4096 Feb 1 10:40 nc_admin
-rw-r----- 1 www-data www-data 118287 Feb 1 11:54 nextcloud.log
-rw-r–r-- 1 www-data www-data 0 Feb 1 10:39 .ocdata
-rw-r–r-- 1 www-data www-data 888832 Feb 1 11:54 owncloud.db

and attached pic shows how it looks when navigating to the web page


just blank white page. Now sure what is missing.

Ok, try the following:

# delete old database
mysql -u root -p
 # enter password
DROP DATABASE nextcloud;
Quit;

# delete old files
cd /media/pi/nc_dataStore/data
rm -R *
cd /var/www/html
rm -R nextcloud

# download new instance
cd /var/www/html
wget https://download.nextcloud.com/server/releases/latest-15.zip
unzip latest-15.zip
rm latest-15.zip
chown-R www-data:www-data nextcloud

Now call the cloud as before. Can you now see mentioned webpage dialogue?

first command error

pi@raspberrypi:~ $ mysql -u root -p
-bash: mysql: command not found

Well, just seen that the manual used Sqlite. No idea how to get rid of the old database.

Is this helpful?:
https://www.quackit.com/sqlite/tutorial/drop_a_database.cfm

You can install MySQL if you want:

sudo apt-get install mysql-server
sudo mysql_secure_installation

ah the default database used is SQLlite not MySQL.

here is the same topic in this forum but i don’t see why mine is not working.