Can't login after update to NC 20.0.8

Nextcloud version (eg, 20.0.5): 20.0.8
Operating system and version (eg, Ubuntu 20.04): Ubuntu 16.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.18
PHP version (eg, 7.4): 7.4.15

The issue you are facing:
I updated to Nextcloud 20.0.8 using the built in updater and stable channel. I can no longer log in. As soon as I enter my password and hit login, I get an internal server error.

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

Steps to replicate it:

  1. Sadly, I don’t have steps to reproduce it.

The output of your Nextcloud log in Admin > Logging: (can’t login, so from the log file)

Log
{
  "reqId": "VBdFjUcuzOtUQHVXLchs",
  "level": 3,
  "time": "2021-03-01T08:06:17+00:00",
  "remoteAddr": "93.226.156.203",
  "user": "alex",
  "app": "index",
  "method": "POST",
  "url": "/index.php/login",
  "message": {
    "Exception": "Exception",
    "Message": "base64_encode() expects parameter 1 to be string, null given",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 152,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 309,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1008,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 37,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 110,
    "Previous": {
      "Exception": "TypeError",
      "Message": "base64_encode() expects parameter 1 to be string, null given",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Token/PublicKeyTokenProvider.php",
          "line": 309,
          "function": "base64_encode"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Token/PublicKeyTokenProvider.php",
          "line": 389,
          "function": "encryptPassword",
          "class": "OC\\Authentication\\Token\\PublicKeyTokenProvider",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Token/PublicKeyTokenProvider.php",
          "line": 88,
          "function": "newToken",
          "class": "OC\\Authentication\\Token\\PublicKeyTokenProvider",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Token/Manager.php",
          "line": 71,
          "function": "generateToken",
          "class": "OC\\Authentication\\Token\\PublicKeyTokenProvider",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/nextcloud/lib/private/User/Session.php",
          "line": 689,
          "function": "generateToken",
          "class": "OC\\Authentication\\Token\\Manager",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/CreateSessionTokenCommand.php",
          "line": 68,
          "function": "createSessionToken",
          "class": "OC\\User\\Session",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/ALoginCommand.php",
          "line": 40,
          "function": "process",
          "class": "OC\\Authentication\\Login\\CreateSessionTokenCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/CompleteLoginCommand.php",
          "line": 48,
          "function": "processNextOrFinishSuccessfully",
          "class": "OC\\Authentication\\Login\\ALoginCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/ALoginCommand.php",
          "line": 40,
          "function": "process",
          "class": "OC\\Authentication\\Login\\CompleteLoginCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/LoggedInCheckCommand.php",
          "line": 61,
          "function": "processNextOrFinishSuccessfully",
          "class": "OC\\Authentication\\Login\\ALoginCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/ALoginCommand.php",
          "line": 40,
          "function": "process",
          "class": "OC\\Authentication\\Login\\LoggedInCheckCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/EmailLoginCommand.php",
          "line": 58,
          "function": "processNextOrFinishSuccessfully",
          "class": "OC\\Authentication\\Login\\ALoginCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/ALoginCommand.php",
          "line": 40,
          "function": "process",
          "class": "OC\\Authentication\\Login\\EmailLoginCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/UidLoginCommand.php",
          "line": 54,
          "function": "processNextOrFinishSuccessfully",
          "class": "OC\\Authentication\\Login\\ALoginCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/ALoginCommand.php",
          "line": 40,
          "function": "process",
          "class": "OC\\Authentication\\Login\\UidLoginCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/UserDisabledCheckCommand.php",
          "line": 57,
          "function": "processNextOrFinishSuccessfully",
          "class": "OC\\Authentication\\Login\\ALoginCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/ALoginCommand.php",
          "line": 40,
          "function": "process",
          "class": "OC\\Authentication\\Login\\UserDisabledCheckCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/PreLoginHookCommand.php",
          "line": 53,
          "function": "processNextOrFinishSuccessfully",
          "class": "OC\\Authentication\\Login\\ALoginCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Authentication/Login/Chain.php",
          "line": 108,
          "function": "process",
          "class": "OC\\Authentication\\Login\\PreLoginHookCommand",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/core/Controller/LoginController.php",
          "line": 310,
          "function": "process",
          "class": "OC\\Authentication\\Login\\Chain",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 169,
          "function": "tryLogin",
          "class": "OC\\Core\\Controller\\LoginController",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 100,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 152,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Route/Router.php",
          "line": 309,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/nextcloud/lib/base.php",
          "line": 1008,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/index.php",
          "line": 37,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/nextcloud/lib/private/Authentication/Token/PublicKeyTokenProvider.php",
      "Line": 309
    },
    "CustomMessage": "--"
  },
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36",
  "version": "20.0.8.1"
}

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

Config
<?php
$CONFIG = array (
  'instanceid' => 'ocmf***********5',
  'passwordsalt' => '2dqY**********************Xo',
  'secret' => 'TUf**********************E24',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.***********',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '20.0.8.1',
  'overwrite.cli.url' => 'https://nextcloud.***********',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => '***********',
  'installed' => true,
  'maintenance' => false,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '***********',
  'mail_smtptimeout' => 30,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpname' => 'info@***********',
  'mail_smtppassword' => '***********',
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'theme' => '',
  'loglevel' => 0,
  'app_install_overwrite' => 
  array (
    0 => 'spreed',
    1 => 'timetracker',
    2 => 'keeporsweep',
  ),
  'mysql.utf8mb4' => true,
  'updater.release.channel' => 'stable',
  'mail_smtpport' => '587',
  'mail_domain' => '***********',
  'mail_from_address' => 'info',
  'updater.secret' => '$2y$10$***********.1C0dvxG***********kn/y',
);

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

nextcloud.*********:443 93.226.***.203 - - [01/Mar/2021:10:28:59 +0100] "POST /index.php/login HTTP/1.1" 500 5403 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36"

I had similar issue. In my case it was because of Shared Folders app.
I disabled it in the terminal and it worked.

occ app:disable files_sharing

Just tried to disable it. Sadly, it did not work. Still getting the error. Any other ideas? :slight_smile:

Might have found something related: Fehler beim Anmelden: PublicKeyTokenProvider::decryptPassword()

I am not quite sure what fixed it in the end, but I updated all packages and restarted the webserver. Can’t really say what actually did it. Good luck to anyone else facing the same problem.