46

A bit before upgrading from 10.04 to 11.10, my Ubuntu desktop stopped allowing me to access my Windows share directories. I figured I'd upgrade to 11.10 and the problem would get fixed but no.

Whenever I click on a Windows network domain using Nautilus, the following message pops up.:

Unable to mount location - Failed to retrieve share list from server

Where do I start troubleshooting this problem? I am getting desperate now :(

I tried

sudo mount -t cifs //SomeMachine/SomeShare some_directory

and I get

mount error(115): Operation now in progress

Strangely enough, I got a popup stating:

Could not display network:/// Error: Dbus error org.freedesktop.DBus.Error.NoReply: Did not receive a reply ...
9
  • Is this a network you control? Can you look on the server logs to check for errors (Windows Event Logs, etc). Can you check in your own logs (/var/log/syslog) and report any anomalies?
    – dpb
    Nov 2, 2011 at 15:08
  • Nothing pops up in /var/log/syslog related to the matter :(
    – jldupont
    Nov 2, 2011 at 15:23
  • Have a look here had an user with a similar problem. Nov 2, 2011 at 15:27
  • Follow the steps we used there an edit your q with the results. Nov 2, 2011 at 15:28
  • @brunopereira81 I've checked out your link to no avail. The problem is on my ubuntu machine side. It used to work just fine up until some update on 10.04 :(
    – jldupont
    Nov 2, 2011 at 15:36

15 Answers 15

13

I found this advice from Gord Nickerson worked for me: The error message is 'failed to retrieve share list from server' so it cannot browse a Windows 7 pc or a Ubuntu 10 pc or a mac desktop pc.

First of all, the Samba daemons smbd and nmbd must both be running for network browsing to work. They can be started with service, or with systemctl start for the newer systemd-based releases of Ubuntu.

smbtree lists all the shares from machines on the network.

So, off to /etc/samba and we sudo pico smb.conf.

The name resolve order uses hosts files first and broadcasts last and it is commented out! Maybe we change that to:

name resolve order = bcast host

and then restart the servers with service smbd restart and service nmbd restart

Works! This is an awful mistake to make in an upgrade. Upgrade should not break what is working, particularly something as important as networking. Good thing i recall the manual work you had to do to get samba working back in redhat 5 and 6.

4
  • do you know if this should work on 12.10? Nov 15, 2013 at 12:27
  • This worked for me on 12.04
    – Jonathan
    Mar 11, 2014 at 15:42
  • Just wanted to note - this worked for me on Xubuntu 14.04!
    – nc4pk
    May 13, 2015 at 23:39
  • 2
    Didn't work ...
    – user72056
    Jun 29, 2017 at 8:31
11

This is the true answer of your question. I also had the same problem.

Run terminal and enter this command

gksudo gedit /etc/hosts

and add computer ip address and name in hosts file. Save and exit.

Sample ip and name:

192.168.120.65    blablaPcName

Thats all.

4
  • 7
    And what do you suggest for when the other computer doesn't have a static IP? Not everyone has control over the router.
    – Fambida
    Jan 1, 2014 at 20:12
  • 4
    On what pc do you add these lines? on the samba server or on the client? What adress do you add? The server address in the client? The Client address in the server? The server address in the server? The client address in the client?
    – frepie
    Dec 13, 2016 at 3:20
  • "add computer ip to hosts file" Which computer??? The Linux computer, the Windows computer or both? I'll try all 3 permutations but I'd also really like to know how to source the smb.conf each time so I dont have to do a cold reboot each time. Nov 3, 2020 at 20:43
  • noooo workin for me!! Sep 5 at 15:36
5

The problem (at least in Ubuntu 18.04 where I tried it) is that the following command:

sudo ufw allow Samba

will only add rules for Samba acting as a server. It will not add any rules for Samba acting as a client. But when you try to mount a remote share, that's what you are doing: in this scenario your machine is a client, and the remote machine is a server.

Also, the "no reply" error is a hint that some firewall is messing things up. Machines do generally respond to requests. They may respond with an error, in which case you have other problems, but if they don't respond at all, then their packets are usually being eaten up by a firewall.

The rules that allow Samba to act as a server are not sufficient to also allow Samba to act as a client, because the remote machines respond from their own port 137, but the local port on which these responses arrive is not 137, it is some random port.

To solve this problem, execute the following command:

sudo ufw allow in proto udp from any port 137,138 to any

This will allow UDP packets to arrive into any local port as long as they are originating from port 137 or 138 of the remote computer. The port 138 is probably not necessary, as I have only seen packets arriving from 137, but you never know.

This is probably insecure, because the originating port can be spoofed, but let's not be paranoid.

This fixed it for me.

1
  • Had this exact issue, probably after resetting the network preferences after some bad tinkering. allowing Samba in the firewall fixed it!
    – HitLuca
    Mar 24 at 21:26
3

It's possible this is a general error connecting to the system:

In the above thread case, there was a mismatch between name and IP address, and nmblookup helped determine the problem. Also, this page seems to have some good troubleshooting tips

That I'm copying out:

  • Put smbclient into debugging mode, output should show up in dmesg (-d|--debuglevel=level)
  • smbclient -L //<IP of Samba Server> -U <server user>
  • nmblookup {name}
  • Can you mount from other systems?

Edit up your question if you do more troubleshooting.

2

Just add "allow out" to the firewall:

  • Port 137/UDP - used by nmbd
  • Port 138/UDP - used by nmbd
  • Port 139/TCP - used by smbd
  • Port 445/TCP - used by smbd

And it will work, and if you do not know how to, just install "gufw", and use the "+" and then the "simple tab".

2

With Ubuntu 14.04 :

This error can be caused by a netbios name having a size greater than 15 characters. It should generate logs in the file /var/log/samba/log.smbd looking like this :

register_name: NetBIOS name NAME-OF-PC-TOO-LONG is too long. Truncating to

This error can be fixed by editing the file /etc/samba/smb.conf and adding the following line :

netbios name = NAME-OF-PC

NAME-OF-PC shall not have more than 15 characters.

1

I've had very good results in mixed network environments (Windows/Ubuntu) with this method:

  1. Press Alt+F2 and type: gksu gedit /etc/nsswitch.conf

  2. Look for this line:

    hosts:  files mdns4_minimal [NOTFOUND=return] dns mdns4
    
  3. Add wins so it looks like this:

    hosts:  files mdns4_minimal [NOTFOUND=return] wins dns mdns4
    
  4. Install the "winbind" package: sudo apt-get install winbind

    (Or via Software Center or Synaptic.)

  5. Reboot or restart your network.

1

Try logging into a Windows box from Ubuntu using Files. Go to "Other Locations" and "Connect to Serer" down the bottom. Use smb://username@serveraddress. This worked for me.

1

When accessing a windows server on Ubuntu 20.04 with samba version 4.11.6, I solved the issue by adding to /etc/samba/smb.conf the lines below.

#### Networking ####
client min protocol = NT1
server min protocol = NT1
name resolve order = bcast host lmhosts wins
0

My problem was due to /etc/samba/smb.conf. Searched for WORKGROUP and deleted the line after it which mentioned a localhost name. Make sure the WORKGROUP is the same for both config files on each machine. An all round way is to sudo apt-get purge samba (and/or remove ?) and then sudo apt-get install samba. This is how I solve the problem the first time round, after upgrading from 16.10 to 17.04 on one of my machines (16.10 was buggy for me). I have two machines now: 16.04 and 17.04.

0

I had this problem and solved it by installing package gvfs-bin. Except for gvfs-bin, most of the gvfs packages were already installed: gvfs, -common, -libs, -daemons, and -backends.

0

I had the same problem in Ubuntu 18.04 and this solution worked for me.

  1. Edit /etc/samba/smb.conf and add the line client max protocol = NT1 after the workgroup = WORKGROUP entry.
  2. Restart the samba service by running sudo service smbd restart.
0

I had this issue recently when connecting from Ubuntu 20.04 to a Synology NAS.

The issue seemed to be caused by the software only providing SMB2 and SMB3 versions of the protocol.

When I set the share to support SMB1 (so version 1 to 3 supported) it worked.

In general the issue might be caused by the Samba settings that configure the protocol version and settings and the ones on the server side, so make sure they match.

0

You may need to install samba:

sudo apt install samba
-1

I could only see my samba server by ip address.

Switching bcast to 1st in 'name resolve order = bcast lmhosts hosts wins'. And restarting samba. Btw this 1 line restarts samba.

sudo service samba restart

That didn't work either.

I went to look in /etc/samba/lmhosts to check it & no file! So I made lmhosts.

$ sudo nano /etc/samba/lmhosts   
10.0.2.2   server_name 

I still couldn't search the server name. Then I thought wait, the computer name & samba name are different. So I edited hosts & hostname, changing them to the samba server's name. Careful hostname only has one word in it. The computer name no # comments.

/etc/hosts    
/etc/hostname    
$ sudo reboot 

Now it just works. I can just click network in nautilus or caja and the server just pops up! On all clients, all are linux or android. Even on an old debian squeeze machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.