danb35 / freenas-iocage-nextcloud

Script to create an iocage jail on FreeNAS for the latest Nextcloud 28 release, including Caddy, MariaDB or PostgreSQL, and Let's Encrypt
GNU General Public License v3.0
252 stars 71 forks source link

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

Closed pidupuis closed 2 years ago

pidupuis commented 3 years ago

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.

Nextcloud version: 21.0.0 Operating system: Freenas 12.0 Nginx version: Nginx 1.18.0 PHP version: 7.4.16

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

{"reqId":"g4kucObspA3odppgBcT8","level":3,"time":"2021-03-27T11:24:16+00:00","remoteAddr":"xxx.xxx.xxx.xxx","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":"17.0.0.9"}

The output of my 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: 192.168.1.254, server: xxxxxxxxxxxxx.com, request: "PROPFIND /remote.php/dav/files/pidupuis/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/nextcloud-php-fpm.sock:", host: "xxxxxxxxx.com"

Thanks a lot for your help!

pidupuis commented 3 years ago

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/nextcloud.pid ended
Electro707 commented 3 years ago

Ok, I think I found a solution (seems to be working so far):

In your jail, first make a copy of /usr/local/etc/mysql/my.cnf as a backup (I copied to into /usr/local/etc/mysql/my.cnf.bak).

Then go inside that file and delete/comment the following 2 lines:

query_cache_type                = 0
query_cache_size                = 0

Then restart the mysql service (service mysql-server start)