Nextcloud Update Error for 18.0.4

Hello everybody,

I need your help. I’m a beginner, so please be patient. I’ll try my best.
A few weeks ago, I installed Nextcloud in a docker of OpenMediaVault on my Raspberry Pi. So this is the first update for my Nextcloud. OpenMediaVault is fine, so I think it’s only Nextcloud which has a problem. What I have done:

Yesterday, I got the message that there’s an update for Nextcloud. I started the update on the web interface and everything was alright till the question ‘Keep maintenance mode active?’
Because I wanted to use the web based upgrade, I chose disabling the maintenance mode. I was directed to the upgrade page and started the update.
Since then, Nextcloud is in the maintenance mode and I don’t know what to do.
According to other topics, I logged in as root via SSH and went to installation directory of Nextcloud. There I tried different things. For example:

  • disabling the maintenance mode: sudo -u www-data php occ maintenance:mode --off
  • asking for the server status: sudo -u www-data php occ status
  • updating Nextcloud with the command line: sudo -u www-data php ./occ upgrade

But nothing worked, I got always the following error message:
An unhandled exception has been thrown: Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: could not find driver in …nextcloud/lib/private/DB/Connection.php:68
The entire message is much longer (62 lines), but I think this part is the important one.

I don’t know what is exacly the problem and what can I do. What can I do to finish the update? Or instead of that how can i get back to my working Nextcloud installation?

I hope you can help me. Thanks in advance for your help!


Welcome in Nextcloud community,

You can disable maintenance in the config.php configuration file located in /paths-directory/nextcloud/config/config.php.


nano /var/www/nextcloud/config/config.php

find this line: “maintenance” => true,
Change true by false

If this line does not exist in your config.php, create it.

I have a question: What is your nextcloud installation directory?
Because when you try sudo -u www-data php occ maintenance:mode --off what do you get ?

Hi there,

I seem to have a similar issue. (And am also an idiot, so bear with me please).

I’m on a Debian 10 system though.

I just tried to update from 17.0.1 to 18.0.4, and during that update something went wrong (it said nextcloud talk had no available update, so it had to be disabled), there my problems started.
I got thrown into maintenance mode, and haven’t been able to get out since.

For some reason said update to 18.0.4 resulted in my nextcloud going back to version 11, so I updated it step by step, this time via the updater/updater.phar back up to 18.04.

which still leaves me in maintenance mode, although sudo -u www-data php occ maintenance:mode --off seems to work with Maintenance mode already disabled and the corresponding change in the config.php (if I toggle around from with --on and --off), It’s just that I still am in maintenance mode.

config.php (pastebin)
ls -l /var/www/nextcloud

I guess that I broke my permissions/ownership on the way, which is why I include the ls -l, but I’m in no way sure if that’s true, or how to fix it.
With my current configuration at least all commands claim to be working, which is why it seemed reasonable…

/e: the end of my log in /var/log/nextcloud.log is:
`{“reqId”:"",“level”:1,“time”:“2020-04-25T11:52:25+02:00”,“remoteAddr”:"",“user”:"–",“app”:“updater”,“method”:"",“url”:"–",“message”:"\OC\Updater::updateEnd: Update successful",“userAgent”:"–",“version”:“”}

{“reqId”:"",“level”:1,“time”:“2020-04-25T11:52:25+02:00”,“remoteAddr”:"",“user”:"–",“app”:“updater”,“method”:"",“url”:"–",“message”:"\OC\Updater::maintenanceActive: Maintenance mode is kept active",“userAgent”:"–",“version”:“”}

{“reqId”:"",“level”:1,“time”:“2020-04-25T11:52:25+02:00”,“remoteAddr”:"",“user”:"–",“app”:“updater”,“method”:"",“url”:"–",“message”:"\OC\Updater::resetLogLevel: Reset log level to Warning(2)",“userAgent”:"–",“version”:“”}`

which reads to me like everything is fine? (update successfull)
full /var/log/nextcloud.log

Thanks! Maintenance mode is now off :slightly_smiling_face:
That was a bad mistake of mine. I tried this earlier that way but i had forgotten to write the nano. So of course, that hadn’t work. Now it’s working.

My installation directory is: /srv/dev-disk-by-label-HDD6/appdata/ncdata/nextcloud
When I try sudo -u www-data php occ maintenance:mode --off I get the same message which I posted in my first entry:

An unhandled exception has been thrown: Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: could not find driver in /srv/dev-disk-by-label-HDD6/appdata/ncdata/nextcloud/lib/private/DB/Connection.php:68

But that is just the first (Ithink important) line. All in all, I get now 48 lines. Should I post them all? As I tried the occ maintenance command earlier, I received 62 lines…

To use occ correctly please try this: sudo -u www-data php /srv/dev-disk-by-label-HDD6/appdata/ncdata/nextcloud/occ maintenance:mode --off

Re @TheYang

Can I have your nextcloud.log ?

damn, you were a little to quick, thought of that myself and edited in the log, the link is in the end, or the last 3 lines are in the text.

First of all: The update was successfully installed. Obviously, the only problem during the update was to exit the maintenance mode at the end.

If I try sudo -u www-data php /srv/dev-disk-by-label-HDD6/appdata/ncdata/nextcloud/occ maintenance:mode --off, I’ll get the same message as before:
An unhandled exception has been thrown: Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: could not find driver in /srv/dev-disk-by-label-HDD6/appdata/ncdata/nextcloud/lib/private/DB/Connection.php:68
followed by a stack trace with 47 lines.

Try to repair your installation with : maintenance:repair


What does the “Overview” web page in nextcloud say?

The maintenance repair command fails the same way the others did before.

The overview says that there’s a PHP-module called imagick missing. That’s the only security warning. My current version is now 18.0.4

Did that already, the described situation is the result

Repair shows no errors (can paste a log later)


Don’t forget to install it :slightly_smiling_face:

try: chown -R www-data:www-data /nexcloud/
chmod +x /config/config.php
and reboot

Yeah, that’s what I’ve already done now. Although it says that it’s already installed. Mysterious…I’ll check it later again. So far, thanks a lot for your help!

Great !!! please put this subject as resolved :slight_smile:

That changed the issue to:

Cannot write into “apps” directory

Which i don’t understand since that has the same permissions as everything else?
doesn’t even change if i go for chmod 777 nextcloud/apps

Do you use apache or nginx ?

im using apache

Can I have your /etc/apache2/mods-enabled/ files ?

access_compat.load filter.load
alias.conf headers.load
alias.load mime.conf
auth_basic.load mime.load
authn_core.load mpm_prefork.conf
authn_file.load mpm_prefork.load
authz_core.load negotiation.conf
authz_groupfile.load negotiation.load
authz_host.load php7.3.conf
authz_user.load php7.3.load
autoindex.conf reqtimeout.conf
autoindex.load reqtimeout.load
cgi.load rewrite.load
deflate.conf setenvif.conf
deflate.load setenvif.load
dir.conf socache_shmcb.load
dir.load ssl.conf
dnssd.conf ssl.load
dnssd.load status.conf
env.load status.load