[solved] Restoring server from backups - nextcloud gives internal server error

Hi,
my server’s OS disk died and I had to reinstall. I restored my docker stuff from backups, but it seems like I am missing something with nextcloud, it only gives “Internal server error” on the browser. The nextcloud containers nginx error log is probably helpful, but I can’t understand it.
My other containers are working.

Nextcloud nginx error.log (a couple of traces)
docker-compose.yml
docker logs nextcloud
nextcloud config.php
nextcloud.subdomain.conf

This is the issue here:
Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused in /config/www/nextcloud/lib/private/DB/Connection.php:85

Nextcloud is not able to connect to your SQL server. You’ll need to investigate there.

Thanks!
I really dont know my way around databases. i assume this is not a simple user/password problem?
There are lines for passwordsalt and secret in the nextclouds config.php, could these somehow be wrong?

I could just nuke the mariadb and start a new one, as all my files are intact, but I’d rather not, if this can be fixed somehow.

It’s probably best to start by checking your logs for your SQL server (going to assume it’s out MariaDB container) if it is, do docker logs mariadb and see what the output shows.

Okay,
docker logs mariadb had a lot of output like this:

211102 16:12:04 mysqld_safe Logging to '/config/databases/959144cb12ef.err'.
211102 16:12:04 mysqld_safe Starting mariadbd daemon with databases from /config/databases

That pointed to an .err file, which has a lot of this:

211102 16:13:37 mysqld_safe Starting mariadbd daemon with databases from /config/databases
2021-11-02 16:13:37 0 [Note] /usr/bin/mariadbd (mysqld 10.5.12-MariaDB-log) starting as process 52618 ...
2021-11-02 16:13:37 0 [Note] InnoDB: Uses event mutexes
2021-11-02 16:13:37 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-11-02 16:13:37 0 [Note] InnoDB: Number of pools: 1
2021-11-02 16:13:37 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2021-11-02 16:13:37 0 [Note] mariadbd: O_TMPFILE is not supported on /var/tmp (disabling future attempts)
2021-11-02 16:13:37 0 [Note] InnoDB: Using Linux native AIO
2021-11-02 16:13:37 0 [Note] InnoDB: Initializing buffer pool, total size = 268435456, chunk size = 134217728
2021-11-02 16:13:37 0 [Note] InnoDB: Completed initialization of buffer pool
2021-11-02 16:13:37 0 [ERROR] InnoDB: Upgrade after a crash is not supported. The redo log was created with MariaDB 10.4.21.
2021-11-02 16:13:37 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-11-02 16:13:37 0 [Note] InnoDB: Starting shutdown...
2021-11-02 16:13:38 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-11-02 16:13:38 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-11-02 16:13:38 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-11-02 16:13:38 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2021-11-02 16:13:38 0 [ERROR] Aborting
211102 16:13:38 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
211102 16:13:38 mysqld_safe Starting mariadbd daemon with databases from /config/databases
2021-11-02 16:13:38 0 [Note] /usr/bin/mariadbd (mysqld 10.5.12-MariaDB-log) starting as process 52824 ...
2021-11-02 16:13:38 0 [Note] InnoDB: Uses event mutexes
2021-11-02 16:13:38 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-11-02 16:13:38 0 [Note] InnoDB: Number of pools: 1
2021-11-02 16:13:38 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2021-11-02 16:13:38 0 [Note] mariadbd: O_TMPFILE is not supported on /var/tmp (disabling future attempts)
2021-11-02 16:13:38 0 [Note] InnoDB: Using Linux native AIO
2021-11-02 16:13:38 0 [Note] InnoDB: Initializing buffer pool, total size = 268435456, chunk size = 134217728
2021-11-02 16:13:38 0 [Note] InnoDB: Completed initialization of buffer pool
2021-11-02 16:13:38 0 [ERROR] InnoDB: Upgrade after a crash is not supported. The redo log was created with MariaDB 10.4.21.
2021-11-02 16:13:38 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-11-02 16:13:38 0 [Note] InnoDB: Starting shutdown...
2021-11-02 16:13:39 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-11-02 16:13:39 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-11-02 16:13:39 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-11-02 16:13:39 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2021-11-02 16:13:39 0 [ERROR] Aborting
211102 16:13:39 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Ah ha ok - seen this before.

Switch your mariadb to this version linuxserver/mariadb:version-110.4.21mariabionic and let it start up cleanly. Once it has, stop the container and then switch back to the main image.

All while nextcloud or anything else that uses it is off.

OK, that solved something. I got the web interface telling me to upgrade:

App update required

Please make sure that the database, the config folder and the data folder have been backed up before proceeding.

I tried to click the update button, but it told me “an error has occurred”. I then tried to do the update via cli:

$docker exec -it -u abc nextcloud php /config/www/nextcloud/occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
An unhandled exception has been thrown:
TypeError: Argument 3 passed to OC\Updater::__construct() must implement interface OCP\ILogger or be null, instance of OC\Log\PsrLoggerAdapter given, called in /config/www/nextcloud/core/Command/Upgrade.php on line 97 and defined in /config/www/nextcloud/lib/private/Updater.php:87
Stack trace:
#0 /config/www/nextcloud/core/Command/Upgrade.php(97): OC\Updater->__construct()
#1 /config/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute()
#2 /config/www/nextcloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#3 /config/www/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#4 /config/www/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#5 /config/www/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#6 /config/www/nextcloud/console.php(100): OC\Console\Application->run()
#7 /config/www/nextcloud/occ(11): require_once('/config/www/nex...')
#8 {main}

Okay, now it works.

I did

$docker exec -it -u abc nextcloud php /config/www/nextcloud/occ update --all

For some reason, I tried occ upgrade yesterday, which tried to upgrade the nextcloud itself. What it really was asking me to do was to update the apps, which worked like it should.

So, j0nnymoe’s instruction in #5 was enough to fix things. Thanks!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.