1

In the past, I was able to get Windows host names on the LAN resolving from inside Ubuntu by doing sudo apt-get install winbind and then editing /etc/nsswitch.conf (adding wins to the end of the hosts: line). It appears in Ubuntu 16.04 (actually using Xubuntu 16.04), this is no longer sufficient.

Example output:

me@myubuntumachine:~$ ping mywindowsmachine
ping: unknown host mywindowsmachine

(tags: NetBIOS WINS)

1

I looked into this myself and the problem seems to be a missing libnss_wins.so library, and I checked into how to ensure this exists on my machine and I found sudo apt-get install libnss-winbind and doing that fixed the problem immediately.

More info: I checked into what was going on by capturing output from strace ping mywindowsmachine and the problem was easy to spot as the program was trying to find a file that just wasn't there, libnss_wins.so.2. This showed a potential solution of simply ensuring that file is present. Below is the strace output truncated to show only lines concerning a search for this libnss_wins.so.2 file, and the important thing here is that every single attempt to find the file fails, right up to the last. On my other Ubuntu machine, I compared the same strace output, and there it succeeded on maybe the fourth or fifth try:

open("/lib/x86_64-linux-gnu/tls/x86_64/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64-linux-gnu/tls/x86_64", 0x7ffd56786e80) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/tls/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64-linux-gnu/tls", 0x7ffd56786e80) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/x86_64/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64-linux-gnu/x86_64", 0x7ffd56786e80) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64-linux-gnu", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
open("/usr/lib/x86_64-linux-gnu/tls/x86_64/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64-linux-gnu/tls/x86_64", 0x7ffd56786e80) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/tls/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64-linux-gnu/tls", 0x7ffd56786e80) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/x86_64/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64-linux-gnu/x86_64", 0x7ffd56786e80) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64-linux-gnu", {st_mode=S_IFDIR|0755, st_size=69632, ...}) = 0
open("/lib/tls/x86_64/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/tls/x86_64", 0x7ffd56786e80) = -1 ENOENT (No such file or directory)
open("/lib/tls/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/tls", 0x7ffd56786e80)        = -1 ENOENT (No such file or directory)
open("/lib/x86_64/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64", 0x7ffd56786e80)     = -1 ENOENT (No such file or directory)
open("/lib/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib/tls/x86_64/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/tls/x86_64", 0x7ffd56786e80) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/tls", 0x7ffd56786e80)    = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64", 0x7ffd56786e80) = -1 ENOENT (No such file or directory)
open("/usr/lib/libnss_wins.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

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.