No web access after upgrade to 21.0.1

Support intro

After upgrading to 21.0.1 I am unable to access NextCloud. It appears that a configuration setting is wrong, but I can’t figure out what it is. Here’s the basics of what I am facing:

  • When I attempt to access nextcloud via the browser, I get an internal error 500.
  • I am unable to access nextcloud via any applications either

Here’s my setup:

  • I have nextcloud installed in Ubuntu on a home server. Nextcloud is the only thing running on that server.
  • Apache is running and I am able to access a sample index.html page either from “localhost” on the server itself, or from my ddns url.
  • I receive the error when I restore the index.html and index.php files from the nextcloud installation.
  • my web access point is /var/www/html
  • my data is located at /var/nextcloud-data
  • I think it may be a permissions issue … but I’m unsure how to resolve it … I see this error in my log: General error: 1018 Can’t read dir of ‘./nextcloud/’ (errno: 13 “Permission denied”)"

Nextcloud version 21.0.1
Operating system and version Ubuntu 20.04.2 LTS
Apache 2.4.41
PHP version 7.4.3 (cli)
The issue you are facing:

Unable to access nextcloud via webbrowser or apps.
Steps to replicate it:

  1. Point to target url (localhost or ddns url)
  2. Internal server error page appears.

The output of your Nextcloud log in Admin > Logging:

{"reqId":"fLrBZitg7gri7YqKQzdV","level":3,"time":"2021-05-14T15:04:46+00:00","remoteAddr":"192.168.86.1","user":"admin","app":"index","method":"GET","url":"/index.php/settings/ajax/checksetup","message":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1018 Can't read dir of './nextcloud/' (errno: 13 \"Permission denied\")","Code":1018,"Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1728,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1667,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":813,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php","line":224,"function":"fetchAllAssociative","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php","line":257,"function":"listTableNames","class":"Doctrine\\DBAL\\Schema\\AbstractSchemaManager","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php","line":1074,"function":"listTables","class":"Doctrine\\DBAL\\Schema\\AbstractSchemaManager","type":"->"},{"file":"/var/www/html/lib/private/DB/Migrator.php","line":188,"function":"createSchema","class":"Doctrine\\DBAL\\Schema\\AbstractSchemaManager","type":"->"},{"file":"/var/www/html/lib/private/DB/Connection.php","line":511,"function":"createSchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/html/lib/private/DB/SchemaWrapper.php","line":43,"function":"createSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/core/Application.php","line":196,"function":"__construct","class":"OC\\DB\\SchemaWrapper","type":"->"},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":264,"function":"OC\\Core\\{closure}","class":"OC\\Core\\Application","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":239,"function":"doDispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/lib/private/EventDispatcher/SymfonyAdapter.php","line":94,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/apps/settings/lib/Controller/CheckSetupController.php","line":473,"function":"dispatch","class":"OC\\EventDispatcher\\SymfonyAdapter","type":"->"},{"file":"/var/www/html/apps/settings/lib/Controller/CheckSetupController.php","line":751,"function":"hasMissingPrimaryKeys","class":"OCA\\Settings\\Controller\\CheckSetupController","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"check","class":"OCA\\Settings\\Controller\\CheckSetupController","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":114,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1018 Can't read dir of './nextcloud/' (errno: 13 \"Permission denied\")","Code":1018,"Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1728,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1667,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1040,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/lib/private/DB/Connection.php","line":226,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":811,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php","line":224,"function":"fetchAllAssociative","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php","line":257,"function":"listTableNames","class":"Doctrine\\DBAL\\Schema\\AbstractSchemaManager","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php","line":1074,"function":"listTables","class":"Doctrine\\DBAL\\Schema\\AbstractSchemaManager","type":"->"},{"file":"/var/www/html/lib/private/DB/Migrator.php","line":188,"function":"createSchema","class":"Doctrine\\DBAL\\Schema\\AbstractSchemaManager","type":"->"},{"file":"/var/www/html/lib/private/DB/Connection.php","line":511,"function":"createSchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/html/lib/private/DB/SchemaWrapper.php","line":43,"function":"createSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/core/Application.php","line":196,"function":"__construct","class":"OC\\DB\\SchemaWrapper","type":"->"},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":264,"function":"OC\\Core\\{closure}","class":"OC\\Core\\Application","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":239,"function":"doDispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/lib/private/EventDispatcher/SymfonyAdapter.php","line":94,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/apps/settings/lib/Controller/CheckSetupController.php","line":473,"function":"dispatch","class":"OC\\EventDispatcher\\SymfonyAdapter","type":"->"},{"file":"/var/www/html/apps/settings/lib/Controller/CheckSetupController.php","line":751,"function":"hasMissingPrimaryKeys","class":"OCA\\Settings\\Controller\\CheckSetupController","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"check","class":"OCA\\Settings\\Controller\\CheckSetupController","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":114,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[HY000]: General error: 1018 Can't read dir of './nextcloud/' (errno: 13 \"Permission denied\")","Code":1018,"Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":87,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1035,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->"},{"file":"/var/www/html/lib/private/DB/Connection.php","line":226,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":811,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php","line":224,"function":"fetchAllAssociative","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php","line":257,"function":"listTableNames","class":"Doctrine\\DBAL\\Schema\\AbstractSchemaManager","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php","line":1074,"function":"listTables","class":"Doctrine\\DBAL\\Schema\\AbstractSchemaManager","type":"->"},{"file":"/var/www/html/lib/private/DB/Migrator.php","line":188,"function":"createSchema","class":"Doctrine\\DBAL\\Schema\\AbstractSchemaManager","type":"->"},{"file":"/var/www/html/lib/private/DB/Connection.php","line":511,"function":"createSchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/html/lib/private/DB/SchemaWrapper.php","line":43,"function":"createSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/core/Application.php","line":196,"function":"__construct","class":"OC\\DB\\SchemaWrapper","type":"->"},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":264,"function":"OC\\Core\\{closure}","class":"OC\\Core\\Application","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":239,"function":"doDispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/lib/private/EventDispatcher/SymfonyAdapter.php","line":94,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/apps/settings/lib/Controller/CheckSetupController.php","line":473,"function":"dispatch","class":"OC\\EventDispatcher\\SymfonyAdapter","type":"->"},{"file":"/var/www/html/apps/settings/lib/Controller/CheckSetupController.php","line":751,"function":"hasMissingPrimaryKeys","class":"OCA\\Settings\\Controller\\CheckSetupController","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"check","class":"OCA\\Settings\\Controller\\CheckSetupController","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":26,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[HY000]: General error: 1018 Can't read dir of './nextcloud/' (errno: 13 \"Permission denied\")","Code":"HY000","Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":82,"function":"query","class":"PDO","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1035,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->"},{"file":"/var/www/html/lib/private/DB/Connection.php","line":226,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":811,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php","line":224,"function":"fetchAllAssociative","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php","line":257,"function":"listTableNames","class":"Doctrine\\DBAL\\Schema\\AbstractSchemaManager","type":"->"},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php","line":1074,"function":"listTables","class":"Doctrine\\DBAL\\Schema\\AbstractSchemaManager","type":"->"},{"file":"/var/www/html/lib/private/DB/Migrator.php","line":188,"function":"createSchema","class":"Doctrine\\DBAL\\Schema\\AbstractSchemaManager","type":"->"},{"file":"/var/www/html/lib/private/DB/Connection.php","line":511,"function":"createSchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/html/lib/private/DB/SchemaWrapper.php","line":43,"function":"createSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/core/Application.php","line":196,"function":"__construct","class":"OC\\DB\\SchemaWrapper","type":"->"},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":264,"function":"OC\\Core\\{closure}","class":"OC\\Core\\Application","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":239,"function":"doDispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/lib/private/EventDispatcher/SymfonyAdapter.php","line":94,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/apps/settings/lib/Controller/CheckSetupController.php","line":473,"function":"dispatch","class":"OC\\EventDispatcher\\SymfonyAdapter","type":"->"},{"file":"/var/www/html/apps/settings/lib/Controller/CheckSetupController.php","line":751,"function":"hasMissingPrimaryKeys","class":"OCA\\Settings\\Controller\\CheckSetupController","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"check","class":"OCA\\Settings\\Controller\\CheckSetupController","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","Line":82}}},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.1.1"}

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

<?php
$CONFIG = array (
  'instanceid' => '[redacted]',
  'passwordsalt' => '[redacted]',
  'secret' => '[redacted]',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'texas-house.ddns.net',
  ),
  'datadirectory' => '/var/nextcloud-data',
  'dbtype' => 'mysql',
  'version' => '21.0.1.1',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => '[redacted]',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '[redacted]',
  'dbpassword' => '[redacted]',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'installed' => true,
  'updater.secret' => '[redacted]',
  'maintenance' => false,
  'loglevel' => 2,
  'theme' => '',
);

Here is the permissions for my folders (which is where I think my error is):

/var/nextcloud-data
drwxr-x--- 16 www-data www-data 4096 May 14 10:50 nextcloud-data
Within that folder I have this:
root@nathan-nextcloud:/var/nextcloud-data# ls -la
total 3296
drwxr-x--- 16 www-data www-data    4096 May 14 10:50 .
drwxr-xr-x 17 www-data www-data    4096 Jan  6 18:59 ..
drwxr-xr-x  4 www-data www-data    4096 Oct  9  2020 admin
drwxr-xr-x 13 www-data www-data    4096 Oct 10  2020 appdata_oc9kj53hd1h0
drwxr-xr-x  2 www-data www-data    4096 Oct  9  2020 cassidy
drwxr-xr-x  6 www-data www-data    4096 Jan  7 19:34 dawn
drwxr-xr-x  2 www-data www-data    4096 Jan 31 18:16 eric
drwxrwxr-x  2 www-data www-data    4096 May 12 08:09 files_external
-rw-r--r--  1 root     www-data     542 May 14 09:34 .htaccess
-rw-r-----  1 www-data www-data       0 May 14 09:34 index.html
drwxr-xr-x  6 www-data www-data    4096 Feb  7 22:09 jamie
drwxr-xr-x  2 www-data www-data    4096 Oct  9  2020 karen
drwxr-xr-x  4 www-data www-data    4096 Feb 14 12:04 laurel
drwx------  2 www-data www-data   16384 Oct  9  2020 lost+found
drwxr-xr-x  7 www-data www-data    4096 Nov  2  2020 lynn
drwxr-xr-x  7 www-data www-data    4096 Oct 17  2020 nathan
-rw-r-----  1 www-data www-data 3224500 May 14 10:04 nextcloud.log
-rw-r-----  1 www-data www-data       0 May 14 09:34 .ocdata
drwxr-xr-x  2 www-data www-data    4096 Oct  9  2020 ryan
-rw-r-----  1 www-data www-data   60306 May 14 09:34 updater.log
drwxr-xr-x  4 www-data www-data    4096 May 14 09:34 updater-oc9kj53hd1h0


/var/www/html
drwxrwxr-x 13 www-data www-data 4096 May 17 13:51 html
And under that directory
root@nathan-nextcloud:/var/www/html# ls -la
total 168
drwxrwxr-x 13 www-data www-data  4096 May 17 13:51 .
drwxr-xr-x  3 www-data www-data  4096 Oct  9  2020 ..
drwxrwxr-x 43 www-data www-data  4096 May 14 09:33 3rdparty
drwxrwxr-x 53 www-data www-data  4096 May 14 09:34 apps
-rw-rw-r--  1 www-data www-data 17900 May 14 09:34 AUTHORS
drwxrwxr-x  2 www-data www-data  4096 May 14 09:34 config
-rw-rw-r--  1 www-data www-data  3900 May 14 09:33 console.php
-rw-rw-r--  1 www-data www-data 34520 May 14 09:34 COPYING
drwxrwxr-x 22 www-data www-data  4096 May 14 09:33 core
-rw-rw-r--  1 www-data www-data  5122 May 14 09:33 cron.php
-rw-rw-r--  1 www-data www-data  2826 May 14 09:34 .htaccess
-rw-rw-r--  1 www-data www-data   286 May 17 13:47 index.html
-rw-rw-r--  1 www-data www-data   156 May 14 09:33 index.html.old
-rw-rw-r--  1 www-data www-data  2960 May 14 09:34 index.php.old
drwxrwxr-x  6 www-data www-data  4096 May 14 09:34 lib
-rw-rw-r--  1 www-data www-data   283 May 14 09:34 occ
drwxrwxr-x  2 www-data www-data  4096 May 14 09:33 ocm-provider
drwxrwxr-x  2 www-data www-data  4096 May 14 09:34 ocs
drwxrwxr-x  2 www-data www-data  4096 May 14 09:34 ocs-provider
-rw-rw-r--  1 www-data www-data  3144 May 14 09:34 public.php
-rw-rw-r--  1 www-data www-data  5341 May 14 09:34 remote.php
drwxrwxr-x  4 www-data www-data  4096 May 14 09:34 resources
-rw-rw-r--  1 www-data www-data    26 May 14 09:33 robots.txt
-rw-rw-r--  1 www-data www-data  2446 May 14 09:34 status.php
drwxrwxr-x  3 www-data www-data  4096 May 14 09:34 themes
drwxrwxr-x  2 www-data www-data  4096 Oct  2  2020 updater
-rw-rw-r--  1 www-data www-data   101 May 14 09:34 .user.ini
-rw-rw-r--  1 www-data www-data   382 May 14 09:33 version.php

That’s a really weird error.

“An exception occurred while executing a query: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1018 Can’t read dir of ‘./nextcloud/’ (errno: 13 “Permission denied”)”

So that’s an SQL (database) error, which has NOTHING to do with your nextcloud installation path. So what you need to look at is the filesystem path where the database itself is located. Probably something like “/var/lib/mysql/”, although I don’t use ubuntu, so they could have it somewhere else.

Thank you for the tip. I tracked the problem down to the mariadb. It is not running, and I can’t seem to get it restarted. Here’s what I get for the status of the mariadb:

nathan@nathan-nextcloud:/var/lib/mysql$ sudo systemctl status mariadb.service
● mariadb.service - MariaDB 10.3.29 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2021-05-18 22:29:20 CDT; 9min ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 42509 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 42510 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 42512 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _>
    Process: 42560 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
   Main PID: 42560 (code=exited, status=1/FAILURE)
     Status: "MariaDB server is down"

May 18 22:29:20 nathan-nextcloud mysqld[42560]: 2021-05-18 22:29:20 0 [ERROR] Plugin 'InnoDB' init function returned error.
May 18 22:29:20 nathan-nextcloud mysqld[42560]: 2021-05-18 22:29:20 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
May 18 22:29:20 nathan-nextcloud mysqld[42560]: 2021-05-18 22:29:20 0 [Note] Plugin 'FEEDBACK' is disabled.
May 18 22:29:20 nathan-nextcloud mysqld[42560]: 2021-05-18 22:29:20 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
May 18 22:29:20 nathan-nextcloud mysqld[42560]: 2021-05-18 22:29:20 0 [ERROR] Unknown/unsupported storage engine: InnoDB
May 18 22:29:20 nathan-nextcloud mysqld[42560]: 2021-05-18 22:29:20 0 [ERROR] Aborting
May 18 22:29:20 nathan-nextcloud mysqld[42560]: Warning: Memory not freed: 520
May 18 22:29:20 nathan-nextcloud systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
May 18 22:29:20 nathan-nextcloud systemd[1]: mariadb.service: Failed with result 'exit-code'.
May 18 22:29:20 nathan-nextcloud systemd[1]: Failed to start MariaDB 10.3.29 database server.

I’ve tried advice from here with no success. The only other advice I can find is to delete everything in /var/lib/mysql and then reinstall mariadb. BUT, that will kill my database for nextcloud. Is there a backup of the mysql folder anywhere from the update? Or is there anything I can do to “save” the database? (for example, can I save the files in /var/lib/mysql/nextcloud and then add them back after rebuilding maridb?)

Here’s the error from the mysql log just before everything crashed:
2021-05-13 6:00:52 0 [Note] /usr/sbin/mysqld (initiated by: unknown): Normal shutdown
2021-05-13 6:00:52 0 [Note] Event Scheduler: Purging the queue. 0 events
2021-05-13 6:00:52 0 [Note] InnoDB: FTS optimize thread exiting.
2021-05-13 6:00:52 0 [Note] InnoDB: Starting shutdown…
2021-05-13 6:00:52 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2021-05-13 6:00:52 0 [Note] InnoDB: Instance 0, restricted to 2048 pages due to innodb_buf_pool_dump_pct=25
2021-05-13 6:00:52 0 [Note] InnoDB: Buffer pool(s) dump completed at 210513 6:00:52
2021-05-13 6:00:54 0 [Note] InnoDB: Shutdown completed; log sequence number 6263759943; transaction id 3622369
2021-05-13 6:00:54 0 [Note] InnoDB: Removed temporary tablespace data file: “ibtmp1”
2021-05-13 6:00:54 0 [Note] /usr/sbin/mysqld: Shutdown complete

2021-05-13  6:01:00 0 [Note] InnoDB: Using Linux native AIO
2021-05-13  6:01:00 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-05-13  6:01:00 0 [Note] InnoDB: Uses event mutexes
2021-05-13  6:01:00 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-05-13  6:01:00 0 [Note] InnoDB: Number of pools: 1
2021-05-13  6:01:00 0 [Note] InnoDB: Using SSE2 crc32 instructions
2021-05-13  6:01:00 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-05-13  6:01:00 0 [Note] InnoDB: Completed initialization of buffer pool
2021-05-13  6:01:00 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-05-13  6:01:00 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2021-05-13  6:01:00 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-05-13  6:01:00 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-05-13  6:01:00 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-05-13  6:01:00 0 [Note] InnoDB: 10.3.29 started; log sequence number 6263759952; transaction id 3622370
2021-05-13  6:01:00 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-05-13  6:01:00 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-05-13  6:01:00 0 [Note] Server socket created on IP: '127.0.0.1'.
2021-05-13  6:01:00 0 [Note] Reading of all Master_info entries succeeded
2021-05-13  6:01:00 0 [Note] Added new Master_info '' to hash table
2021-05-13  6:01:00 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.3.29-MariaDB-0ubuntu0.20.04.1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Ubuntu 20.04
2021-05-13  6:01:00 0 [Note] InnoDB: Buffer pool(s) load completed at 210513  6:01:00
2021-05-14 10:02:47 10883 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-05-14 10:02:47 10883 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-05-14 10:02:47 10883 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-05-14 10:02:47 10883 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-05-14 10:02:47 10883 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-05-14 10:02:47 10883 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-05-14 10:02:47 10883 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-05-14 10:02:47 10883 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-05-14 10:02:49 10893 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-05-14 10:02:49 10893 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-05-14 10:02:49 10893 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-05-14 10:02:49 10893 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-05-14 10:02:49 10896 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-05-14 10:02:49 10896 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-05-14 10:02:49 10896 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-05-14 10:02:49 10896 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-05-14 10:02:49 10893 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-05-14 10:02:49 10893 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-05-14 10:02:50 10903 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-05-14 10:02:50 10903 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-05-14 10:02:50 10903 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-05-14 10:02:50 10903 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-05-14 10:09:48 0 [Note] /usr/sbin/mysqld (initiated by: unknown): Normal shutdown
2021-05-14 10:09:48 0 [Note] Event Scheduler: Purging the queue. 0 events
2021-05-14 10:09:48 0 [Note] InnoDB: FTS optimize thread exiting.
2021-05-14 10:09:48 0 [Note] InnoDB: Starting shutdown...
2021-05-14 10:09:48 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2021-05-14 10:09:48 0 [ERROR] InnoDB: Cannot open '/var/lib/mysql/ib_buffer_pool.incomplete' for writing: Permission denied
2021-05-14 10:09:50 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-05-14 10:09:50 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-05-14 10:09:50 0 [Note] InnoDB: Shutdown completed; log sequence number 6286304661; transaction id 3633479
2021-05-14 10:09:50 0 [ERROR] mysqld: Error on delete of './tc.log' (Errcode: 13 "Permission denied")
2021-05-14 10:09:50 0 [Note] /usr/sbin/mysqld: Shutdown complete

So, after fighting and fighting, I was able to restore service.
This may not be proper, but what I did was chmod 777 to the directory /var/lib/mysql and then restart the mariadb server and it started working. Then everything worked again. I have no idea what caused this problem or why.

I hope not recursively, otherwise you made your database world accessable. Well at least for everyone who has access to the filessystem of the server :wink:

Default for the /var/lib/mysql folder is 755 and it should be owned by the mysql user. But more important are the actual database folders. e.g /var/lib/mysql/nextcloud. This folder should have 700:

drwx------  2 mysql mysql     20480 Mai 11 07:03 nextcloud

…and the content 660:

-rw-rw---- 1 mysql mysql       67 Aug  6  2020 db.opt
-rw-rw---- 1 mysql mysql     3997 Feb  5 10:17 oc_accounts_data.frm
-rw-rw---- 1 mysql mysql    73728 Feb  5 10:17 oc_accounts_data.ibd
-rw-rw---- 1 mysql mysql     1210 Aug  6  2020 oc_accounts.frm
-rw-rw---- 1 mysql mysql    65536 Mär 31 08:45 oc_accounts.ibd

etc…

@bb77 Thank you for the good advice. I have updated the permissions as suggested. Things are still working too :slight_smile:

1 Like