Internal Server Error shortly after upgraded to v21

Hello all,

Getting a "Internal Server Error"
“The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.”

Nextcloud version (eg, 20.0.5): 21.0.1.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu Server 18.04.5 LTS (Bionic Beaver)
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.46
PHP version (eg, 7.4): 7.4.16
CONF’s Enabled
/etc/apache2/conf-enabled/phpmyadmin.conf
/etc/apache2/conf-enabled/php7.4-fpm.conf
MySQL: 8.0.23

I have tried:
-A reboot.
-Running OCC commands always result in a “killed” response.
-I looked at the troubleshooting guide.
-All my other PHP apps are working fine in Apache

Questions
-Is it an DB error?
-Re-install nextcloud files and keep the data directory the same?
-Try a fresh config file?

Nextcloud.log (in the data dir)
{“reqId”:“Fuav94NxESKpcY1fHjIC”,“level”:3,“time”:“2021-04-16T18:25:11+00:00”,“remoteAddr”:"",“user”:"–",“app”:“cron”,“method”:"",“url”:"–",“message”:{“Exception”:“Doctrine\DBAL\Exception\DriverException”,“Message”:“An exception occurred while executing a query: SQLSTATE[08S01]: Communication link failure: 1053 Server shutdown in progress”,“Code”:1053,“Trace”:[{“file”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Connection.php",“line”:1728,“function”:“convert”,“class”:“Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Connection.php",“line”:1667,“function”:“handleDriverException”,“class”:“Doctrine\DBAL\Connection”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Connection.php",“line”:1146,“function”:“convertExceptionDuringQuery”,“class”:“Doctrine\DBAL\Connection”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/private/DB/Connection.php",“line”:257,“function”:“executeStatement”,“class”:“Doctrine\DBAL\Connection”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",“line”:213,“function”:“executeStatement”,“class”:“OC\DB\Connection”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/private/DB/QueryBuilder/QueryBuilder.php",“line”:287,“function”:“execute”,“class”:“Doctrine\DBAL\Query\QueryBuilder”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/private/AppConfig.php",“line”:259,“function”:“execute”,“class”:“OC\DB\QueryBuilder\QueryBuilder”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/private/AllConfig.php",“line”:232,“function”:“deleteKey”,“class”:“OC\AppConfig”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/base.php",“line”:682,“function”:“deleteAppValue”,“class”:“OC\AllConfig”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/base.php",“line”:1076,“function”:“init”,“class”:“OC”,“type”:"::"},{“file”:"/var/www/cloud.jensen.house/cron.php",“line”:43,“args”:["/var/www/cloud.jensen.house/lib/base.php"],“function”:“require_once”}],“File”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php",“Line”:114,“Previous”:{“Exception”:“Doctrine\DBAL\Driver\PDO\Exception”,“Message”:“SQLSTATE[08S01]: Communication link failure: 1053 Server shutdown in progress”,“Code”:1053,“Trace”:[{“file”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",“line”:84,“function”:“new”,“class”:“Doctrine\DBAL\Driver\PDO\Exception”,“type”:"::"},{“file”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Connection.php",“line”:1138,“function”:“execute”,“class”:“Doctrine\DBAL\Driver\PDO\Statement”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/private/DB/Connection.php",“line”:257,“function”:“executeStatement”,“class”:“Doctrine\DBAL\Connection”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",“line”:213,“function”:“executeStatement”,“class”:“OC\DB\Connection”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/private/DB/QueryBuilder/QueryBuilder.php",“line”:287,“function”:“execute”,“class”:“Doctrine\DBAL\Query\QueryBuilder”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/private/AppConfig.php",“line”:259,“function”:“execute”,“class”:“OC\DB\QueryBuilder\QueryBuilder”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/private/AllConfig.php",“line”:232,“function”:“deleteKey”,“class”:“OC\AppConfig”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/base.php",“line”:682,“function”:“deleteAppValue”,“class”:“OC\AllConfig”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/base.php",“line”:1076,“function”:“init”,“class”:“OC”,“type”:"::"},{“file”:"/var/www/cloud.jensen.house/cron.php",“line”:43,“args”:["/var/www/cloud.jensen.house/lib/base.php"],“function”:“require_once”}],“File”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php",“Line”:26,“Previous”:{“Exception”:“PDOException”,“Message”:“SQLSTATE[08S01]: Communication link failure: 1053 Server shutdown in progress”,“Code”:“08S01”,“Trace”:[{“file”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",“line”:82,“function”:“execute”,“class”:“PDOStatement”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Connection.php",“line”:1138,“function”:“execute”,“class”:“Doctrine\DBAL\Driver\PDO\Statement”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/private/DB/Connection.php",“line”:257,“function”:“executeStatement”,“class”:“Doctrine\DBAL\Connection”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",“line”:213,“function”:“executeStatement”,“class”:“OC\DB\Connection”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/private/DB/QueryBuilder/QueryBuilder.php",“line”:287,“function”:“execute”,“class”:“Doctrine\DBAL\Query\QueryBuilder”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/private/AppConfig.php",“line”:259,“function”:“execute”,“class”:“OC\DB\QueryBuilder\QueryBuilder”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/private/AllConfig.php",“line”:232,“function”:“deleteKey”,“class”:“OC\AppConfig”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/base.php",“line”:682,“function”:“deleteAppValue”,“class”:“OC\AllConfig”,“type”:"->"},{“file”:"/var/www/cloud.jensen.house/lib/base.php",“line”:1076,“function”:“init”,“class”:“OC”,“type”:"::"},{“file”:"/var/www/cloud.jensen.house/cron.php",“line”:43,“args”:["/var/www/cloud.jensen.house/lib/base.php"],“function”:“require_once”}],“File”:"/var/www/cloud.jensen.house/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",“Line”:82}},“CustomMessage”:"–"},“userAgent”:"–",“version”:“21.0.1.1”}

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

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):
<?php
$CONFIG = array (
‘instanceid’ => ‘ocartvwh95oc’,
‘passwordsalt’ => ‘’,
‘secret’ => '
’,
‘trusted_domains’ =>
array (
0 => ‘cloud.jensen.house’,
),
‘datadirectory’ => ‘/var/nextcloud_data’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘21.0.1.1’,
‘overwrite.cli.url’ => ‘https://cloud.jensen.house’,
‘default_phone_region’ => ‘US’,
‘dbname’ => ‘nextcloud’,
‘dbhost’ => ‘localhost’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘mysql.utf8mb4’ => true,
‘dbuser’ => 'oc_aar
***’,
‘dbpassword’ => ‘’,
‘installed’ => true,
‘htaccess.RewriteBase’ => ‘/’,
‘memcache.local’ => ‘\OC\Memcache\Redis’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘filelocking.enabled’ => ‘true’,
‘redis’ =>
array (
‘host’ => ‘/var/run/redis/redis.sock’,
‘port’ => 0,
‘timeout’ => 0.0,
),
‘mail_smtpmode’ => ‘smtp’,
‘mail_smtpsecure’ => ‘tls’,
‘mail_sendmailmode’ => ‘smtp’,
‘mail_from_address’ => ‘admin’,
‘mail_domain’ => ‘adjensen.com’,
‘mail_smtphost’ => ‘smtp.fastmail.com’,
‘mail_smtpport’ => ‘587’,
‘mail_smtpauth’ => 1,
‘mail_smtpname’ => 'aaron@
.com’,
‘mail_smtppassword’ => '
***’,
‘mail_smtpauthtype’ => ‘LOGIN’,
‘maintenance’ => false,
‘theme’ => ‘’,
‘loglevel’ => 2,
‘twofactor_enforced’ => ‘true’,
‘twofactor_enforced_groups’ =>
array (
),
‘twofactor_enforced_excluded_groups’ =>
array (
),
‘encryption.legacy_format_support’ => false,
‘encryption.key_storage_migrated’ => false,
‘app_install_overwrite’ =>
array (
0 => ‘occweb’,
),
‘updater.release.channel’ => ‘stable’,
);

`

The output of your Apache/nginx/system log in /var/log/____:
I am not getting much of any errors.

Hey @memphis2k hope you doing well…

Let’s try to fix your server mate. :smiley:

But first, one question: Do you have any cache service running? Example: Redis.

1) sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
2) chown -R www-data:www-data /var/www/nextcloud/
3) chmod -R 770 /var/www/nextcloud/
4) sudo -u www-data php /var/www/nextcloud/occ maintenance:repair
5) sudo -u www-data php /var/www/nextcloud/occ db:add-missing-columns
6) sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices
7) sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess
8) sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off
9) sudo systemctl restart apache2

Also, check your php version running “php -v”, that can help a lot.

Make sure you have php-fpm installed and running.

Hope this helps, have a nice weekend.

All the best!

:smiley:

Cache:
Redis
‘memcache.local’ => ‘\OC\Memcache\Redis’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
and I am running OPcache too, but I don’t believe with Nextcloud.

All 9 steps were executed. No errors.
-I am running Nextcloud with HAProxy on pfSense 2.5.1. Tested internally & externally and still getting the same result.

PHP version: 7.4.16
CONF’s Enabled
/etc/apache2/conf-enabled/phpmyadmin.conf
/etc/apache2/conf-enabled/php7.4-fpm.conf

PHP 7.4 FPM is running.

Any other suggestions? I really appreciate this.

Still not solved, but I tried a couple different things and I’m having user/password issues with Nextcloud/mysql.

MySQL username and/or password not valid You need to enter details of an existing account.

I have tried ROOT, created different users in phpmyadmin, GRANTed every permission possible. Tried all 4 types of password hashing. Still can’t get a new instance to install.

I had a similar issue: After upgrading from v20 to v21 everything seemed fine. When logging in the site would show ‘Internal server error’.

I removed the two-factor yubikey app, twofactor_yubikey in /var/www/nextcloud/apps
Now everything works fine again.