Nextcloud 21 internal server error after Freenas upgrade from 11.2 to 12.0

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 21.0.0
Operating system and version (eg, Ubuntu 20.04): Freenas 12.0
Apache or nginx version (eg, Apache 2.4.25): Nginx 1.18.0
PHP version (eg, 7.4): 7.4.16

The issue you are facing:

After upgrading my Freenas from 11.2 to 12.0 and upgrading Nextcloud plugins, I can’t access nextcloud web interface anymore. I end up with the “Internal Server Error” standard page. The nextcloud mobile app can not sync anymore. I can’t sync my calendar and contacts anymore.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Upgrade your freenas from 11.2 to 12.0
  2. Upgrade nextcloud jail and plugin

The output of your Nextcloud log in /var/log/nextcloud/nextcloud.log:

{"reqId":"g4kucObspA3odppgBcT8","level":3,"time":"2021-03-27T11:24:16+00:00","remoteAddr":"","user":"--","app":"PHP","method":"GET","url":"\/ecp\/D.js","message":"Exception: The requested uri(\/ecp\/D.js) cannot be processedby the script '\/core\/templates\/404.php') at \/usr\/local\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Request.php#780","userAgent":"Mozilla\/4.0 (compatible; MSIE 6.0; Windows NT 5.1)","version":""}

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

2021/03/30 03:51:46 [error] 20466#101914: *1404 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory in /usr/local/www/nextcloud/lib/private/DB/Connection.php:85
Stack trace:
#0 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1486): OC\DB\Connection->connect()
#1 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1014): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /usr/local/www/nextcloud/lib/private/DB/Connection.php(226): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM `...', Array, Array, NULL)
#3 /usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(210): OC\DB\Connection->executeQuery('SELECT * FROM `...', Array, Array)
#4 /usr/local/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(286): Doctrine\DBAL\Query\QueryBuild
ib/private/DB/QueryBuilder/QueryBuilder.php(286): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /usr/local/www/nextcloud/lib/private/AppConfig.php(345): OC\DB\QueryBuilder\QueryBuilder->execute()" while reading response header from upstream, client:, server:, request: "PROPFIND /remote.php/dav/files/pidupuis/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/nextcloud-php-fpm.sock:", host: ""

Thanks a lot for your help!

— EDIT —

From /var/db/mysql/nextcloud.err:

2021-03-31T18:43:16.6NZ mysqld_safe Logging to '/var/db/mysql/nextcloud.err'.
2021-03-31T18:43:16.6NZ mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
2021-03-31T18:43:17.528770Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They willbe merged with strict mode in a future release.
2021-03-31T18:43:17.529006Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2021-03-31T18:43:17.546274Z 0 [Note] /usr/local/libexec/mysqld (mysqld 5.7.33-log) starting as process 3720 ...
2021-03-31T18:43:17.754188Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-03-31T18:43:17.754261Z 0 [Note] InnoDB: Uses event mutexes
2021-03-31T18:43:17.754281Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-03-31T18:43:17.754299Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-03-31T18:43:17.754823Z 0 [Note] InnoDB: Number of pools: 1
2021-03-31T18:43:17.759451Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-03-31T18:43:17.762576Z 0 [Note] InnoDB: Initializing buffer pool, total size = 10M, instances = 1, chunk size = 10M
2021-03-31T18:43:17.766447Z 0 [Note] InnoDB: Completed initialization of bufferpool
2021-03-31T18:43:17.778417Z 0 [ERROR] InnoDB: The Auto-extending innodb_system data file '/var/db/mysql/ibdata1' is of a different size 4864 pages (rounded down to MB) than specified in the .cnf file: initial 8192 pages, max 0 (relevant ifnon-zero) pages!
2021-03-31T18:43:17.778470Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-03-31T18:43:18.100721Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-03-31T18:43:18.100788Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGEENGINE failed.
2021-03-31T18:43:18.100809Z 0 [ERROR] Failed to initialize builtin plugins.
2021-03-31T18:43:18.100824Z 0 [ERROR] Aborting
2021-03-31T18:43:18.101103Z 0 [Note] Binlog end
2021-03-31T18:43:18.101521Z 0 [Note] Shutting down plugin 'CSV'
2021-03-31T18:43:18.101750Z 0 [Note] /usr/local/libexec/mysqld: Shutdown complete
2021-03-31T18:43:18.6NZ mysqld_safe mysqld from pid file /var/db/mysql/ ended

Looking at the mysql log output, it looks like a MySQL Tablespace problem, after upgrading your FreeNAS.

2021-03-31T18:43:17.778417Z 0 [ERROR] InnoDB: The Auto-extending innodb_system data file '/var/db/mysql/ibdata1' is of a different size 4864 pages (rounded down to MB) than specified in the .cnf file: initial 8192 pages, max 0 (relevant ifnon-zero) pages!

Have a look at the official documentation: MySQL :: MySQL 8.0 Reference Manual :: The System Tablespace

I just encountered the same error myself. Is there a fix the Tablespace problem?