[SOLVED] Blank login screen (500 error) after upgrade

Nextcloud version (eg, 20.0.5): 27.1.3
Operating system and version (eg, Ubuntu 20.04): Debian 12.4
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.57-2
PHP version (eg, 7.4): 8.2

The issue you are facing:

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

Steps to replicate it:

  1. enjoy a working Nextcloud 27.1.3 installation
  2. upgrade to Nextcloud 27.1.5
  3. try to access login page

The output of your Nextcloud log in Admin > Logging:

nothing here

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

<?php
$CONFIG = array (
  'instanceid' => 'xxxxx',
  'passwordsalt' => 'xxxxx',
  'secret' => 'xxxxx',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.mydomain.tld',
    1 => 'reverse_proxy_ip_address (10.0.0.100)',
    2 => 'rp.mydomain.tld',
  ),
  'trusted_proxies' => 
  array (
    0 => 'nextcloud.mydomain.tld',
    1 => 'reverse_proxy_ip_address (10.0.0.100)',
    2 => 'rp.mydomain.tld',
  ),
  'forwarded_for_headers' => 'HTTP_X_FORWARDED_FOR',
  'datadirectory' => '/data/nextcloud',
  'dbtype' => 'mysql',
  'version' => '27.1.3.2',
  'overwrite.cli.url' => 'https://nextcloud.mydomain.tld',
  'overwriteprotocol' => 'https',
  'overwritehost' => 'nextcloud.mydomain.tld',
  'overwritecondaddr' => '^10\\.0\\.0\\.100$',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxxxx',
  'dbpassword' => 'xxxxx',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apc.enable_cli' => 1,
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'mydomain.tld',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'xxxxx',
  'mail_smtpport' => 'xxxxx',
  'mail_smtpname' => 'xxxxx',
  'mail_smtppassword' => 'xxxxx',
  'default_phone_region' => 'FR',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'mail_from_address' => 'xxxxx',
  'mail_smtpsecure' => 'xxxxx',
);

The output of your Apache/nginx/system log in /var/log/____:
(nginx reverse proxy access log:)

[27/Dec/2023:18:00:50 +0100] "GET /index.php/login HTTP/1.1" 500 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0"

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

no errors showing

PHP modules on nextcloud host:

[PHP Modules]
apcu
bz2
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
random
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

Nginx reverse proxy host config:

server {
    listen xxxxx:80;
    server_name nextcloud.mydomain.tld;
    return 301 https://$host$request_uri;
}

server {
    listen xxxxx:443 ssl;
    server_name nextcloud.mydomain.tld;

    access_log /var/log/nginx/nextcloud.access.log;
    error_log /var/log/nginx/nextcloud.error.log;

    add_header Strict-Transport-Security "max-age=15552000"; 

    ssl_certificate /etc/letsencrypt/live/blablabla/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/blablabla/privkey.pem;

    ssl_stapling on;
    ssl_stapling_verify on;
    resolver 8.8.8.8 1.1.1.1 valid=300s;
    resolver_timeout 5s;

	proxy_set_header Host $host;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    location /.well-known/carddav {
      return 301 $scheme://$host/remote.php/dav;
    }

    location /.well-known/caldav {
      return 301 $scheme://$host/remote.php/dav;
    }  

    location /{
        proxy_pass http://10.0.0.201;
	proxy_set_header Host $host;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header X-Forwarded-Proto $scheme;
	proxy_set_header X-Forwarded-Ssl on;
	rewrite /nextcloud/(.*) /$1 break;
	client_max_body_size	10G;
    }
}

Apache host config:

<VirtualHost *:80>
	Alias /nextcloud "/var/www/nextcloud/"
	DocumentRoot /var/www/nextcloud/
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	<FilesMatch "\.php$">
		SetHandler  "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost/"
	</FilesMatch>

	<Directory /var/www/nextcloud/>
		Require all granted
		AllowOverride All
		Options FollowSymLinks MultiViews
		Header set Referrer-Policy "no-referrer-when-downgrade"

		SetEnv HOME /var/www/nextcloud
		SetEnv HTTP_HOME /var/www/nextcloud

		<IfModule mod_dav.c>
			Dav off
		</IfModule>
	 </Directory>
</VirtualHost>

Hello !

I have ben trying to upgrade nextcloud to 27.1.5, with the web based wizzard and / or the occ upgrade command.

Nextcloud is served by apache2 webserver (on LXC container) behind a nginx reverse proxy (separate VM) which handles SSL termination, at https://nextcloud.mydomain.tld

Upgrade works fine with either method, but after upgrade, I can no longer access the login form, only a blank page is displayed at https://nextcloud.mydomain.tld/index.php/login, and the webserver shows a 500 error.

Client synchronization still works fine, and if I try to access a non-existant page inside the nextcloud installation (i.e. https://nextcloud.mydomain.tld/randomstring), I get the expected output (Nextcloud 404 error page). Also, if the user authentication is cached in the browser, everything works fine, the only failure seems to be with index.php/login

As I can not allow for an extended downtime, I restored the backup, and so lost trace of log files from nextcloud 27.1.5, but I can reproduce if needed. I checked the nextcloud log (with debug level), disabled as many apps as possible, and also tried to manually upgrade to 28.0.1.

Nextcloud has first been installed few years ago, and all the upgrades went smoothly from Nextcloud 22 to 27.1.3.

Any pointers or advices would be appreciated, thanks !

Unfortunately I do not know how to solve your issue but this:

is definitely ineffective and does not belong in config.php but - in your case - in /etc/php/8.2/cli/php.ini


I really hope that there is someone who can help fix your problem.

Much luck,
ernolf

take a look at this threads - sounds similar

Thanks ernolf, indeed, I confirm this is ineffective, and needs only be written in /etc/php/<version>/cli/php.ini and /etc/php/<version>/fpm/php.ini in my case.

Thanks. Well, in my case, the instance works, except for the login page, whereas in this topic, the whole instance is mafunctionning. And the problem seems to be linked to a specific app (group folders) which I do not have (and I also tried with all apps disabled).

No. apc.enabled is “1” (enabled) by default for any NOT-CLI sapi, so you only need to enable it for cli with apc.enable_cli in the cli/php.ini. Nowhere else.

Much luck,
ernolf

Did you already try to get the login page from within an incognito tab?
Did you look the browser dev-console while caling the page?

That looks like /var/log/apache2/access.log
What is the output of /var/log/apache2/error.log?
After you altered loglevel in apache config:

	LogLevel info ssl:warn

(I’m just poking around in my head, without any concrete suspicion…) :thinking:

Much luck,
ernolf

Thanks for the follow up.

Yes I did, and also tried with different browsers. The console only showed 500 error while trying to access index.php/login

New attempt today, with apache info logs.

apache access.log:

apache access log
10.0.0.100 - - [28/Dec/2023:17:15:32 +0100] "GET / HTTP/1.0" 302 1443 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
10.0.0.100 - - [28/Dec/2023:17:15:32 +0100] "GET /index.php/login HTTP/1.0" 500 938 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"

(10.0.0.100 is the nginx reverse proxy)

apache error.log:

[Thu Dec 28 17:10:23.623684 2023] [core:info] [pid 144199:tid 140032509736640] [client 10.0.0.100:55838] AH00128: File does not exist: /var/www/nextcloud/favicon.ico

Also, after the upgrade, since I was still logged in, I was able to go around the admin web panel, and noticed the overview page displayed an error, stating that “An error occurred while checking server config”.

I don’t know how to get more information, I tried the following:

root@nextcloud-new:/var/www/nextcloud# sudo -u www-data php occ check --verbose
root@nextcloud-new:/var/www/nextcloud# 
root@nextcloud-new:/var/www/nextcloud# sudo -u www-data php occ status
  - installed: true
  - version: 27.1.5.1
  - versionstring: 27.1.5
  - edition: 
  - maintenance: false
  - needsDbUpgrade: false
  - productname: Nextcloud
  - extendedSupport: false
root@nextcloud-new:/var/www/nextcloud# sudo -u www-data php occ integrity:check-core
root@nextcloud-new:/var/www/nextcloud# 

I also ran all the db:add-missing-*, but nothing needed fixing. Same with the command to update .htaccess file.

The only piece of information I found was using the log:tail command:

  Debug     music               /appinfo/app.php is deprecated, use \OCP\AppFramework\Bootstrap\IBootstrap on the application class instead.                                             2023-12-28T16:30:07+00:00  
                                                                                                                                                                                                                    
  Info      related_resources   Could not resolve OCA\Circles\CirclesManager! Class "OCA\Circles\CirclesManager" does not exist                                                          2023-12-28T16:30:07+00:00  
                                                                                                                                                                                                                    
  Debug     serverDI            The requested alias "SystemConfig" is deprecated. Please request "OC\SystemConfig" directly. This alias will be removed in a future Nextcloud version.   2023-12-28T16:30:07+00:00  

But I don’t really know what to do with this information, maybe the last statement can be related to the “an error occurred while checking server config”.

Hi !

I finally found the cause for the blank (500 error) login page !

I commented out the line 'forwarded_for_headers' => 'HTTP_X_FORWARDED_FOR', in my config.php file, and problem solved (after restarting the webserver) (upgrades to NC 27.1.7 and then to NC 28.0.3 went smoothly and I could login from incognito sessions / any random web browser).

I could not really find any information on this in the changelogs, except maybe for this

Hope this can help !

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.