CIFS/SMB not working

Nextcloud version: 16.0.0)
Operating system and version: Ubuntu 18.04
Apache version: Apache/2.4.29 (Ubuntu)
PHP version: 7.2

The issue you are facing:
Cannot get CIFS/SMB to connect.

Is this the first time you’ve seen this error?: N

Steps to replicate it:
This is a fresh VMware VM created to host NC16.

I have been using NC12 happily for a long time, but wanted to update to the newest version for some of the new functionality and security. I felt the safest way was to build a new system and then switch over.

I cannot get the SMB/CIFS connection to my freeNAS fileserver to work no matter what I try. I have been battling this for a couple of weeks now.

I have validated that the SMB username and logon has the authority to connect by creating a new share connection on the old NC12 install which connected perfectly - so it is not a username/password issue.

It must be a SMB connection issue
I have checked and rechecked that all of the following have been run
apt install libsmbclient
apt install smbclient
apt install php-smbclient
apt install -y cifs-utils

I have even tried
client min protocol = SMB1
client max protocol = SMB3
/etc/samba/smb.conf adding the lines below [global]
without success.

I have checked line by line that the /etc/samba/smb.conf files in both the old and new NC installs are the same - which they are.

I have tried using SMB Test which reports …

0. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php - line 62:Icewind\SMB\Exception\Exception::fromMap({ 1: "Icewin ... "}, 111, null)
1. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php - line 74:Icewind\SMB\Native\NativeState->handleError(null)
2. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php - line 105:Icewind\SMB\Native\NativeState->testResult(false, "smb:///")
3. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php - line 92:Icewind\SMB\Native\NativeState->opendir("smb:///")
4. /var/www/nextcloud/apps/smb_test/lib/Controller/SmbController.php - line 95:Icewind\SMB\Native\NativeShare->dir(null)
5. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 166:OCA\SMBTest\Controller\SmbController->dir(null, null, null, null, Icewind\SMB\ ... {}, null)
6. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 99:OC\AppFramework\Http\Dispatcher->executeController(OCA\SMBTest\ ... {}, "dir")
7. /var/www/nextcloud/lib/private/AppFramework/App.php - line 126:OC\AppFramework\Http\Dispatcher->dispatch(OCA\SMBTest\ ... {}, "dir")
8. /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:OC\AppFramework\App::main("OCA\\SMBTes ... r", "dir", OC\AppFramew ... {}, { _route: "smb_test.smb.dir"})
9. OC\AppFramework\Routing\RouteActionHandler->__invoke({ _route: "smb_test.smb.dir"})
10. /var/www/nextcloud/lib/private/Route/Router.php - line 297:call_user_func(OC\AppFramew ... {}, { _route: "smb_test.smb.dir"})
11. /var/www/nextcloud/lib/base.php - line 975:OC\Route\Router->match("/apps/smb_test/dir")
12. /var/www/nextcloud/index.php - line 42:OC::handleRequest()

I am at a loss for any further ideas and would be most grateful for any help in fixing this issue which is really causing me some grief.

Nextcloud version: 16.0.0)
Operating system and version: Ubuntu 18.04
Apache version: Apache/2.4.29 (Ubuntu)
PHP version: 7.2 (and only 7.2, all older versions removed)

Suffering similar (same?) issue after upgrade (actually upgraded to v15 and upgraded PHP, realised smb didn’t work, so tried v16 as it was just released, still doesn’t work).

I haven’t identified the root cause, but what I can say so far is:

  • smbclient used on command line connects fine
  • using the icewind ‘example.php’ as suggested here works
  • tcpdump confirms that there is no attempt at all from nextcloud to even talk to the samba server (which explains why there is also nothing in the logs on the server)
  • The SMB Test app doesn’t work (from what I make of the exception it’s not actually passing any arguments to connect to), so while I have the same error as above, this probably has nothing to do with the real problem.
  • If I force IceWind to use smbclient instead of php-smbclient shares work again
  • But SMB Test still fails with an error (albeit a different one: “Connection not valid”)
  • I temporarily wrapped smbclient with a script to see what requests were made - this proves that SMB Test submits a blank path (///) and no credentials, so not surprising it fails!

So a workaround is to use smbclient (eg. just uninstall php-smbclient).

Afraid I’m out of avenues trying to diagnose the php-smbclient issue. Happy if someone can suggest something, but for now at least it works again.

I have given up too, but found an alternative route to accomplish my objective by setting up a read only mount of the samba share … I only need to make files available to download or view for a restricted userset. I actually think this has some added advantages, but I do think the SAMBA shares are broken.