Internal Server Error after Upgrade to MariaDB 10.3

[details=“Support intro”]

Sorry to hear you’re facing problems :slightly_frowning_face:

**After accidently upgrading the database to MariaDB 10.3 (cursor in wrong window), nearly everything crashed **

I’m running Debian 10 now and except NC everything works fine (sql, ldap, dovecot, postfix, apache, …)[/details]

Nextcloud version 14 & 15:
Operating system and version Debian 10 (Buster):
Apache or nginx version Apache2:
PHP version 7.3:

In /var/log/apache2/nextcloud-error.log I’m facing:
“[Thu Feb 14 18:56:52.285564 2019] [:error] [pid 2785] [client] PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /srv/nextcloud/lib/private/DB/Connection.php:64\nStack trace:\n#0 /srv/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()\n#1 /srv/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()\n#2 /srv/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()\n#3 /srv/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()\n#4 /srv/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)\n#5 /srv/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Configurat in /srv/nextcloud/lib/private/DB/Connection.php on line 64”

via mysql-cli, the nc user is able to login and access the data.

Steps to replicate it:

  1. Install Debian Stretch & NC 14
  2. Upgrade MariaDB to 10.3
  3. Upgrade everything else to Debian Buster to make MariaDB working

The output of your Nextcloud log in Admin > Logging:

I can't access

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

$CONFIG = array (
  'instanceid' => '(some value)',
  'passwordsalt' => '(some value)',
  'secret' => '(some value)',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '',
    2 => '(some value)',
  'datadirectory' => '/srv/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'https://(some value)',
  'dbname' => 'nextcloud',
//  'dbhost' => 'localhost:/var/run/mysqld/mysqld.sock', -> did not work as well
//  'dbhost' => '', -> did not work as well
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => '(some value)',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'mail_smtpmode' => 'sendmail',
  'mail_from_address' => '(some value)',
  'mail_domain' => '(some value)',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => true,

//  "log_type" => "owncloud",
//  "logfile" => "nextcloud.log",
//  "loglevel" => "3",
//  "logdateformat" => "F d, Y H:i:s",

The output of your Apache/nginx/system log in /var/log/____:

see above

From my experience these message indicates that a database access is not possible. Therefore you should check if the required PHP database driver is correctly loaded and if the database configuration parameters are correctly set. You’ve set dbhost' => 'localhost' which means that the database will be accessed via the default database socket. Most likely this need to be adjusted so that it matches your MariaDB configuration, like:

  'dbtype'     => 'mysql',
  'dbhost'     => 'localhost:<path-to socket>/mysql.sock',
  'dbuser'     => '<db-user>',
  'dbpassword' => '<db-password>',

OK, I tried:

‘dbname’ => ‘nextcloud’,
‘dbhost’ => ‘localhost:/var/run/mysqld/mysqld.sock’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘nextcloud’,

prooved, that /var/run/mysqld/mysqld.sock is the socket.

Unfortunately, I still have Error 500, but nothing in the Logs anymore.
Is there some other Log location except /var/log/nextcloud.log (empty), /var/log/apache2/nextcloud-error.log (nothing new), and Syslog? (nothing new)

Or do I have to restart/reload any services? Apache? …

I would first try to access the database from the console to make sure that the database
can be accessed correctly with the given credentials. Then I would check if all tables etc.
exist. Additionally you could the loglevel' => 0, (debug output) and you should set
'maintenance' => false, to disable maintenance mode :wink:

# mysql -S /var/run/mysqld/mysql.sock -D nextcloud -u nextcloud -p
MariaDB [nextcloud]> show tables;

Access to DB works, show tables gives me 91 rows (didn’t check each single table, but seems OK) - you forgot a “d” in mysqld.sock, but I copied from the config file.

Setting maintenance to false and loglevel to zero still gives me empty Logs…

That sounds good. Next I would switch to the web server user, change to the Nextcloud root directory and check the Nextcloud installation using the occ command line tool.

# su - wwwrun -s /bin/sh
> cd /<nextcloud-root-directory>
> ./occ upgrade
> ./occ status
> ...

Then I would try to access the Nextcloud instance using your web browser and checking the web server looks for any hint or error message.

occ upgrade ran without any errors.

$ ./occ status
Nextcloud is in maintenance mode - no apps have been loaded

  • installed: true
  • version:
  • versionstring: 15.0.4
  • edition:

seems to work. Still the logs are empty - do I have to set loglevel to something different?

Your installation is still in maintenance mode, you should try to switch it off:

$ ./occ maintenance:mode --off

Yes, I disabled after occ upgrade & status via config.php …
Just checked:

$ ./occ maintenance:mode --off
Maintenance mode already disabled

Then I would expect that Nextcloud access should be possible. Check-out the web server log files for further information.

That’s the problem:
In (…)/nextcloud-access.log I get
(SOME IP) - - [15/Feb/2019:14:27:59 +0100] “GET / HTTP/1.1” 500 787 “-” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36”
but (…)/nextcloud-error.log is empty… Last entry is from yesterday…
And of course, I did a reload of the cloud-page…

After switching logging to Syslog, there’s a new Message:

Feb 15 21:29:34 server Nextcloud[6948]: {core} {"Exception":"OC\\HintException","Message":"Memcache \\OC\\Memcache\\APCu not available for local cache","Code":0,"Trace":[{"file":"\/srv\/nextcloud\/lib\/private\/Server.php","line":511,"function":"__construct","class":"OC\\Memcache\\Factory","type":"->","args":["a0d63db180bd554cd4e5691a706fa85b",{"__class__":"OC\\Log"},"\\OC\\Memcache\\APCu","\\OC\\Memcache\\APCu",null]},{"file":"\/srv\/nextcloud\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php","line":118,"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/nextcloud\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php","line":117,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OC\\Memcache\\Factory"]},{"file":"\/srv\/nextcloud\/lib\/private\/ServerContainer.php","line":132,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OC\\Memcache\\Factory"]},{"file":"\/srv\/nextcloud\/lib\/private\/Server.php","line":986,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OC\\Memcache\\Factory"]},{"file":"\/srv\/nextcloud\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php","line":118,"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/nextcloud\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php","line":117,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OC\\Template\\JSCombiner"]},{"file":"\/srv\/nextcloud\/lib\/private\/ServerContainer.php","line":132,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OC\\Template\\JSCombiner"]},{"file":"\/srv\/nextcloud\/lib\/private\/TemplateLayout.php","line":320,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OC\\Template\\JSCombiner"]},{"file":"\/srv\/nextcloud\/lib\/private\/TemplateLayout.php","line":154,"function":"findJavascriptFiles","class":"OC\\TemplateLayout","type":"::","args":[["vendor\/core","js\/merged-template-prepend","search\/js\/search","core\/l10n\/de_DE","search\/l10n\/de_DE","search\/js\/searchprovider","js\/jquery-ui-fixes","js\/files\/fileinfo","js\/files\/client","js\/contactsmenu","js\/contactsmenu_templates"]]},{"file":"\/srv\/nextcloud\/lib\/private\/legacy\/template.php","line":211,"function":"__construct","class":"OC\\TemplateLayout","type":"->","args":["error",""]},{"file":"\/srv\/nextcloud\/lib\/private\/Template\/Base.php","line":132,"function":"fetchPage","class":"OC_Template","type":"->","args":[]},{"file":"\/srv\/nextcloud\/lib\/private\/legacy\/template.php","line":360,"function":"printPage","class":"OC\\Template\\Base","type":"->","args":[]},{"file":"\/srv\/nextcloud\/index.php","line":61,"function":"printExceptionErrorPage","class":"OC_Template","type":"::","args":[{"__class__":"OC\\HintException"},500]}],"File":"\/srv\/nextcloud\/lib\/private\/Memcache\/Factory.php","Line":99,"Hint":"Is the matching PHP module installed and enabled?","CustomMessage":"--"}

Seems to be some issue with Caching?!?

Got it - Purged php7.0 and php7.2, then restarted php-fpm and apache … Now I’m back in Action!!! THX a lot!

1 Like