cannot browse samba shares without editing smb.conf

Bug #375593 reported by Martin G Miller
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
samba (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: samba

I maintain 2 networks with mixed ubuntu / Windows XP SP2 machines and this problem started suddenly in September of 2008. All of my Ubuntu machines whether they are clean installs of 8.04 or 8.10 or 9.04, 32 or 64 bit or upgrades from earlier versions all exhibit the failure to display or browse smb shares. The only fix is to edit etc/samba/smb.conf:
# What naming service and in what order should we use to resolve host names
# to IP addresses
 ; name resolve order = lmhosts host wins bcast

remove the leading ; from the name resolve order line and change the order of the entries to read:
   name resolve order = lmhosts wins bcast host

Save the file, log off and back on.

This change fixes the problem for all my machine in both networks.
The problem remains unresolved in Jaunty unless I do this. This problem appeared suddenly in September of 2008 on 8.04 machines that had been working normally and has persisted through 8.10 and now 9.04.

Clicking on the Places > Network to bring up the network browse gui will take a fairly long time to appear and it will not display any of the machines on the network, whether Ubuntu or Windows XP. It may display an icon for "Windows Network", but if that is clicked, the system times out with nothing displayed after about 60 seconds.

This happens on all machines whether clean installs or upgrades with 8.04, 8.10 and 9.04, both 32 And 64 bit. IT also does not matter if the Ubuntu machines are static IP or DHCP.

After editing the smb.conf file as noted above, the network gui works quickly and as expected & displays all shares on all Windows XP and Ubuntu machines on the local network.

Additional info: until I found the fix noted here, I installed the kde 3.x network browser. I forget the name of the package, but that worked instantly. Once I got gnome working, I uninstalled it. I have not had to do this on the new 9.04 installs, I just edit smb.conf and everything works as expected.

Revision history for this message
Thierry Carrez (ttx) wrote :

I guess something changed in your network (or DNS settings) in September of 2008, that makes your host resolution fail. Like switching to a "smart" DNS server like OpenDNS...

Could you run the following command on one of your share-containing servers:
smbclient -d 4 -N -L //servername
and attach the corresponding output ?

Changed in samba (Ubuntu):
status: New → Incomplete
Revision history for this message
Martin G Miller (mgmiller) wrote :

Here is the requested output. This machine has the changed smb.conf file and is both a samba server and also accesses shares over the network.

Revision history for this message
Thierry Carrez (ttx) wrote :

Apparently this is the (successful) smbclient output you get once you edited the smb.conf file so that bcast is tried before host. I need the smbclient trace for a failure case... Could you restore the original smb.conf file (the one that fails) temporarily and regenerate/attach the resulting output ?
Thanks

Revision history for this message
Martin G Miller (mgmiller) wrote :

OK, I set the smb.conf back to original and logged off and back on. The network browse gui now takes a long time to appear and clicking on the displayed mshome workgroup also takes a long time to resolve. Trying to click on one of the shown computers in the workgroup produces an error message "Unable to mount location Failed to retrieve share list from server". Attached is the output of command you requested.

Revision history for this message
Thierry Carrez (ttx) wrote :

So it seems that local access (tux->tux) is working correctly. Could you try to access tux with smbclient from another machine (or access another machine from tux) and send the corresponding smbclient log ? (using the original, failing "name resolve order" set on the client, please)

Also could you try the following tools and report results:
smbtree -N
smbtree -N -b

Thanks !

Revision history for this message
Martin G Miller (mgmiller) wrote :

I set the smb.conf back to the default and here is the output of your 2 commands. These 2 commands take a while as it seems to time out after a bit. If I run them with my modified smb.conf, they execute instantly and show a lot of info on my network, with no apparent error messages.

Could you please tell me where the smbclient log is? It's not in /var/log.

Revision history for this message
Martin G Miller (mgmiller) wrote :

The closest I could find was /var/log/samba/log.smbd

Revision history for this message
Thierry Carrez (ttx) wrote :

The problem is apparently in your DNS resolution. Basically the master browser says that "UPSTAIRS" exists. But when you browse it tries to resolve UPSTAIRS to an IP address...

With the default resolve order, it tries DNS resolution before broadcast. For some reason (I suspect a DNS that answers something where it shouldn't, like OpenDNS) your DNS resolves UPSTAIRS -> 67.63.55.3. That timeouts and fails.

If you switch to bcast before hosts then it asks locally on your LAN "who is UPSTAIRS" et gets the right answer.

Setting as invalid as your DNS should not answer 67.63.55.3 when you ask for UPSTAIRS. It should either fail to answer or return the IP address of the UPSTAIRS machine. Try "ping UPSTAIRS" to double-check...

Changed in samba (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Martin G Miller (mgmiller) wrote :

ping upstairs does indeed try to resolve 67.63.55.3. This IP address is nowhere in my network. "ping" does resolve it, but it takes about 23 ms. I have no idea why this should be. I have the exact same problem on 2 different networks in 2 different towns using different brands of routers. They both require the smb.conf fix as noted above to work. The only similarity between the 2 networks is that they both use the same ISP. Could this be somehow related to DNS by my ISP? The 67.63... belongs to a company on the other side of the USA from where I am.

Revision history for this message
Martin G Miller (mgmiller) wrote :

One last thought. If the default resolve order is using DNS before broadcast, doesn't that slow down local network browsing? Since this may turn out to be an ISP problem on my end, wouldn't it make sense to change the default resolve order so it looks at the local network before trying DNS? Using the changed order, the network browse gui pops up instantly. Using the default, it takes close to a minute to appear. I also checked the addresses of my DNS servers and I am not using openDNS. I am using the DNS servers that my ISP assigns to my router.

Revision history for this message
Thierry Carrez (ttx) wrote :

No, it usually slows down to do broadcast resolution (since you basically have to wait for some timeout to decide that nobody has the requested address), that's why it's tried last by default.

So solution for you is to change the resolve order in smb.conf. The other solution is to set up /etc/hosts (or lmhosts), or a local DNS server that would resolve the local hosts before forwarding the request to your ISP DNS server. Last option is to push your ISP to not do "smart" name resolution (giving answers to non-existent hosts) in an effort to gain some extra advertisement revenue.

Revision history for this message
Martin G Miller (mgmiller) wrote :

The smb.conf resolve order change is one of the first things I have to do on new installs, so that is a work around for me. The fact that it returns the wrong ip address on a ping command is something that I am interested in. I tried the same tests at my office in another town and it behaves exactly the same way. The difference is that I have 2 Wilndows XP pro sp2 machines there as well as 4 ubuntu 8.04 boxes. I find that I can use the windows machine to "ping server" and it returns the correct 10.0.0.5 address of my server. If I try that from any of the Ubuntu machines, it goes out to the same 67.63.55.3 that I got at home. If I change my dns servers from the ones supplied by my ISP to the ones used by openDNS for example, it behaves the same way, except it tries to ping a different ip address. In fact, regardless of what I put after the ping command, it always goes to the same outside address. I get the same result whether from my ISP dns server or openDNS. But the windowsXP boxes always get the ping command correct. So there is something different about how WindowsXP processes a ping request from how we are doing it in Ubuntu. Should I open a new bug centered on this behavior? I suspect if this got resolved, it would fix the network browse issue as well. My ISP is Optimum online. It is the fastest and best cable broadband provider on Long Island, New jersey and Connecticut. If I am having this problem, so is every other Ubuntu user in these areas. I think it should be looked into.

Revision history for this message
Thierry Carrez (ttx) wrote :

It works on Windows because Windows name resolution also does SMB broadcast resolution (also called noisy resolution) on local names so it "avoids" the DNS redirection issue.

Optimum Online apparently does DNS redirection:
http://text.broadbandreports.com/shownews/Optimum-Online-Now-Using-DNS-Redirection-97985
Switching to OpenDNS just gets you another spam IP.

Revision history for this message
Martin G Miller (mgmiller) wrote :

Thank you for that link. There is an opt-out provided for DNS redirection. I tried that and with the smb.conf set back to the default, the network browse gui is now working. If i try a ping <any name> however, it returns a "host unknown" error. Pinging to the ip address works as expected. So, there is still a name resolution issue of some kind here.

Is there some reason Ubuntu does not do the same kind of SMB broadcast resolution on local names as Windows? I don't mind tinkering a bit, as that's how I learn, but I'm thinking of the average new user who tries to network his home or small office and this stuff just does not work as expected.

Revision history for this message
Martin G Miller (mgmiller) wrote :

I found an interesting link here: http://ubuntuforums.org/showthread.php?t=826938
They edited both smb.conf ( name resolve order = lmhosts bcast wins host) Notice this resolve order is different than the one I am using. They also modified nsswitch.conf (hosts: files dns wins) to get name resolution working. I tried that, and although it fixes the name resolution with ping issue, some of the nautilus network browse functions seem to stop. For example, I can't browse my own machine's samba shares. For the time being I have set the smb.conf back to where I had it and returned nsswitch.conf to it's default as well.

Revision history for this message
Thierry Carrez (ttx) wrote :

"host unknown" is the expected result to "ping server" since none of your NSS backends knows about your "server" to translate it to IP. That's what allows bcast to take over in your name resolve order and successfully find the share.

Glad there was some opt-out, dns redirection is a real PITA.

Revision history for this message
Jonathan Marsden (jmarsden) wrote :

@Martin: If ping <any name> fails, I wonder if the DNS redirection opt-out has somehow effectively "opted out" of *all* DNS resolution? That could explain why ping yahoo.com (for example) now fails. Can you still browse the web, deal with email, etc as normal once "opted out" from the DNS redirection? If you can, then at least some names are resolving OK.

Did you mean that ping <any local machine name> now fails, but remote DNS registered hostnames/domains (like ping yahoo.com ) still work fine?

If it is just local machine names that are failing to resolve, then I suspect you can either:

 (a) add the machine names and their IPs manually to your hosts file(s) or to the DNS zonefile for your local (internal) DNS domain, or into WINS if there is a WINS server in the picture

and/or (more work up front, but probably better and less maintenance once set up)

 (b) arrange for the DHCP server to dynamically update your local DNS server, so that the name and IP of each Windows machine that receives a DHCP-provided IP address appears as a hostname there. If the DHCP server and DNS server are a Windows 2003 server, this is essentially "automatic"; if you are using Ubuntu for these services, you'll have to do some configuration work to get it to behave this way, as far as I know.

One more thought: If "ping server" fails but "ping server.mydomain.local" works, then the default DNS resolver search probably needs changing to include your domain name (search mydomain.local in my example). You can edit this in /etc/resolv.conf .

Getting rid of your DNS redirection was a big step in the right direction.

Revision history for this message
Martin G Miller (mgmiller) wrote :

What had stopped working was ping <any local machine name>. ping yahoo.com worked fine.

What I have as of now is:
1) DNS redirection is turned off
2) smb.conf set to: (name resolve order = lmhosts wins bcast host)
3) nsswitch.conf set to: (hosts: files dns wins)

It took a restart to get everything to settle down, but this now seems to have the Nautilus browse gui happy and I can enter ping <any local machine> or ping <anything.com> and they all seem to work. All other internet functions, eg. email, web browsing, etc. seem to work fine.

I am not part of a domain either here or at work, so trying to ping server.mydomain.local is not an option.

Removing mdns from nsswitch.conf and substituting wins seems to do the trick as long as the order in smb.conf is set to my original changed setup.

mdns refers to the avahi daemon, I believe. I don't think I use that for anything do I?

My DHCP server is my router (Linksys at home and dlink gigabit at work) I'm not sure how to tell it to update my local DNS server, in fact, I don't think I'm running one. My main Ubuntu machine at home is static IP, as it functions as my house file server. But other machines on the network, both Ubuntu and WindowsXP are all DHCP.

At my office, the main file server is WinXP pro SP2 all but 1 of the work stations are Ubuntu 8.04.2 and everyone has a static IP.

I will try the changes at my office tomorrow and see if they work there as well as they do at my home now.

I must reiterate my thought from a few posts ago. Why do I have to go through this when Windows XP "just works". As someone who has been using Linux for about 9 years, I don't mind the tinkering too much, but I am actively promoting Ubuntu to friends and professional associates and I want them, as noobies, to have as good an experience as possible. Simple local networking should not create problems like this. DNS redirection does not affect local network browsing in Windows XP. It should not affect it in Ubuntu either.

Revision history for this message
Chris Wiesner (chris-wiesner) wrote :

Hello,
I am a NEWBIE to the world of linux and ubuntu. Just installed ubuntu 9.04 a few days ago and attached this laptop to my windows network. I get this same error, even though my shares are turned on in my windows xp pro(sp3) machines. I want to make the change as shown above to my etc/samba/smb.conf using gedit. However, I get an error message that will not allow me to change. In the properties window of smb.conf the message in permissions appears: you are not the owner, so you cannot change these permissions. I know this may be a problem of a different sort, but how to I get such permission? I am the only user defined on this system!!

I have tried using an ftp solution to access my xp machine running an ftp server - no luck(but that could be something else, will check it out another time.

There appears to be no vnc around which supports file transfers. I use ultra-vnc on my windows machine, but the ubuntu version is just a remote desktop. I am frustrated beyond belief that such a simple thing (browsing files on a local network) could be so complicated.

Any assistance would be greatly appreciated.

CW

Revision history for this message
Martin G Miller (mgmiller) wrote :

When trying to edit OS configuration files, you need to have root privileges. The command to use in this case is:
gksu gedit /etc/samba/smb.conf

It will ask you for your password, just use the same password you use when you log into Ubuntu.

For most help on these types of questions, you should join the ubuntu forums at ubuntuforums.org
You will find a lot of very helpful people there.

Revision history for this message
Chris Wiesner (chris-wiesner) wrote : Re: [Bug 375593] Re: cannot browse samba shares without editing smb.conf

Hello Martin,
Thanks very much for the tip and the info. I will attempt this next time I
get to my laptop. My desktop is still a windoze machine.. :) I'll be
watching more in the forums.
Regards,
Chris

On Sat, Jul 25, 2009 at 5:38 PM, Martin G Miller <email address hidden>wrote:

> When trying to edit OS configuration files, you need to have root
> privileges. The command to use in this case is:
> gksu gedit /etc/samba/smb.conf
>
> It will ask you for your password, just use the same password you use
> when you log into Ubuntu.
>
> For most help on these types of questions, you should join the ubuntu
> forums at ubuntuforums.org
> You will find a lot of very helpful people there.
>
> --
> cannot browse samba shares without editing smb.conf
> https://bugs.launchpad.net/bugs/375593
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “samba” package in Ubuntu: Invalid
>
> Bug description:
> Binary package hint: samba
>
> I maintain 2 networks with mixed ubuntu / Windows XP SP2 machines and this
> problem started suddenly in September of 2008. All of my Ubuntu machines
> whether they are clean installs of 8.04 or 8.10 or 9.04, 32 or 64 bit or
> upgrades from earlier versions all exhibit the failure to display or browse
> smb shares. The only fix is to edit etc/samba/smb.conf:
> # What naming service and in what order should we use to resolve host names
> # to IP addresses
> ; name resolve order = lmhosts host wins bcast
>
> remove the leading ; from the name resolve order line and change the order
> of the entries to read:
> name resolve order = lmhosts wins bcast host
>
> Save the file, log off and back on.
>
> This change fixes the problem for all my machine in both networks.
> The problem remains unresolved in Jaunty unless I do this. This problem
> appeared suddenly in September of 2008 on 8.04 machines that had been
> working normally and has persisted through 8.10 and now 9.04.
>
> Clicking on the Places > Network to bring up the network browse gui will
> take a fairly long time to appear and it will not display any of the
> machines on the network, whether Ubuntu or Windows XP. It may display an
> icon for "Windows Network", but if that is clicked, the system times out
> with nothing displayed after about 60 seconds.
>
> This happens on all machines whether clean installs or upgrades with 8.04,
> 8.10 and 9.04, both 32 And 64 bit. IT also does not matter if the Ubuntu
> machines are static IP or DHCP.
>
> After editing the smb.conf file as noted above, the network gui works
> quickly and as expected & displays all shares on all Windows XP and Ubuntu
> machines on the local network.
>
> Additional info: until I found the fix noted here, I installed the kde 3.x
> network browser. I forget the name of the package, but that worked
> instantly. Once I got gnome working, I uninstalled it. I have not had to
> do this on the new 9.04 installs, I just edit smb.conf and everything works
> as expected.
>

Revision history for this message
Chris Wiesner (chris-wiesner) wrote :
Download full text (3.2 KiB)

Hello Martin,
I've had some time to play with this. The code gksu... worked well. It
prompted me for my admin password, and I was able to make the necessary
changes, albeit not the ones recommended in the forum..

I used, the following instead:
name resolve order = lmhosts wins bcast host

I also changed the workgroup name to that of my local area workgroup. Will
do some more to see which paramater actually made it work.. :) and will keep
you informed.

Regards,
Chris

On Sat, Jul 25, 2009 at 5:38 PM, Martin G Miller <email address hidden>wrote:

> When trying to edit OS configuration files, you need to have root
> privileges. The command to use in this case is:
> gksu gedit /etc/samba/smb.conf
>
> It will ask you for your password, just use the same password you use
> when you log into Ubuntu.
>
> For most help on these types of questions, you should join the ubuntu
> forums at ubuntuforums.org
> You will find a lot of very helpful people there.
>
> --
> cannot browse samba shares without editing smb.conf
> https://bugs.launchpad.net/bugs/375593
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “samba” package in Ubuntu: Invalid
>
> Bug description:
> Binary package hint: samba
>
> I maintain 2 networks with mixed ubuntu / Windows XP SP2 machines and this
> problem started suddenly in September of 2008. All of my Ubuntu machines
> whether they are clean installs of 8.04 or 8.10 or 9.04, 32 or 64 bit or
> upgrades from earlier versions all exhibit the failure to display or browse
> smb shares. The only fix is to edit etc/samba/smb.conf:
> # What naming service and in what order should we use to resolve host names
> # to IP addresses
> ; name resolve order = lmhosts host wins bcast
>
> remove the leading ; from the name resolve order line and change the order
> of the entries to read:
> name resolve order = lmhosts wins bcast host
>
> Save the file, log off and back on.
>
> This change fixes the problem for all my machine in both networks.
> The problem remains unresolved in Jaunty unless I do this. This problem
> appeared suddenly in September of 2008 on 8.04 machines that had been
> working normally and has persisted through 8.10 and now 9.04.
>
> Clicking on the Places > Network to bring up the network browse gui will
> take a fairly long time to appear and it will not display any of the
> machines on the network, whether Ubuntu or Windows XP. It may display an
> icon for "Windows Network", but if that is clicked, the system times out
> with nothing displayed after about 60 seconds.
>
> This happens on all machines whether clean installs or upgrades with 8.04,
> 8.10 and 9.04, both 32 And 64 bit. IT also does not matter if the Ubuntu
> machines are static IP or DHCP.
>
> After editing the smb.conf file as noted above, the network gui works
> quickly and as expected & displays all shares on all Windows XP and Ubuntu
> machines on the local network.
>
> Additional info: until I found the fix noted here, I installed the kde 3.x
> network browser. I forget the name of the package, but that worked
> instantly. Once I got gnome working, I uninstalled it. I have not had to
> do this o...

Read more...

Revision history for this message
Martin G Miller (mgmiller) wrote :

Hi Chris;
Glad it worked.

If you look at my post #18 above, you will see that "name resolve order = lmhosts wins bcast host" is the order that I recommended. Assuming you also removed the leading semicolon(;) from the line, then, that is probably what did the trick for you.

Changing the workgroup name most likely won't have any effect in Linux because you will see all the workgroups listed when you first start up the network browser. It's not like in Windows where if you're not in the work group you see nothing.

In other bug reports on this issue I have identified the real underlying culprit. Your ISP is using DNS redirection. If there is some way you can opt out of it, it would make the resolve order change unneeded. The order that is used by default is a little more efficient on certain types of corporate networks, but gives problems if DNS redirection is used. There is serious discussion going on now about changing the default or making other changes to detect the network status to avoid this problem. Because DNS redirection is being used by more and more ISP's as a source of generating income, something needs to be done to address this issue.

If you want to read about it, there is more detail here: https://bugs.launchpad.net/bugs/389909

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.