External Storage - HMAC does not match

Debian 8.7
php 5.6.29
php-fpm
mysql 5.7.17

I have Nextcoud 11.0.1 running and have an error accessing the External Storages page from Admin.

Error shown on page as shown below:

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.

Technical details
Remote Address: xxx.xxx.xxx.xxx
Request ID: a_masked_number

The following is from the nextcloud.log:

{“reqId”:“WIDut8CoAQYAABRS8EsAAAAB”,“remoteAddr”:“xxx.xxx.xxx.xxx”,“app”:“index”,“message”:“Exception: {“Exception”:“Exception”,“Message”:“HMAC does not match.”,“Code”:0,“Trace”:”#0 \/var\/www\/virtual\/my_domain\/htdocs\/cloud\/lib\/private\/Security\/CredentialsManager.php(93): OC\\Security\\Crypto->decrypt(*** sensitive parameters replaced ***)\n#1 \/var\/www\/virtual\/my_domain\/htdocs\/cloud\/apps\/files_external\/lib\/Lib\/Auth\/Password\/GlobalAuth.php(55): OC\\Security\\CredentialsManager->retrieve(’’, ‘password::globa…’)\n#2 \/var\/www\/virtual\/my_domain\/htdocs\/cloud\/apps\/files_external\/lib\/Settings\/Admin.php(71): OCA\\Files_External\\Lib\\Auth\\Password\\GlobalAuth->getAuth(’’)\n#3 \/var\/www\/virtual\/my_domain\/htdocs\/cloud\/settings\/Controller\/AdminSettingsController.php(86): OCA\\Files_External\\Settings\\Admin->getForm()\n#4 \/var\/www\/virtual\/my_domain\/htdocs\/cloud\/settings\/Controller\/AdminSettingsController.php(71): OC\\Settings\\Controller\\AdminSettingsController->getSettings(‘externalstorage…’)\n#5 [internal function]: OC\\Settings\\Controller\\AdminSettingsController->index(‘externalstorage…’)\n#6 \/var\/www\/virtual\/my_domain\/htdocs\/cloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(160): call_user_func_array(Array, Array)\n#7 \/var\/www\/virtual\/my_domain\/htdocs\/cloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(90): OC\\AppFramework\\Http\\Dispatcher->executeController(Object(OC\\Settings\\Controller\\AdminSettingsController), ‘index’)\n#8 \/var\/www\/virtual\/my_domain\/htdocs\/cloud\/lib\/private\/AppFramework\/App.php(114): OC\\AppFramework\\Http\\Dispatcher->dispatch(Object(OC\\Settings\\Controller\\AdminSettingsController), ‘index’)\n#9 \/var\/www\/virtual\/my_domain\/htdocs\/cloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php(47): OC\\AppFramework\\App::main(‘AdminSettingsCo…’, ‘index’, Object(OC\\AppFramework\\DependencyInjection\\DIContainer), Array)\n#10 [internal function]: OC\\AppFramework\\Routing\\RouteActionHandler->__invoke(Array)\n#11 \/var\/www\/virtual\/my_domain\/htdocs\/cloud\/lib\/private\/Route\/Router.php(299): call_user_func(Object(OC\\AppFramework\\Routing\\RouteActionHandler), Array)\n#12 \/var\/www\/virtual\/my_domain\/htdocs\/cloud\/lib\/base.php(1010): OC\\Route\\Router->match(’\/settings\/admin…’)\n#13 \/var\/www\/virtual\/my_domain\/htdocs\/cloud\/index.php(40): OC::handleRequest()\n#14 {main}",“File”:"\/var\/www\/virtual\/my_domain\/htdocs\/cloud\/lib\/private\/Security\/Crypto.php",“Line”:129}",“level”:3,“time”:“2017-01-19T16:52:07+00:00”,“method”:“GET”,“url”:"/cloud/settings/admin/externalstorages",“user”:“gene@my_domain”,“version”:“11.0.1.2”}

I have searched forums and have found nothing pertaining to my current state. This issue just began after I updated 11.0 to 11.0.1. I have removed my dropbox and google drive and added them again just to be sure and they have the green indicators they are good to go. I can still access my external storages via Personal settings and from the files no problem. Just cannot access Admin page for it.

I will add that I also have a daily build I use for testing, which runs on the same system config as above but with PHP version 7.0.14 , and it runs as expected. No problems on that instance.

I thank you and nice work. I love this software. Long time user, first time poster …

On lab enviroment, after restore database from another nextcloud server, i had same problem, resolved after truncate oc_credentials table.

Regards

3 Likes

how to do this, i have same problem

Thanks! That did the trick!

So you deleted all user credentials is that right?

I did what @txarligt said to do. I truncated the table “oc_credentials” in the mysql database for my nextcloud installation:

SQL> TRUNCATE TABLE oc_credentials

This does NOT delete your user accounts or logins. So nothing to worry about.

4 Likes

I experienced this problem on Nextcloud 20.08 after moving to a new server. The solution was to wipe the table oc_storages_credentials.

I had the same problem on Nextcloud 21, the above solution to wipe the table oc_storages_credentials did the trick

1 Like

Hmm that doesn’t work for me. When i try that the whole Cloud give me a Server Error…

After a migration, same problem… resolved ! thanks !!

After a migration to new server (RPi4 → x86 snap install) I was able to solve the external storage HMAC error as well, but I need to delete all mount point first via occ:

  1. nextcloud.occ files_external:delete # (going thru all moint points)
  2. mysql> TRUNCATE TABLE oc_storages_credentials;

thanks for the help

I tested some more in a VM environment and found a way to avoid this whole problem.
It seems to be related to the "‘secret’ => " Setting in the config.php
copied my secret from old to new config.php and I was not running into issues.
SMB still does not work from within snap, so i deleted the mount points manually thru occ (see above)