Mywebserver/nextcloud goes to a blank page. Can't connect to database it seems

Nextcloud version : 12.0
Operating system and version : Raspbian Jessie
Apache or nginx version : Apache/2.4.10 (Raspbian)
PHP version (eg, 5.6): PHP Version 5.6.30-0+deb8u1

The issue you are facing:
It’s been two days that, out of nowhere, my nextcloud instalattion stopped working. If I try to access it on the web, the page is blank. My sync apps (android and windows) throw an “internal server error” message. I tried to look at the apache log file and, from what I understand, it’s a problem with permissions.
It have a lot of lines like that, just changing the time of the error at the beggining:

[Thu Dec 21 13:25:31.397924 2017] [:error] [pid 31073] [client 177.102.1.128:1024] PHP Fatal error: Uncaught exception ‘Doctrine\DBAL\DBALException’ with message ‘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:61\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(213): 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(148): 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 / in /var/www/html/nextcloud/lib/private/DB/Connection.php on line 61

The output of your Nextcloud log in Admin > Logging:

Can’t access the web interface

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxxxx',
  'secret' => 'xxxxxx',
  'trusted_domains' => 
  array (
    0 => 'myip',
    1 => 'mydomain',
  ),
  'datadirectory' => '/my/external/HD/nextcloud/data',
  'overwrite.cli.url' => 'http://myip:8443/nextcloud',
  'dbtype' => 'sqlite3',
  'version' => '12.0.0.29',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpsecure' => 'ssl',
  'mail_from_address' => 'myemail',
  'mail_domain' => 'gmail.com',
  'mail_smtpport' => '465',
  'mail_smtpname' => 'myemail@gmail.com',
  'mail_smtppassword' => 'xxxxx',
);

So, my main question is: what is wrong? I didn’t update anything, didn’t restart anything… I don’t understand how my install broke just like that… I’ve tried using chown and chmod 777 on all my nextcloud directory just to see if I managed to get something working again, but no use… I use the SQLite database, and dunno how to check if it is broken as the initial install is all automatic on that point. Never touched anything on that department.

Keep in mind I am not very familiar with linux file locations and all that. So if you ask me to check some file or anything like that, please point me on where is it too =D thanks in advance ^^

Hi,

It looks like the database is not running. Could you check with the following commands and provide the output?

ps -ef | grep -E "sqlite|sql"
systemctl status sqlite3

I don’t know your environment and just hope these commands run on your server.

1 Like

Hello Schmu! the commands did work, but it seems I don’t have sqlite3. If I type “sqlite” I enter in it’s interface. But everytime I try to check the “sqlite” service, it returns this same message below.
Anyway, here is the output you asked for

ps -ef | grep -E “sqlite|sql”
pi 384 324 0 13:32 pts/0 00:00:00 grep --color=auto -E sqlite|sql
systemctl status sqlite3
● sqlite3.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

No one? =(

How did you install NC12 on that RPi?

hello budy.
I followed this tutorial:

It has been up and running without a problem for about 5 months… just last week it stopped working.

First, make a backup of your data and the database file.

From the error, it’s quite obvious that it can’t connect to the database. Perhaps the database is corrupt, can you try to read the file from terminal, just check if you can open it and show all the table names:

sqlite3 database.sqlite
sqlite> .tables

http://www.sqlite.org/cli.html

1 Like

@tflidd ok, but what is the database file? the log on apache just point to php files. I don’t know what the database is called and where to find it. When installing, all that was automatic…
is it the “owncloud.db” on my /nextcloud/data" directory on the directory I choose to put my files?

if owncloud.db is the file, the output of “.tables” on it is the following:

oc_accounts oc_flow_operations
oc_activity oc_group_admin
oc_activity_mq oc_group_user
oc_addressbookchanges oc_groups
oc_addressbooks oc_jobs
oc_admin_sections oc_mimetypes
oc_admin_settings oc_mounts
oc_appconfig oc_notifications
oc_authtoken oc_notifications_pushtokens
oc_bruteforce_attempts oc_oauth2_access_tokens
oc_calendarchanges oc_oauth2_clients
oc_calendarobjects oc_preferences
oc_calendarobjects_props oc_privatedata
oc_calendars oc_properties
oc_calendarsubscriptions oc_schedulingobjects
oc_cards oc_share
oc_cards_properties oc_share_external
oc_comments oc_storages
oc_comments_read_markers oc_systemtag
oc_credentials oc_systemtag_group
oc_dav_shares oc_systemtag_object_mapping
oc_federated_reshares oc_trusted_servers
oc_file_locks oc_twofactor_backupcodes
oc_filecache oc_users
oc_files_trash oc_vcategory
oc_flow_checks oc_vcategory_to_object

the text gets all crazy when I paste it here, but in the console it’s two columns of text. So I’m guessing it’s not corrupted. At least one good news for me haha

That looks good, we don’t know if a table is corrupt but in that case I would expect a more specific error. I don’t know sqlite enough to tell you how to debug or how to check the database. I’d check the documentation of sqlite. Did you upgrade anything recently.

In general, you should use a real database if possible. You can even do that on a RPi.

thanks anyway @tflidd
I didn’t upgrade before the error. Then I went and upgraded all the system in hope it would fix it. I tried checking “service sqlite3 status” and “check sqlite status” and it returns:
sqlite3.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

Do you know if it is normal? or if the service name is another one? if it was mysql there would be the need for the service to be running, right? but I’m not sure if it’s how sqlite works too… and since the table opens, maybe that service not running is the problem. But I just can’t find the service name in google, so I’m not sure there should be one running…
I’m guessing I’ll end up installing the whole thing again from scratch, just need to find a proper way to backup the files first. Next time, I’ll be sure to don’t be lazy and try the mysql solution. Seems to be better at getting support haha