Broken external storage

Nextcloud 21.0.3; PhP 8.0.8; Nginx 1.21.1 MariaDB 10.5
The issue you are facing:
When I go to re-configure my external storage I get the following error:

The server was unable to complete your request.

If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log.
Technical details

Remote Address:
Request ID: AtL1kJngZ7vRtHc06dIl

I have recently upgraded to NC21 and had a number of external storage configured.

root@stanworth-cloud:/var/www/nextcloud# sudo -u www-data php occ files_external:list

Shows they are still “there”

| Mount ID | Mount Point | Storage | Authentication Type | Configuration | Options | Applicable Users | Applicable Groups |
| 1 | /Recordings-cloud | SMB / CIFS | Username and password | host: “”, share: “recordings”, root: “”, domain: “james2”, show_hidden: false, user: “stanworthcloud”, password: “" | | james2 | |
| 2 | /Client-Recordings | SMB / CIFS | Username and password | host: “”, share: “recordings”, root: “Lab User”, domain: “labuser”, show_hidden: false, user: “labuser”, password: "
” | | labuser | admin |
| 9 | /SFTP | SFTP | RSA private key | host: “”, root: “/archive”, user: “james”, password: “", private_key: "” | | james2 | |

Is this the first time you’ve seen this error? _Yes - after upgrade

Steps to replicate it:

  1. Go to setting and external storage

The output of your Nextcloud log in Admin > Logging:

Error	PHP	Error: pack(): Type H: illegal hex digit - at /var/www/nextcloud/3rdparty/phpseclib/phpseclib/phpseclib/Crypt/RSA.php#1147



    /var/www/nextcloud/3rdparty/phpseclib/phpseclib/phpseclib/Crypt/RSA.php - line 1147:


    /var/www/nextcloud/3rdparty/phpseclib/phpseclib/phpseclib/Crypt/RSA.php - line 1710:


    /var/www/nextcloud/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php - line 61:


    /var/www/nextcloud/apps/files_external/lib/Config/ConfigAdapter.php - line 94:


    /var/www/nextcloud/apps/files_external/lib/Config/ConfigAdapter.php - line 132:



    OCA\Files_External\Config\ConfigAdapter->OCA\Files_External\Config\{closure}("*** sensiti ... *")

    /var/www/nextcloud/apps/files_external/lib/Config/ConfigAdapter.php - line 130:


    /var/www/nextcloud/lib/private/Files/Config/MountProviderCollection.php - line 109:


    /var/www/nextcloud/lib/private/Files/Filesystem.php - line 452:


    /var/www/nextcloud/lib/private/Files/Filesystem.php - line 377:


    /var/www/nextcloud/lib/private/legacy/OC_Util.php - line 324:


    /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Auth.php - line 125:


    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Auth/Backend/AbstractBasic.php - line 103:

    OCA\DAV\Connector\Sabre\Auth->validateUserPass("*** sensiti ... *")

    /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Auth.php - line 254:


    /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Auth.php - line 156:


    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Auth/Plugin.php - line 182:


    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Auth/Plugin.php - line 137:


    /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php - line 89:


    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 456:


    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 253:


    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 321:


    /var/www/nextcloud/apps/dav/lib/Server.php - line 332:


    /var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:


    /var/www/nextcloud/remote.php - line 167:

    require_once("/var/www/ne ... p")


I was confused for a bit because the forum ate your asterisks!

The error message is about the private key, so that’s where I’d start. To troubleshoot, you might try an SSH connection with just the password, if that’s allowed by the remote host. Once you’re sure that’s working, you can insert the private key again (from ~/.ssh/id_rsa?), and see what happens.
I’m not sure how Nextcloud interprets it when a private key and password are both supplied - for example, the password could either be needed for decrypting the private key, or it could be required by the remote system in addition to having the private key.

My problem is that I cannot open the settings from the GUI. So I am not sure what has gone wrong there . . .

I just wanted to say that there is another user with this problem, but it’s you:

Did you upgrade to php 8.0 recently or was it already working with php 8.0 and NC 20? In case of a new php 8.0, I’d check if all the required modules were installed: Installation on Linux — Nextcloud latest Administration Manual latest documentation

If you set up new external storage, does it work then?

Since the return of a function is not handled correclty, I’d suggest to create a bug report on Issues · nextcloud/server · GitHub

What is bothering me a bit, if it is a bug, why didn’t anyone else report it yet? External storage + php 8 doesn’t look very specific…

I have checked and seem to have all the required php modules.
Before reporting a potential bug I’d like to make sure something specific to my install / situation isn’t overlooked.
I guess the logging I’ve report is the most relevant to the error?