Gert
Posts: 205
Joined: Wed Oct 24, 2012 10:19 pm

Name resolution of Wndows PC share no longer works

Wed Jun 23, 2021 8:57 pm

Hello All,

This was working before. (My memory is faint but it could be a few months)

The RPI4 mounts windows 7 shares via server name.

Code: Select all

cat fstab
...
# Shiva_D + E share from parent win7 system
//SHIVA/Shiva_D /media/Shiva_D   cifs credentials=/etc/samba/user,uid=1000,gid=1000,noexec  0 0
//SHIVA/Shiva_E /media/Shiva_E   cifs credentials=/etc/samba/user,uid=1000,gid=1000,noexec  0 0
Result:

Code: Select all

root@rpi4b:/etc# mount -a
mount error: could not resolve address for SHIVA: Unknown error
mount error: could not resolve address for SHIVA: Unknown error
What happened?

Which software is providing the name resolution? (netbios???) How to debug?

I don't want to go to hard coded IP address of the server. I want to understand why it no longer works and restore prev. function.

I might have done 'update / upgrade' in between.

In the desktop I am able to use the file manager to connect.

Image

Cheers,
Gert

User avatar
thagrol
Posts: 5254
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Name resolution of Wndows PC share no longer works

Wed Jun 23, 2021 9:45 pm

Name resolution is probably coming from your router acting as DNS server or, possibly, via netbios over tcp. Less likely over "pure" netbios.

Have you changed anything on the win7 box? For example configured it with a static IP address.

One obvious difference: In your fstab you use SHIVA, in the filemanager you use shiva. IIRC it shouldn't matter but try shiva in your fstab.

Another option would be to try shiva.local though unless you have mDNS/bonjour or similar instaled on the win7 box that won't work.

You may also want to add _netdev,x-systemd.automount to you mount options, -netdev flags twork must be online both the mount can be tried It should be able to work that out for itself but having it doesn't hurt. ,x-systemd.automount instructs systemd to (re)try the mount when the mountpoint* is accessed if it isn't already mounted.

I've never used win7 so can't help with specifcs there and don't use the file manager either (all my Pi are headless).

*: or a subdirectory.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Gert
Posts: 205
Joined: Wed Oct 24, 2012 10:19 pm

Re: Name resolution of Wndows PC share no longer works

Thu Jun 24, 2021 12:31 am

@thagrol, & All,

Thanks. Some good ideas to test.
thagrol wrote:
Wed Jun 23, 2021 9:45 pm
Have you changed anything on the win7 box? For example configured it with a static IP address.
-> NO

One obvious difference: In your fstab you use SHIVA, in the filemanager you use shiva. IIRC it shouldn't matter but try shiva in your fstab.
-> I tried lower case mount cmd (interactively) same failure.
I can resolve the name with nmblookup:

Code: Select all

root@rpi4b:/etc# nmblookup shiva
192.168.11.141 shiva<00>
192.168.40.1 shiva<00>
192.168.80.1 shiva<00>
root@rpi4b:/etc# nmblookup Shiva
192.168.11.141 Shiva<00>
192.168.40.1 Shiva<00>
192.168.80.1 Shiva<00>
root@rpi4b:/etc# nmblookup SHIVA
192.168.11.141 SHIVA<00>
192.168.40.1 SHIVA<00>
192.168.80.1 SHIVA<00>
No case sensitivity and the IP address gets resolved. Now only mount needs to understand to pick up the name resolution form nmblookup. How is that done ?

I've seen posts here:

https://unix.stackexchange.com/question ... -in-script

Recommending

Code: Select all

/etc/nsswitch.conf
hosts:          files dns mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return]
But that didn't help.


Cheers,
Gert

User avatar
thagrol
Posts: 5254
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Name resolution of Wndows PC share no longer works

Thu Jun 24, 2021 11:24 am

Does

Code: Select all

sudo mount -a
return the same error or does the mount succeed?

AIUI, mount.cifs uses the same name resolution as the rest of the system. That it's failing suggests one of two things: systemd is attemtping the mount too soon or there is an error in your fstab.

Have you tried the modifications I suggested above?
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Gert
Posts: 205
Joined: Wed Oct 24, 2012 10:19 pm

Re: Name resolution of Wndows PC share no longer works

Thu Jun 24, 2021 6:27 pm

@thagrol & All,

Thanks for the feedback.

I've done the mount cmd as root. Using sudo does not give a change.

Code: Select all

root@rpi4b:/etc# mount -a
mount error: could not resolve address for Shiva: Unknown error
mount error: could not resolve address for Shiva: Unknown error
root@rpi4b:/etc# sudo mount -a
mount error: could not resolve address for Shiva: Unknown error
mount error: could not resolve address for Shiva: Unknown error
The same fstab was working some time back.

Code: Select all

# Shiva_D + E share from parent win7 system
//Shiva/Shiva_D /media/Shiva_D   cifs credentials=/etc/samba/user,uid=1000,gid=1000,noexec  0 0
//Shiva/Shiva_E /media/Shiva_E   cifs credentials=/etc/samba/user,uid=1000,gid=1000,noexec  0 0
same error happens when I do the mount cmd manually on the command line.

Code: Select all

root@rpi4b:/etc# mount -t cifs //Shiva/Shiva_D /media/Shiva_D 
mount error: could not resolve address for Shiva: Unknown error
Proposed edits to fstab:

Code: Select all

# Shiva_D + E share from parent win7 system
//Shiva/Shiva_D /media/Shiva_D   cifs credentials=/etc/samba/user,uid=1000,gid=1000,noexec,_netdev,x-systemd.automount  0 0
//Shiva/Shiva_E /media/Shiva_E   cifs credentials=/etc/samba/user,uid=1000,gid=1000,noexec,_netdev,x-systemd.automount  0 0

Code: Select all

root@rpi4b:/etc# mount -a
mount error: could not resolve address for Shiva: Unknown error
mount error: could not resolve address for Shiva: Unknown error
As mentioned before the main issue seems to be that mount is failing to perform the correct name lookup. The nmblookup shows that it can be done regardless of upper/lower case typin). Now we only need to tell mount to do the same.

Cheers,
Gert

bls
Posts: 1588
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Name resolution of Wndows PC share no longer works

Thu Jun 24, 2021 7:11 pm

Can you ping shiva from the Pi?
Pi tools:
Quickly and easily build customized-just-for-you SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

Gert
Posts: 205
Joined: Wed Oct 24, 2012 10:19 pm

Re: Name resolution of Wndows PC share no longer works

Fri Jun 25, 2021 3:41 am

bls wrote:
Thu Jun 24, 2021 7:11 pm
Can you ping shiva from the Pi?
@bls

Ping is in the same DNS camp as mount so it does not resolve the name. As nmblookup uses netbios it can do it.

What's the deal with the .local name? Would that help?

Code: Select all

root@rpi4b:/etc# ping shiva
ping: shiva: No address associated with hostname
root@rpi4b:/etc# ping shiva.local
ping: shiva.local: Name or service not known
root@rpi4b:/etc# nmblookup shiva
192.168.11.141 shiva<00>
192.168.40.1 shiva<00>
192.168.80.1 shiva<00>
root@rpi4b:/etc# nmblookup shiva.local
name_query failed to find name shiva.local
Key point here is to teach mount (and ping) to use netbios for resolution.

What is the job of /etc/nsswitch.conf ??

Code: Select all

# cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         files
group:          files
shadow:         files
gshadow:        files

hosts:          files dns [NOTFOUND=return] mdns_minimal
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis
Cheers,
Gert

Gert
Posts: 205
Joined: Wed Oct 24, 2012 10:19 pm

Re: Name resolution of Wndows PC share no longer works

Fri Jun 25, 2021 3:54 am

Interestingly when I use ping on shiva (windows PC) I get this odd format.
Doesn't look like IP4 or IP6. What is it ?

Code: Select all

>ping shiva

Pinging Shiva [fe80::1935:10df:f4d6:bf4%11] with 32 bytes of data:
Reply from fe80::1935:10df:f4d6:bf4%11: time<1ms
Reply from fe80::1935:10df:f4d6:bf4%11: time<1ms
Reply from fe80::1935:10df:f4d6:bf4%11: time<1ms
Reply from fe80::1935:10df:f4d6:bf4%11: time<1ms

Ping statistics for fe80::1935:10df:f4d6:bf4%11:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
Cheers,
Gert

bls
Posts: 1588
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Name resolution of Wndows PC share no longer works

Fri Jun 25, 2021 3:56 am

Probably not what you want to hear, but netbios and nmblookup are on their way out. Microsoft has effectively replaced it with DNS.

That said, there are still a lot of people that use it (including you). I don't know much about it, since I switched to using DNS instead of this gawd-awfully horrible protocol years ago.

It seems that there is a lot of info about it on the web still. You might take a look at the smb.conf option "name resolve order". Pulling on this thread, and some judicious web surfing could be a fruitful path.

Lastly, do you have a designated WINS server on your network? There used to be a way to designate one, or to ensure that a specific host was THE WINS server, but I've apparently replaced those brain cells with bash and python details :roll:
Pi tools:
Quickly and easily build customized-just-for-you SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

Gert
Posts: 205
Joined: Wed Oct 24, 2012 10:19 pm

Re: Name resolution of Wndows PC share no longer works

Fri Jun 25, 2021 4:39 am

@bls,

I have this older ubuntu VM sitting around that happily does the name resolve.

Code: Select all

$ grep SHIVA /etc/fstab
//SHIVA/Shiva_D /media/Shiva_D   cifs credentials=/etc/samba/user,uid=1000,gid=1000,noexec  0 0
//SHIVA/Shiva_E /media/Shiva_E   cifs credentials=/etc/samba/user,uid=1000,gid=1000,noexec  0 0

Code: Select all

$ mount | grep SHIVA
//SHIVA/Shiva_E on /media/Shiva_E type cifs (rw,noexec)
//SHIVA/Shiva_D on /media/Shiva_D type cifs (rw,noexec)
It can do the ping as well:

Code: Select all

$ ping shiva
PING shiva (192.168.11.141) 56(84) bytes of data.
64 bytes from Shiva (192.168.11.141): icmp_seq=1 ttl=128 time=0.099 ms
64 bytes from Shiva (192.168.11.141): icmp_seq=2 ttl=128 time=0.297 ms
64 bytes from Shiva (192.168.11.141): icmp_seq=3 ttl=128 time=0.210 ms
64 bytes from Shiva (192.168.11.141): icmp_seq=4 ttl=128 time=0.245 ms
And nmblookup.

Code: Select all

$ nmblookup shiva
192.168.11.141 shiva<00>
192.168.40.1 shiva<00>
192.168.80.1 shiva<00>
I haven't updated the VM in ages (it just works).

Something in the RPI changed and broke it. But what ?

Cheers,
Gert

bls
Posts: 1588
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Name resolution of Wndows PC share no longer works

Fri Jun 25, 2021 12:56 pm

Gert wrote:
Fri Jun 25, 2021 4:39 am
@bls,

I have this older ubuntu VM sitting around that happily does the name resolve.

Code: Select all

$ grep SHIVA /etc/fstab
//SHIVA/Shiva_D /media/Shiva_D   cifs credentials=/etc/samba/user,uid=1000,gid=1000,noexec  0 0
//SHIVA/Shiva_E /media/Shiva_E   cifs credentials=/etc/samba/user,uid=1000,gid=1000,noexec  0 0

Code: Select all

$ mount | grep SHIVA
//SHIVA/Shiva_E on /media/Shiva_E type cifs (rw,noexec)
//SHIVA/Shiva_D on /media/Shiva_D type cifs (rw,noexec)
It can do the ping as well:

Code: Select all

$ ping shiva
PING shiva (192.168.11.141) 56(84) bytes of data.
64 bytes from Shiva (192.168.11.141): icmp_seq=1 ttl=128 time=0.099 ms
64 bytes from Shiva (192.168.11.141): icmp_seq=2 ttl=128 time=0.297 ms
64 bytes from Shiva (192.168.11.141): icmp_seq=3 ttl=128 time=0.210 ms
64 bytes from Shiva (192.168.11.141): icmp_seq=4 ttl=128 time=0.245 ms
And nmblookup.

Code: Select all

$ nmblookup shiva
192.168.11.141 shiva<00>
192.168.40.1 shiva<00>
192.168.80.1 shiva<00>
I haven't updated the VM in ages (it just works).

Something in the RPI changed and broke it. But what ?

Cheers,
Gert
Have you ensured that all relevant config files on the PI are consistent with your ubuntu vm?
Pi tools:
Quickly and easily build customized-just-for-you SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

Gert
Posts: 205
Joined: Wed Oct 24, 2012 10:19 pm

Re: Name resolution of Wndows PC share no longer works

Tue Jun 29, 2021 4:29 am

@bls,
bls wrote:
Fri Jun 25, 2021 12:56 pm
...

Have you ensured that all relevant config files on the PI are consistent with your ubuntu vm?
Alas what would be 'relevant' ? Too many subtleties between the ubuntu and debian style.
Checking fstab , smb.conf, what else ?

Do let me know if you have proposals to check. Any idea leading to a solution is most welcome.

Cheers,
Gert'.

bls
Posts: 1588
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Name resolution of Wndows PC share no longer works

Tue Jun 29, 2021 1:46 pm

Gert wrote:
Tue Jun 29, 2021 4:29 am
@bls,
bls wrote:
Fri Jun 25, 2021 12:56 pm
...

Have you ensured that all relevant config files on the PI are consistent with your ubuntu vm?
Alas what would be 'relevant' ? Too many subtleties between the ubuntu and debian style.
Checking fstab , smb.conf, what else ?

Do let me know if you have proposals to check. Any idea leading to a solution is most welcome.

Cheers,
Gert'.
Since it's working on your ubuntu system there's obviously some subtle change you made there to get it working. Here are a few that come to mind.
  • /etc/samba/smb.conf
  • /etc/nsswitch.conf
  • /etc/hosts
  • /etc/resolv.conf
  • /etc/resolvconf.conf
I guess I have to make the suggestion: Since nmb name resolution is a dying protocol, perhaps you should consider moving to DNS-based name resolution. At some point in the future it could likely become a mandatory change. :roll:
Pi tools:
Quickly and easily build customized-just-for-you SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

hortimech
Posts: 512
Joined: Wed Apr 08, 2015 5:52 pm

Re: Name resolution of Wndows PC share no longer works

Tue Jun 29, 2021 2:31 pm

bls wrote:
Tue Jun 29, 2021 1:46 pm
I guess I have to make the suggestion: Since nmb name resolution is a dying protocol, perhaps you should consider moving to DNS-based name resolution. At some point in the future it could likely become a mandatory change. :roll:
I will raise your 'likely' with 'definitely', 'nmbd' relies on SMBv1 and Samba is actively working on totally removing SMBv1 and when that day comes, 'nmbd' will be removed as well.

Gert
Posts: 205
Joined: Wed Oct 24, 2012 10:19 pm

Re: Name resolution of Wndows PC share no longer works

Tue Jun 29, 2021 10:24 pm

@bls, @hortimech,

Thanks for pointing to the checklist.

/etc/nsswitch.conf
Same entry for 'hosts' : files mdns4_minimal [NOTFOUND=return] wins dns (different in passwd, group,shadow. But I don't think these are relevant)

/etc/hosts
Both same for localhost : 127.0.0.1 localhost (any of the ipv6 relevant?)

/etc/resolv.conf
Both same : nameserver 127.0.0.1

/etc/resolvconf.conf
Not available in ubuntu. In RPI:
dnsmasq_resolv=/var/run/dnsmasq/resolv.conf
pdnsd_conf=/etc/pdnsd.conf
unbound_conf=/var/cache/unbound/resolvconf_resolvers.conf

/etc/samba/smb.conf
I did some grep | sort etc to try bruinging both files into a format for tkdiff. Not really successful. Screencopy of what I got.
http://skywatcher.space/download/smbcon ... vs_rpi.jpg

As the only real observed gaps seem to be in smb.conf I might try to make some changes here. Just poking around. :-(

I understand you pointing to DNS. Now for the small home hobbyist network (win7 / win10 / div RPI / linux) what is a good way to go? I am not much knowledgeable on setting up a DNS server. (Other than using PI-hole for add blocking)

Netbios seems to be old and deprecated but it comes close to my idea of a hands-off solution where the computers among themselves figure out what their names/IP addresses are so I (as user/hobby admin) don't have to manage lists of IP address numbers. What's wrong with that expectation? :-) In my currwent setup I tell the win7 machine it's name is 'shiva' and it belongs to workgroup (Alas another deprecated concept) 'gghome'. In the ubuntu machine fstab I can type //shiva/ and it's happy. I like that.

I see posts pointing to '.local' domain naming. Is that a way out? Is there some easy-enough-for-me tutorial ?

Cheers,
Gert

bls
Posts: 1588
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Name resolution of Wndows PC share no longer works

Tue Jun 29, 2021 11:30 pm

Gert wrote:
Tue Jun 29, 2021 10:24 pm
@bls, @hortimech,

Thanks for pointing to the checklist.

/etc/nsswitch.conf
Same entry for 'hosts' : files mdns4_minimal [NOTFOUND=return] wins dns (different in passwd, group,shadow. But I don't think these are relevant)

/etc/hosts
Both same for localhost : 127.0.0.1 localhost (any of the ipv6 relevant?)

/etc/resolv.conf
Both same : nameserver 127.0.0.1

/etc/resolvconf.conf
Not available in ubuntu. In RPI:
dnsmasq_resolv=/var/run/dnsmasq/resolv.conf
pdnsd_conf=/etc/pdnsd.conf
unbound_conf=/var/cache/unbound/resolvconf_resolvers.conf

/etc/samba/smb.conf
I did some grep | sort etc to try bruinging both files into a format for tkdiff. Not really successful. Screencopy of what I got.
http://skywatcher.space/download/smbcon ... vs_rpi.jpg

As the only real observed gaps seem to be in smb.conf I might try to make some changes here. Just poking around. :-(

I understand you pointing to DNS. Now for the small home hobbyist network (win7 / win10 / div RPI / linux) what is a good way to go? I am not much knowledgeable on setting up a DNS server. (Other than using PI-hole for add blocking)

Netbios seems to be old and deprecated but it comes close to my idea of a hands-off solution where the computers among themselves figure out what their names/IP addresses are so I (as user/hobby admin) don't have to manage lists of IP address numbers. What's wrong with that expectation? :-) In my currwent setup I tell the win7 machine it's name is 'shiva' and it belongs to workgroup (Alas another deprecated concept) 'gghome'. In the ubuntu machine fstab I can type //shiva/ and it's happy. I like that.

I see posts pointing to '.local' domain naming. Is that a way out? Is there some easy-enough-for-me tutorial ?

Cheers,
Gert
I generally don't click on links to unknown sites, so not looking at your jpg, so no comments on that.

The .local "domain" is what is set up by mdns. You can use it on small LANs for name resolution if all the systems on your LAN that you care about use mdns. You'll have to websearch your way to an answer on whether Win7 supports mdns well enough to be used. On RasPiOS the avahi service is used (and you found it in nsswitch (mdns4_minimal)

When I started using Linux for my home network there was no mdns, so I set up Bind and isc-dhcp-server on (I think) RH9. Edited those freaking files for many years.

I eventually got really tired of that so built a tool to generate all the files for bind (DNS) and isc-dhcp-server (DHCP) from a small json-formatted database that it manages. I recently added the ability to use dnsmasq instead of bind/isc-dhcp-server, operating from the same database.

It's quite easy to use if you're comfortable with the Linux command line. Define all the hosts, use the build command to build all the config files for the selected dns/dhcp servers into /tmp, and then use the install command to install them into the running system. https://github.com/gitbls/ndm

Assuming win7 supports mdns that would probably be the easiest way for you to go, but if it doesn't or if you'd prefer to stop using your router for your DHCP server and run a "production" Pi instead, you can have a look at ndm. If you read the issues there, you'll see that I'm quite responsive to problem reports and feature requests.

You didn't say whether you are actually using pihole today for ad blocking, but if so you can probaby use it for dns and dhcp as well. Pihole seems fine, but a bit complex for my tastes, and too many people seem to have issues with it, perhaps related to the complexity of the install. Don't know, but if you have it working, you may be most of the way to solving your issue.

HTH
Pi tools:
Quickly and easily build customized-just-for-you SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

User avatar
thagrol
Posts: 5254
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Name resolution of Wndows PC share no longer works

Tue Jun 29, 2021 11:43 pm

Gert wrote:
Tue Jun 29, 2021 10:24 pm
I understand you pointing to DNS. Now for the small home hobbyist network (win7 / win10 / div RPI / linux) what is a good way to go? I am not much knowledgeable on setting up a DNS server. (Other than using PI-hole for add blocking)
Assuming you're connecting from your home network it's likely your router is already acting as both a DHCP server and as a DNS server.

Where you may come unstuck is when you have a locally (i.e. on the device) configured static IP address. Because it wasn't issued by your DHCP server, the corresponding DNS server likely won't know about it so won't be able to resolve it.

For machines other than your DHCP and DNS server(s) switching to reserving IP address by MAC address on the DHCP server rather than locally configured ones should help. Once the address reservation is configured, reconfigure the relevant box from static to DHCP.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Return to “Troubleshooting”