Nextcloud: service unavailable

nextcloud

(Rolf Bakker) #1

NethServer Version: NethServer release 7.4.1708
Module: nextcloud
Accountsprovider: integrated AD

Hi all,
via the webinterface I installed the module Nextcloud.
When going to the nextcloud webinterface, I’m greeted with an error 503:

Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

I’ve tried the signal-event : signal-event nethserver-nextcloud-update.
In /var/log/messages I see lots of lines appear:

Feb 10 18:07:50 helium esmith::event[13325]: An unhandled exception has been thrown:
Feb 10 18:07:50 helium esmith::event[13325]: 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 /usr/share/nextcloud/lib/private/DB/Connection.php:61
Feb 10 18:07:50 helium esmith::event[13325]: Stack trace:
Feb 10 18:07:50 helium esmith::event[13325]: #0 /usr/share/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(992): OC\DB\Connection->connect()
Feb 10 18:07:50 helium esmith::event[13325]: #1 /usr/share/nextcloud/lib/private/DB/Connection.php(213): Doctrine\DBAL\Connection->executeUpdate(‘PRAGMA read_unc…’, Array, Array)
Feb 10 18:07:50 helium esmith::event[13325]: #2 /usr/share/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): OC\DB\Connection->executeUpdate(‘PRAGMA read_unc…’)
Feb 10 18:07:50 helium esmith::event[13325]: #3 /usr/share/nextcloud/lib/private/DB/Connection.php(148): Doctrine\DBAL\Connection->setTransactionIsolation(2)
Feb 10 18:07:50 helium esmith::event[13325]: #4 /usr/share/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))
Feb 10 18:07:50 helium esmith::event[13325]: #5 /usr/share/nextcloud/lib/private/DB/ConnectionFactory.php(151): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
Feb 10 18:07:50 helium esmith::event[13325]: #6 /usr/share/nextcloud/lib/private/Server.php(588): OC\DB\ConnectionFactory->getConnection(‘sqlite3’, Array)
Feb 10 18:07:50 helium esmith::event[13325]: #7 /usr/share/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
Feb 10 18:07:50 helium esmith::event[13325]: #8 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(115): Pimple\Container->offsetGet(‘OCP\IDBConnecti…’)
Feb 10 18:07:50 helium esmith::event[13325]: #9 /usr/share/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query(‘OCP\IDBConnecti…’)
Feb 10 18:07:50 helium esmith::event[13325]: #10 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(163): OC\ServerContainer->query(‘OCP\IDBConnecti…’)
Feb 10 18:07:50 helium esmith::event[13325]: #11 /usr/share/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(109): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(Object(OC\Server))
Feb 10 18:07:50 helium esmith::event[13325]: #12 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(115): Pimple\Container->offsetGet(‘DatabaseConnect…’)
Feb 10 18:07:50 helium esmith::event[13325]: #13 /usr/share/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query(‘DatabaseConnect…’)
Feb 10 18:07:50 helium esmith::event[13325]: #14 /usr/share/nextcloud/lib/private/Server.php(1345): OC\ServerContainer->query(‘DatabaseConnect…’)
Feb 10 18:07:50 helium esmith::event[13325]: #15 /usr/share/nextcloud/lib/private/Server.php(309): OC\Server->getDatabaseConnection()
Feb 10 18:07:50 helium esmith::event[13325]: #16 /usr/share/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
Feb 10 18:07:50 helium esmith::event[13325]: #17 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(115): Pimple\Container->offsetGet(‘OC\Authenticati…’)
Feb 10 18:07:50 helium esmith::event[13325]: #18 /usr/share/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query(‘OC\Authenticati…’)
Feb 10 18:07:50 helium esmith::event[13325]: #19 /usr/share/nextcloud/lib/private/Server.php(313): OC\ServerContainer->query(‘OC\Authenticati…’)
Feb 10 18:07:50 helium esmith::event[13325]: #20 /usr/share/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
Feb 10 18:07:50 helium esmith::event[13325]: #21 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(115): Pimple\Container->offsetGet(‘OC\Authenticati…’)
Feb 10 18:07:50 helium esmith::event[13325]: #22 /usr/share/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query(‘OC\Authenticati…’)
Feb 10 18:07:50 helium esmith::event[13325]: #23 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(163): OC\ServerContainer->query(‘OC\Authenticati…’)
Feb 10 18:07:50 helium esmith::event[13325]: #24 /usr/share/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(109): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(Object(OC\Server))
Feb 10 18:07:50 helium esmith::event[13325]: #25 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(115): Pimple\Container->offsetGet(‘OC\Authenticati…’)
Feb 10 18:07:50 helium esmith::event[13325]: #26 /usr/share/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query(‘OC\Authenticati…’)
Feb 10 18:07:50 helium esmith::event[13325]: #27 /usr/share/nextcloud/lib/private/Server.php(329): OC\ServerContainer->query(‘OC\Authenticati…’)
Feb 10 18:07:50 helium esmith::event[13325]: #28 /usr/share/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
Feb 10 18:07:50 helium esmith::event[13325]: #29 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(115): Pimple\Container->offsetGet(‘OCP\IUserSessio…’)
Feb 10 18:07:50 helium esmith::event[13325]: #30 /usr/share/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query(‘OCP\IUserSessio…’)
Feb 10 18:07:50 helium esmith::event[13325]: #31 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(163): OC\ServerContainer->query(‘OCP\IUserSessio…’)
Feb 10 18:07:50 helium esmith::event[13325]: #32 /usr/share/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(109): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(Object(OC\Server))
Feb 10 18:07:50 helium esmith::event[13325]: #33 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(115): Pimple\Container->offsetGet(‘UserSession’)
Feb 10 18:07:50 helium esmith::event[13325]: #34 /usr/share/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query(‘UserSession’)
Feb 10 18:07:50 helium esmith::event[13325]: #35 /usr/share/nextcloud/lib/private/Server.php(1213): OC\ServerContainer->query(‘UserSession’)
Feb 10 18:07:50 helium esmith::event[13325]: #36 /usr/share/nextcloud/lib/private/Server.php(648): OC\Server->getUserSession()
Feb 10 18:07:50 helium esmith::event[13325]: #37 /usr/share/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
Feb 10 18:07:50 helium esmith::event[13325]: #38 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(115): Pimple\Container->offsetGet(‘OC\App\AppManag…’)
Feb 10 18:07:50 helium esmith::event[13325]: #39 /usr/share/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query(‘OC\App\AppManag…’)
Feb 10 18:07:50 helium esmith::event[13325]: #40 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(163): OC\ServerContainer->query(‘OC\App\AppManag…’)
Feb 10 18:07:50 helium esmith::event[13325]: #41 /usr/share/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(109): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(Object(OC\Server))
Feb 10 18:07:50 helium esmith::event[13325]: #42 /usr/share/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(115): Pimple\Container->offsetGet(‘AppManager’)
Feb 10 18:07:50 helium esmith::event[13325]: #43 /usr/share/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query(‘AppManager’)
Feb 10 18:07:50 helium esmith::event[13325]: #44 /usr/share/nextcloud/lib/private/Server.php(1518): OC\ServerContainer->query(‘AppManager’)
Feb 10 18:07:50 helium esmith::event[13325]: #45 /usr/share/nextcloud/lib/private/legacy/app.php(315): OC\Server->getAppManager()
Feb 10 18:07:50 helium esmith::event[13325]: #46 /usr/share/nextcloud/lib/private/legacy/app.php(110): OC_App::getEnabledApps()
Feb 10 18:07:50 helium esmith::event[13325]: #47 /usr/share/nextcloud/lib/base.php(673): OC_App::loadApps(Array)
Feb 10 18:07:50 helium esmith::event[13325]: #48 /usr/share/nextcloud/lib/base.php(1086): OC::init()
Feb 10 18:07:50 helium esmith::event[13325]: #49 /usr/share/nextcloud/console.php(56): require_once(’/usr/share/next…’)
Feb 10 18:07:50 helium esmith::event[13325]: #50 /usr/share/nextcloud/occ(11): require_once(’/usr/share/next…’)

I guess the essential one being
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 /usr/share/nextcloud/lib/private/DB/Connection.php:61

I can’t find anything related in this forum. Please help?


(Joel Clendineng) #2

Did you just upgrade? Also did you switch php versions? First, check to see if mysql is running on your system. (service mysqld status) Second, go to your nextcloud config file, /nextcloud/config/config.php, and make sure your database settings are correct. That error usually occurs when the config is wrong.

Edit: Most likely an issue with php versions, double check that after you check mysql


(Rolf Bakker) #3

thanks for looking into this Joel.
Here’s what you asked:
I regularly upgrade my installation using yum update. This install is not fresh, upgraded from previous NS version.
mysql is running (although mariadb reports an error; aren’t these aliases of eachother?)

root@helium:~> $ service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2018-02-10 21:36:57 CET; 16min ago
Process: 28089 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 28057 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 28088 (mysqld_safe)
CGroup: /system.slice/mysqld.service
├─28088 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─28262 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var…

Feb 10 21:36:55 helium.rolfbakker.nl systemd[1]: Starting MariaDB database server…
Feb 10 21:36:55 helium.rolfbakker.nl mariadb-prepare-db-dir[28057]: Database MariaDB is probably initialized in /var/lib/mysql a…one.
Feb 10 21:36:55 helium.rolfbakker.nl mariadb-prepare-db-dir[28057]: If this is not the case, make sure the /var/lib/mysql is emp…dir.
Feb 10 21:36:55 helium.rolfbakker.nl mysqld_safe[28088]: 180210 21:36:55 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log’.
Feb 10 21:36:55 helium.rolfbakker.nl mysqld_safe[28088]: 180210 21:36:55 mysqld_safe Starting mysqld daemon with databases from…mysql
Feb 10 21:36:57 helium.rolfbakker.nl systemd[1]: Started MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.

and:

root@helium:~> $ service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2018-02-10 21:37:04 CET; 17min ago
Process: 28328 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=1/FAILURE)
Main PID: 1475 (code=exited, status=0/SUCCESS)

Feb 10 21:37:04 helium.rolfbakker.nl systemd[1]: Starting MariaDB database server…
Feb 10 21:37:04 helium.rolfbakker.nl mariadb-prepare-db-dir[28328]: Socket file /var/lib/mysql/mysql.sock exists.
Feb 10 21:37:04 helium.rolfbakker.nl mariadb-prepare-db-dir[28328]: Is another MySQL daemon already running with the same unix socket?
Feb 10 21:37:04 helium.rolfbakker.nl systemd[1]: mariadb.service: control process exited, code=exited status=1
Feb 10 21:37:04 helium.rolfbakker.nl systemd[1]: Failed to start MariaDB database server.
Feb 10 21:37:04 helium.rolfbakker.nl systemd[1]: Unit mariadb.service entered failed state.
Feb 10 21:37:04 helium.rolfbakker.nl systemd[1]: mariadb.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

php version is

root@helium:~> $ php -v
PHP 5.4.16 (cli) (built: Nov 15 2017 16:33:54)
Copyright © 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright © 1998-2013 Zend Technologies

And when looking at config.php, I don’t see any strange things. Ofcourse, the password is hashed, so I can’t see if that is correct. Should I post the content of the file as well?


(Rolf Bakker) #4

looks like no db is created?

sqlite> .databases
seq name file


0 main
sqlite>

edit: hmm, wait a minute: @Jclendineng , you asked whether mysql is running, however config.php talks about sqlite db…
Is that a slip of the keyboard, or a probable cause?


(Joel Clendineng) #5

Well it’s not seeing the db so make sure you used sqlite when you set up the nextcloud instance, if so may be other issues, if you used mysql you might need to add that info to the configuration file. Probably cause, yes :slight_smile: that’s a great place to start. Run mysql -u root -p and it will ask for password then look at the databases. An easier way is to use phpmyadmin.

⁣Sent from BlueMail ​


(Rolf Bakker) #6

Ok, one step further. I realized I had installed nextcloud before, then removed it. However, when removing nethserver-nextcloud (NS-NC), the package nextcloud itself isn’t removed.
When doing so, the reinstall NS-nextcloud (plus nextcloud), all installs well and the service is available.
However, the integration with the users of NS isn’t present…
When logging on to NC as admin, I only see 1 user: admin. None of my NS users are there…
Better start over again…?
What’s the preferred db in NS? Mariadb?or sqlite?


(Giacomo Sanchietti) #7

You need to remove everything and reinstall nextcloud. Not tested:

rpm -e nethserver-nextcloud nextcloud
rm -rf /var/lib/nethserver/nextcloud/
/usr/share/nextcloud/
mysql -e "drop database nextcloud"
yum install nethserver-nextcloud

(Rolf Bakker) #8

thanks, I already did something simular to that.
I don’t know if it is works-as-designed, but the Nextcloud-db isn’t populated at start:
I have to add the users manually , and then in webtop connect a user to a NC-user.

But now it works, enough for my home-server.