8

I have a fresh install of Ubuntu 20.04 with Samba share enabled. When trying to access the share by browsing through the file manager, I get the error "Failed to retrieve share list from server: Invalid argument".

This happens from the pc which is sharing the samba share and also from another Linux box. Browsing from a Windows 10 pc is working fine.

I have seen a lot of solutions posted, but none is suitable for me: I know I can enable the NT1 (SMB1) protocol in the smb.conf but I don't want to use this because it is insecure. I could access the shares using the ip address (which isn't working for me) or could mount the share using cifs.

But I want to be able to access the shares by browsing in the file manager. How can I configure the Ubuntu 20.04 box to be able to access SMB2 (or higher) shares?

tderave
  • 81
  • 1
  • 1
  • 3

2 Answers2

6

Short Answer: You cannot until this bug is resolved: https://bugs.launchpad.net/gvfs/+bug/1828107

A gvfs backend process ( gvfsd-smb-browse ) drops down to SMB1 ( NT1 ) to get a list of SMB hosts and their shares and then gets stuck there. When it tries to access a SMB server that has disabled SMB1 like Ubuntu 20 it cannot because there is no SMB1 - that is the "invalid argument".

You can still access the host and its share but you cannot browse or discover it. You must access it explicitly by host name and share name in Connect to Server.

Browsing from a Windows 10 pc is working fine.

There are only two ways a Win10 client can discover any Linux samba server:

** You enabled WS-Discovery on your Ubuntu box which you would remember doing since it is somewhat involved.

** Or you enabled client side SMB1 on your Win10 box. You can verify that in Win10 by:

Entering "Windows Features" in Search then expanding SMB 1.0/CIFS File Sharing Support

enter image description here

In this case Win10 will use SMB1 to get the list of shares but then uses SMB2 / SMB3 to make the actual connection. That is the thing an Ubuntu 20 client cannot do.

I have a Win10 machine that has enabled SMB1 on the client side. In Explorer I can see the non-smb1 Ubuntu server using NetBIOS: enter image description here

If I connect to one of it's shares I am connecting using SMB3:

$ sudo smbstatus -b

Samba version 4.11.6-Ubuntu PID Username Group Machine Protocol Version Encryption Signing
---------------------------------------------------------------------------------------------------------------------------------------- 1443 nobody nogroup
2605:a601:a1a4:d000:30e3:5dca:a90c:1fea (ipv6:2605:a601:a1a4:d000:30e3:5dca:a90c:1fea:49761) SMB3_11

-                    -    
Morbius1
  • 7,761
  • Not much point in turning on SMBv1 on Win 10, it is also turned off on Samba on 20.04 – Rowland Penny Nov 08 '20 at 18:25
  • 1
    You didn't read my post. In this case Win10 will use SMB1 to get the list of shares but then uses SMB2 / SMB3 to make the actual connection. That is the thing an Ubuntu 20 client cannot do. The original questioner stated that he can discover the samba host from Win10. The only way WIn10 can discover a samba host using NetBIOS is if SMB1 is enabled on the client. Samba will broadcast it's presence using NetBIOS regardless - unless you turn it off in smb.conf. – Morbius1 Nov 08 '20 at 19:35
  • 1
    I'm not suggesting he turn on SMB1 on the client side of Win10. I'm suggesting he already has and ask that he verify. – Morbius1 Nov 08 '20 at 19:52
  • 1
    SMBv1 is turned off by default in smb.conf on Samba 4.11.x on Ubuntu 20.04, so there is absolutely no point in turning it on in Windows 10. If the OP doesn't want to turn on SMBv1 everywhere, then he needs to run a wsdd server on his Samba server. – Rowland Penny Nov 08 '20 at 20:06
  • 1
    A Win10 client can very much discover and connect to an Ubuntu 20.04 samba server that has disabled SMB1 by default using NetBIOS. But only if the Win10 client has SMB1 enabled because without SMB1 on the client it can't discover any Samba host using NetBIOS. Samba client and server negotiate the correct smb dialect to use and that is what the Win10 machine is doing in his original question. It finds it with SMB1 then connect to it with SMB3. And that is what the Ubuntu 20 client cannot do. – Morbius1 Nov 08 '20 at 20:19
  • Thanks for the feedback. I did verify the SMB 1.0 support on the Windows machine and it is not enabled. The "invalid argument" error now makes sense because I understand the reason. I'll connect to the share by hostname, as you suggest. – tderave Nov 09 '20 at 05:47
  • I'm baffled by the comments. I have a Ubuntu 20.04 box and a XUbuntu 20.04 box. I want to access the Public folder from the Ubuntu box to the XUbuntu box. On the XUbuntu box, I've created a share using the Terminal command 'net usershare add Public /home/john/Public' which was accepted. I get the message "Failed to retrieve share list from server: connection timed out" when using Nautilus (on the Ubuntu box, either by clicking on the XUbuntu box name in Networks or Connect to Server). Help. – John Rose Jan 15 '22 at 17:51
  • I'm not sure that this is the cause of the issue. For one, I can enable SMB v1 in the smb.conf file, but yet I still encounter the problem. Moreover, the Launchpad bug you linked has since been fixed (it's been 2 years), but I'm still seeing this issue on Ubuntu 22. – Raleigh L. Aug 11 '22 at 04:56
1

My error was attempting to access TrueNas server from my ubuntu desktop. It was a SAMBA compatability issue. In truenas went to services, samba, edit and slectected 'Enable SMB1 support'. Also ticked 'Enable Apple SMB2/3 Protocol Extensions' in the advanced section.

Dave
  • 11
  • I was getting this issue trying to connect to my LibreELEC after an OS update. Setting the minimum Samba protocol to SMB1 fixed it for me. – MkMan Jan 27 '24 at 11:04