External Storage SMB/CIFS not working after upgrading to Nextcloud 21.0.1

I was previously running nextcloud 20, now after upgrading to nextcloud 21 all of my external storage folders are broken. My environment is fully upgraded Debian 10.8 with php7.4, apache2, mariadb. As a test I also set up another Debian 10.8 server from scratch with a brand new install of nextcloud 21 and I’m getting the same error message. See below for the event log errors. I did try connecting manually to the same share via smbclient and that worked fine so I know it’s nothing to do with smbclient. TIA!

OCP\Files\StorageAuthException: Storage unauthorized.

  1. /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php - line 197:OCA\Files_External\Lib\Storage\SMB->throwUnavailable()
  2. /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php - line 345:OCA\Files_External\Lib\Storage\SMB->getFileInfo()
  3. /var/www/html/lib/private/Files/Storage/Common.php - line 458:OCA\Files_External\Lib\Storage\SMB->stat()
  4. /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php - line 722:OC\Files\Storage\Common->test()
  5. /var/www/html/apps/files_external/lib/MountConfig.php - line 215:OCA\Files_External\Lib\Storage\SMB->test()
  6. /var/www/html/apps/files_external/lib/Controller/StoragesController.php - line 274:OCA\Files_External\MountConfig::getBackendStatus("*** sensiti … *")
  7. /var/www/html/apps/files_external/lib/Controller/StoragesController.php - line 346:OCA\Files_External\Controller\StoragesController->updateStorageStatus("*** sensiti … *")
  8. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 218:OCA\Files_External\Controller\StoragesController->show()
  9. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 127:OC\AppFramework\Http\Dispatcher->executeController()
  10. /var/www/html/lib/private/AppFramework/App.php - line 157:OC\AppFramework\Http\Dispatcher->dispatch()
  11. /var/www/html/lib/private/Route/Router.php - line 302:OC\AppFramework\App::main()
  12. /var/www/html/lib/base.php - line 993:OC\Route\Router->match()
  13. /var/www/html/index.php - line 37:OC::handleRequest()

Caused by Icewind\SMB\Exception\ConnectionRefusedException:

  1. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php - line 114:Icewind\SMB\Wrapped\Connection->clearTillPrompt()
  2. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php - line 128:Icewind\SMB\Wrapped\Share->getConnection()
  3. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php - line 449:Icewind\SMB\Wrapped\Share->connect()
  4. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php - line 207:Icewind\SMB\Wrapped\Share->execute()
  5. /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php - line 193:Icewind\SMB\Wrapped\Share->stat()
  6. /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php - line 345:OCA\Files_External\Lib\Storage\SMB->getFileInfo()
  7. /var/www/html/lib/private/Files/Storage/Common.php - line 458:OCA\Files_External\Lib\Storage\SMB->stat()
  8. /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php - line 722:OC\Files\Storage\Common->test()
  9. /var/www/html/apps/files_external/lib/MountConfig.php - line 215:OCA\Files_External\Lib\Storage\SMB->test()
  10. /var/www/html/apps/files_external/lib/Controller/StoragesController.php - line 274:OCA\Files_External\MountConfig::getBackendStatus("*** sensiti … *")
  11. /var/www/html/apps/files_external/lib/Controller/StoragesController.php - line 346:OCA\Files_External\Controller\StoragesController->updateStorageStatus("*** sensiti … *")
  12. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 218:OCA\Files_External\Controller\StoragesController->show()
  13. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 127:OC\AppFramework\Http\Dispatcher->executeController()
  14. /var/www/html/lib/private/AppFramework/App.php - line 157:OC\AppFramework\Http\Dispatcher->dispatch()
  15. /var/www/html/lib/private/Route/Router.php - line 302:OC\AppFramework\App::main()
  16. /var/www/html/lib/base.php - line 993:OC\Route\Router->match()
  17. /var/www/html/index.php - line 37:OC::handleRequest()

The error message says the direct error is that your SMB server is refusing the connection. I’m not running 21 yet (nor do I have any SMB externals, yet), but I’m in tech support mode here, bear with me.

You said you did a fresh install, I take it that means you re-added the settings to that install manually, not as a copy-paste from the old to the new?

Out of curioisity, what’s your SMB server? Samba? Something Windows? Part of me wonderrs if the SMB library in 21 is using a different protocol version that it’s not happy with.

I am guessing that the problem is with authorization. As a working solution, I propose to mount the SMB share on your system at the boot stage via fstab and then save the files along thе mount path.

Yes, it is true, the problem occurs both with version 20.0.9 and with 21.0.1 (20.0.8 worked correctly). At the moment, as a workaround I am using SFTP as a method of connecting with the file server.

Hello,
I has the same strange Issue with Version 20.

I delete the Windows User and recreate it no way, i create a New User with a other Name and all wirks fine.

I has used ldab and external storage.

By

See Files on SMB-share corrupted while up- and downloading · Issue #26457 · nextcloud/server · GitHub for a workaround

1 Like

5 posts were split to a new topic: Notifications from the forum

Thanks for the help. I tried applying that posted fix for version 21 (Nextcloud - NativeReadStream excess data will be lost) but it never worked, was giving the same exact error. Then I decided to revert back to a clean slate version 20 but even that isn’t working now!! Here’s what i see now: (and this is a brand new install of 20.0.1, also 20.0.8 did the same thing)

Edit: I eventually got it working by installing a brand new vm (Debian 10) and then installing version 20 of nextcloud. I’m not sure what could have been the problem, the only thing I consciously did differently was installing php7.4-smbclient instead of php-smbclient

I’m on 20.0.9 have the same issue, but I had the same issue on 20.0.8, But I can’t even download anything or sync anthing with the desktop client from the SMB folder… When will this fix put in to the next nextcloud update? I’m patient, mostly because I don’t want to mess with my Nextcloud instance.

{“reqId”:“XTCCry09uBh1dgaCOGxA”,“level”:3,“time”:“2021-05-12T15:02:59+00:00”,“remoteAddr”:“192.168.1.1”,“user”:"",“app”:“no app in context”,“method”:“GET”,“url”:"/nextcloud/apps/files_external/globalstorages/1?testOnly=true",“message”:{“Exception”:“Icewind\SMB\Exception\ForbiddenException”,“Message”:“Invalid request for / (ForbiddenException)”,“Code”:1,“Trace”:[{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",“line”:67,“function”:“fromMap”,“class”:“Icewind\SMB\Exception\Exception”,“type”:"::"},{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",“line”:84,“function”:“handleError”,“class”:“Icewind\SMB\Native\NativeState”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",“line”:339,“function”:“testResult”,“class”:“Icewind\SMB\Native\NativeState”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php",“line”:305,“function”:“getxattr”,“class”:“Icewind\SMB\Native\NativeState”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php",“line”:43,“function”:“getAttribute”,“class”:“Icewind\SMB\Native\NativeShare”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php",“line”:69,“function”:“stat”,“class”:“Icewind\SMB\Native\NativeFileInfo”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php",“line”:114,“function”:“getSize”,“class”:“Icewind\SMB\Native\NativeFileInfo”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php",“line”:193,“function”:“stat”,“class”:“Icewind\SMB\Native\NativeShare”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php",“line”:345,“function”:“getFileInfo”,“class”:“OCA\Files_External\Lib\Storage\SMB”,“type”:"->"},{“file”:"/var/www/html/lib/private/Files/Storage/Common.php",“line”:458,“function”:“stat”,“class”:“OCA\Files_External\Lib\Storage\SMB”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php",“line”:722,“function”:“test”,“class”:“OC\Files\Storage\Common”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/MountConfig.php",“line”:264,“function”:“test”,“class”:“OCA\Files_External\Lib\Storage\SMB”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/Controller/StoragesController.php",“line”:274,“function”:“getBackendStatus”,“class”:“OCA\Files_External\MountConfig”,“type”:"::",“args”:["*** sensitive parameters replaced "]},{“file”:"/var/www/html/apps/files_external/lib/Controller/StoragesController.php",“line”:346,“function”:“updateStorageStatus”,“class”:“OCA\Files_External\Controller\StoragesController”,“type”:"->",“args”:[" sensitive parameters replaced ***"]},{“file”:"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",“line”:169,“function”:“show”,“class”:“OCA\Files_External\Controller\StoragesController”,“type”:"->"},{“file”:"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",“line”:100,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->"},{“file”:"/var/www/html/lib/private/AppFramework/App.php",“line”:152,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->"},{“file”:"/var/www/html/lib/private/Route/Router.php",“line”:309,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:"::"},{“file”:"/var/www/html/lib/base.php",“line”:1008,“function”:“match”,“class”:“OC\Route\Router”,“type”:"->"},{“file”:"/var/www/html/index.php",“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:"::"}],“File”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php",“Line”:44,“CustomMessage”:“Error while getting file info”},“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36 Edg/90.0.818.56”,“version”:“20.0.9.1”,“id”:“609bee2e2b702”}


[no app in context] Warning: External storage not available: Storage unauthorized. Invalid request for / (ForbiddenException)

GET /nextcloud/apps/files_external/globalstorages/1?testOnly=true
from ... by ** at 2021-05-12T15:02:59+00:00


{“reqId”:“XTCCry09uBh1dgaCOGxA”,“level”:2,“time”:“2021-05-12T15:02:59+00:00”,“remoteAddr”:"...",“user”:"",“app”:“no app in context”,“method”:“GET”,“url”:"/nextcloud/apps/files_external/globalstorages/1?testOnly=true",“message”:{“Exception”:“OCP\Files\StorageAuthException”,“Message”:“Storage unauthorized. Invalid request for / (ForbiddenException)”,“Code”:4,“Trace”:[{“file”:"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php",“line”:202,“function”:“throwUnavailable”,“class”:“OCA\Files_External\Lib\Storage\SMB”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php",“line”:345,“function”:“getFileInfo”,“class”:“OCA\Files_External\Lib\Storage\SMB”,“type”:"->"},{“file”:"/var/www/html/lib/private/Files/Storage/Common.php",“line”:458,“function”:“stat”,“class”:“OCA\Files_External\Lib\Storage\SMB”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php",“line”:722,“function”:“test”,“class”:“OC\Files\Storage\Common”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/MountConfig.php",“line”:264,“function”:“test”,“class”:“OCA\Files_External\Lib\Storage\SMB”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/Controller/StoragesController.php",“line”:274,“function”:“getBackendStatus”,“class”:“OCA\Files_External\MountConfig”,“type”:"::",“args”:["* sensitive parameters replaced "]},{“file”:"/var/www/html/apps/files_external/lib/Controller/StoragesController.php",“line”:346,“function”:“updateStorageStatus”,“class”:“OCA\Files_External\Controller\StoragesController”,“type”:"->",“args”:[" sensitive parameters replaced "]},{“file”:"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",“line”:169,“function”:“show”,“class”:“OCA\Files_External\Controller\StoragesController”,“type”:"->"},{“file”:"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",“line”:100,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->"},{“file”:"/var/www/html/lib/private/AppFramework/App.php",“line”:152,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->"},{“file”:"/var/www/html/lib/private/Route/Router.php",“line”:309,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:"::"},{“file”:"/var/www/html/lib/base.php",“line”:1008,“function”:“match”,“class”:“OC\Route\Router”,“type”:"->"},{“file”:"/var/www/html/index.php",“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:"::"}],“File”:"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php",“Line”:214,“Hint”:“Storage is temporarily not available”,“Previous”:{“Exception”:“Icewind\SMB\Exception\ForbiddenException”,“Message”:“Invalid request for / (ForbiddenException)”,“Code”:1,“Trace”:[{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",“line”:67,“function”:“fromMap”,“class”:“Icewind\SMB\Exception\Exception”,“type”:"::"},{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",“line”:84,“function”:“handleError”,“class”:“Icewind\SMB\Native\NativeState”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",“line”:339,“function”:“testResult”,“class”:“Icewind\SMB\Native\NativeState”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php",“line”:305,“function”:“getxattr”,“class”:“Icewind\SMB\Native\NativeState”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php",“line”:43,“function”:“getAttribute”,“class”:“Icewind\SMB\Native\NativeShare”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php",“line”:69,“function”:“stat”,“class”:“Icewind\SMB\Native\NativeFileInfo”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php",“line”:114,“function”:“getSize”,“class”:“Icewind\SMB\Native\NativeFileInfo”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php",“line”:193,“function”:“stat”,“class”:“Icewind\SMB\Native\NativeShare”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php",“line”:345,“function”:“getFileInfo”,“class”:“OCA\Files_External\Lib\Storage\SMB”,“type”:"->"},{“file”:"/var/www/html/lib/private/Files/Storage/Common.php",“line”:458,“function”:“stat”,“class”:“OCA\Files_External\Lib\Storage\SMB”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php",“line”:722,“function”:“test”,“class”:“OC\Files\Storage\Common”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/MountConfig.php",“line”:264,“function”:“test”,“class”:“OCA\Files_External\Lib\Storage\SMB”,“type”:"->"},{“file”:"/var/www/html/apps/files_external/lib/Controller/StoragesController.php",“line”:274,“function”:“getBackendStatus”,“class”:“OCA\Files_External\MountConfig”,“type”:"::",“args”:[" sensitive parameters replaced "]},{“file”:"/var/www/html/apps/files_external/lib/Controller/StoragesController.php",“line”:346,“function”:“updateStorageStatus”,“class”:“OCA\Files_External\Controller\StoragesController”,“type”:"->",“args”:[" sensitive parameters replaced ***"]},{“file”:"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",“line”:169,“function”:“show”,“class”:“OCA\Files_External\Controller\StoragesController”,“type”:"->"},{“file”:"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",“line”:100,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->"},{“file”:"/var/www/html/lib/private/AppFramework/App.php",“line”:152,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->"},{“file”:"/var/www/html/lib/private/Route/Router.php",“line”:309,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:"::"},{“file”:"/var/www/html/lib/base.php",“line”:1008,“function”:“match”,“class”:“OC\Route\Router”,“type”:"->"},{“file”:"/var/www/html/index.php",“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:"::"}],“File”:"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php",“Line”:44},“CustomMessage”:"–"},“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36 Edg/90.0.818.56”,“version”:“20.0.9.1”,“id”:“609bee2e2b516”}

Inserting a line with three backticks (```) before and after the configuration snippet will most likely improve its readability :wink:

1 Like

I just stumbled upon this thread and thought it might be helpful for some users.
We also had broken externale smb storages after update. In our case the reason was some shares on old SMBv1 hosts. We solved it by enabling SMBv1 again in the config files.
If personally have no details on how to do this. I you need help please write me a message.

Hi there @ptkIT, can you explain how you did this please. I’m trying to add an old Windows Home Server 2003 NAS as an External Storage - but it will not work.

That said, I can confirm it will mount via FSTAB - as I was trying to add the mounted share as a Local Drive - but this didn’t work either. If anybody has instructions on this method - that would be greatly appreciated.

image

This article describes how you mount a SMB/CIFS drive on the console and how you can e.g. set SMBv1 protocol:

https://linoxide.com/howto-mount-smb-filesystem-using-etcfstab/

Hi @jun3280net.
Did the answer from @j-ed solve your issue? Otherwise I would ask my colleague when he’s back from vacation.
Kind regards.

Thank you @j-ed and @ptkIT for responding. As noted previously, use the External Drives APP with SMB (CIFS version 3.0). I’m getting varying success with the External Drives APP. Can I ask how you’ve installed and used the External Drives APP with SMB?

I’ve tried the following in order of most successful to least successful :

  1. Home Assistant/HASSIO - NextCloud (Supervisor Addon) with External Storage App - I can mount SMB, but only 50% of the files sync. I don’t understand why if I drag a folder with 10 files - only 5 will sync.
  2. Docker-Compose - Nextcloud with External Storage App - I can mount SMB - but can not sync anything even though it appears to upload the entire file (Operation Blocked Access Control)
    image
  3. SNAP - Nextcloud - unable to install External Storage App

Any suggestions on how to troubleshoot would be greatly appreciated. Thank you

Any updates on this?