External storage - internal server error. Upgrade left something in DB which is causing problems

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com 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:

example

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

longer
example
here

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): Nextcloud Hub 7 (28.0.1)
Operating system and version (eg, Ubuntu 20.04): TrueNAS-SCALE-23.10.1
Apache or nginx version (eg, Apache 2.4.25): replace me

The issue you are facing:
After an upgrade, accessing external storage with an existing user causes internal server error. With a fresh new user, this doesn’t happen.

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

Steps to replicate it:

  1. Log in
  2. Choose “External Storage” from menu

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.


{"reqId":"u7QRVgPxbipRc5OCqieP","level":3,"time":"03/01/2024 20:30:28","remoteAddr":"192.168.102.123","user":"teg","app":"index","method":"GET","url":"/settings/user/externalstorages","message":"hash_hkdf(): Argument #2 ($key) cannot be empty in file '/var/www/html/lib/private/Security/Crypto.php' line 149","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36","version":"28.0.1.1","exception":{"Exception":"Exception","Message":"hash_hkdf(): Argument #2 ($key) cannot be empty in file '/var/www/html/lib/private/Security/Crypto.php' line 149","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Settings\\Controller\\PersonalSettingsController"],"index"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\PersonalSettingsController","index",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["externalstorages","settings.PersonalSettings.index"]]},{"file":"/var/www/html/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/user/externalstorages"]},{"file":"/var/www/html/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"ValueError","Message":"hash_hkdf(): Argument #2 ($key) cannot be empty","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Security/Crypto.php","line":149,"function":"hash_hkdf","args":["sha512",["SensitiveParameterValue"]]},{"file":"/var/www/html/lib/private/Security/Crypto.php","line":123,"function":"decryptWithoutSecret","class":"OC\\Security\\Crypto","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/Security/CredentialsManager.php","line":92,"function":"decrypt","class":"OC\\Security\\Crypto","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php","line":55,"function":"retrieve","class":"OC\\Security\\CredentialsManager","type":"->","args":["teg","password::global"]},{"file":"/var/www/html/apps/files_external/lib/Settings/Personal.php","line":79,"function":"getAuth","class":"OCA\\Files_External\\Lib\\Auth\\Password\\GlobalAuth","type":"->","args":["teg"]},{"file":"/var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php","line":129,"function":"getForm","class":"OCA\\Files_External\\Settings\\Personal","type":"->","args":[]},{"file":"/var/www/html/apps/settings/lib/Controller/PersonalSettingsController.php","line":76,"function":"formatSettings","class":"OCA\\Settings\\Controller\\PersonalSettingsController","type":"->","args":[[[["OCA\\Files_External\\Settings\\Personal"]]]]},{"file":"/var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php","line":149,"function":"getSettings","class":"OCA\\Settings\\Controller\\PersonalSettingsController","type":"->","args":["externalstorages"]},{"file":"/var/www/html/apps/settings/lib/Controller/PersonalSettingsController.php","line":67,"function":"getIndexResponse","class":"OCA\\Settings\\Controller\\PersonalSettingsController","type":"->","args":["personal","externalstorages"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"index","class":"OCA\\Settings\\Controller\\PersonalSettingsController","type":"->","args":["externalstorages"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Settings\\Controller\\PersonalSettingsController"],"index"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Settings\\Controller\\PersonalSettingsController"],"index"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\PersonalSettingsController","index",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["externalstorages","settings.PersonalSettings.index"]]},{"file":"/var/www/html/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/user/externalstorages"]},{"file":"/var/www/html/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/Security/Crypto.php","Line":149},"message":"hash_hkdf(): Argument #2 ($key) cannot be empty in file '/var/www/html/lib/private/Security/Crypto.php' line 149","exception":{},"CustomMessage":"hash_hkdf(): Argument #2 ($key) cannot be empty in file '/var/www/html/lib/private/Security/Crypto.php' line 149"}}

Issue seems to be with external storage/crendentials.
Is there any way to remove credentials with occ?

There are two open bug reports I’ve seen that may be related. Does one of them seem applicable to your situation?[1]

If so, and if you think it might be helpful, consider adding your details to the Issue.

[1] Issues · nextcloud/server · GitHub

1 Like