I've got two laptops each with the same version of Kubuntu (19.10), both installed less than a month from each other.
By following advice elsewhere on this site, I managed to set them up to see a third machine with Windows on it. I did this by installing winbind
and libnss-winbind
, and setting the following line in /etc/nsswitch.conf
:
hosts: files mdns4_minimal [NOTFOUND=return] dns wins mdns4
The first laptop worked great and I was always able to ping
the Windows machine thereafter. The second laptop also worked, and I was able to ping
the Windows machine, but this was no longer the case after a restart. It starts working if I do a sudo systemctl restart winbind
, but I'd like to avoid having to do this every time I boot up the machine.
The error I get is the typical:
ping: windowspc: Name or service not known
I also found some advice elsewhere on this site suggesting to put the wins
entry immediately after files
, but (a) that did not solve the problem, and (b) the first laptop can see the Windows machine just fine with the old configuration.
Having done the exact same procedure on both laptops with the same OS, I'm really not sure what's the problem here. I'm not sure where to look, so can anyone point me in the right direction please?
Well, I can confirm, after hours of testing. ;-) The very first thing to check is whether you have installed the full samba server variant.
Most Linux Distros includes just the minimal samba client build. (Not to be confused with the smbclient debug tool.) The samba client variant lacks (among other things) the nmbd daemon
nmbd.service
:nmbd is a server that understands and can reply to NetBIOS over IP name service requests, like those produced by SMB/CIFS clients such as Windows 95/98/ME, Windows NT, Windows 2000, Windows XP and LanManager clients. It also participates in the browsing protocols which make up the Windows "Network Neighborhood" view. (Source: https://www.samba.org/samba/docs/current/man-html/nmbd.8.html)
So the stripped-down samba client builds only offers a basic functionality. It is sufficient to access SMB shares. Regarding the pinging of Windows / NetBIOS hostnames the full samba server variant is absolutely necessary!
It took my quite some time until I realize that important difference. ;-) Alternatively, if you have just a small home network it may be enough to edit the host file and add the needed computer host names manually
sudo nano /etc/hosts
.Assuming that your windbind service is enabled (which is required to automatically start on boot) on the second laptop (verify with
systemctl list-unit-files --state=enabled
), I would start with the logs for the winbind service, viajournalctl -u service-name.service
(append -b for current boot only)to look for errors that may indicate why the service isn't starting properly. If there wasn't anything useful there, I'd next check the windbind logs (on my 18.04 installation, they're present in the
/var/log/samba
folder).Perhaps the service is starting out of order or some such, and isn't able to access the required resources for properly starting winbind. The logs coupled with viewing the service file via
systemctl cat winbind
to check if perhaps there are issues with a prerequisite process (i.e.,After=network.target nmbd.service
will allow you to specify services/targets that should be reached prior to launch) should provide the information required to root out why the service isn't starting on boot.