# Wins Problem [solved]

## Kaste

hello fine folks

I have two servers in our network, both hanging on the same router/switch. One of them is supposed to act as a WINS server for the network. The problem is it doesn't. I get no logs anymore either. The last modification time for /var/log/samba/log.nmbd is ten days ago, nothing in daemon.log, kern.log or any other log 

Now what i get is the message on the other serrver that wins is rejecting it and this if i do a lookup on the server itself (nmblookup on the other one yields the same results minus that tcb stuff): 

```
nmblookup -v "*"

interpret_interface: Adding interface 127.0.0.1/8

added interface 127.0.0.1/8 ip=127.0.0.1 bcast=127.255.255.255 netmask=255.0.0.0

added interface eth0 ip=10.149.16.34 bcast=10.149.16.63 netmask=255.255.255.224

Socket opened.

querying * on 127.255.255.255

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

querying * on 10.149.16.63

Got a positive name query response from 10.149.16.35 ( 10.149.16.35 )

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

10.149.16.35 *<00>
```

Hereby 10.149.16.35 is the other server. 

```
nmblookup -U 10.149.16.34 "*"

interpret_interface: Adding interface 127.0.0.1/8

added interface 127.0.0.1/8 ip=127.0.0.1 bcast=127.255.255.255 netmask=255.0.0.0

interpret_interface: using netmask value 255.255.255.224 from config file on interface eth0

added interface eth0 ip=10.149.16.34 bcast=10.149.16.63 netmask=255.255.255.224

Socket opened.

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

tdb(unnamed): tdb_open_ex: could not open file /var/run/samba/unexpected.tdb: No such file or directory

querying * on 10.149.16.34

name_query failed to find name *

```

```
[global]

    announce as = NT

    # we're newer than any windows necessary to win the election for the pdc and lmb

    announce version = 9.9

    # cross subnet listing

    enhanced browsing = yes

    #let anyone see your share list - does that really make sense?

    browse list = yes

    # I'm a timeserver

    time server = yes

    #domain logons = yes

    #Specifies which ports the server should listen on for SMB traffic

    smb ports = 445 139 138 137

    log level = 3

#Bind to the internal adress so the packets don't leave the local net. 

    interfaces = 127.0.0.1/8 10.149.16.32/255.255.255.224

    bind interfaces only = yes

   netbios name = white

   workgroup = AREAL

# Windows Internet Name Serving Support Section:

    wins support = yes

    os level = 65

    name resolve order = wins lmhosts host dns bcast

    dns proxy = yes

    # most of this i got from http://www.uni-duisburg.de/FB7/netzwerk/Fragen/samba/Schnupper/Daten/25741-24.htm

    # we want to control all the browse lists in the domain in order to get coherency across subnets

    domain master = yes

    # makes samba participate in elections for lmb

    local master = yes

    # makes samba force a vote for lmb on startup - this leads to election wars if someone else also has this set!

    preferred master = yes

    # remotely announce this server in the browse lists of all these subnets. maybe this helps

    # max: no it doesn't because the routers block braodcast traffic! all bull

#        remote announce = 10.149.16.63/AREAL 10.149.16.255/AREAL 10.149.17.255/AREAL 10.149.18.255/AREAL 10.149.19.255/AREAL 10.149.20.255/AREAL 10.149.21.255/AREAL 10.149.22.255/AREAL 10.149.23.255/AREAL 10.149.24.255/AREAL 10.149.25.255/AREAL 10.149.26.255/AREAL 10.149.27.255/AREAL 10.149.28.255/AREAL 10.149.29.255/AREAL 10.149.30.255/AREAL 10.149.31.255/AREAL

        # This makes nmbd sync its browse list with the lmb in the distant subnets. works only if the distant lmb is a samba server

    #remote browse sync = 10.149.16.63/AREAL 10.149.16.255/AREAL 10.149.17.255/AREAL 10.149.18.255/AREAL 10.149.19.255/AREAL 10.149.20.255/AREAL 10.149.21.255/AREAL 10.149.22.255/AREAL 10.149.23.255/AREAL 10.149.24.255/AREAL 10.149.25.255/AREAL 10.149.26.255/AREAL 10.149.27.255/AREAL 10.149.28.255/AREAL 10.149.29.255/AREAL 10.149.30.255/AREAL 10.149.31.255/AREAL

### Debugging/Accounting ####

  max log size = 1000

  syslog only = no

# Do something sensible when Samba crashes: mail the admin a backtrace

   panic action = /usr/share/samba/panic-action %d

####### Authentication #######

  security = share

  invalid users = root

# Most people will find that this option gives better performance.

# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/speed.html

# for details

# You may want to add the following on a Linux system:

#         SO_RCVBUF=8192 SO_SNDBUF=8192

   socket options = TCP_NODELAY

```

Someone please give me a hint why wins isn't working

----------

## gerdesj

It looks as though the WINS database has been corrupted although I'd like to get to the bottom of where unexpected is coming from.  Frankly although it is possible, I have never lost one to corruption in 10 years (one of my systems is WINS for 4000 PCs).   

Samba stores things in .tdb files.

On my laptop all the .tdb files are in /var/cache/samba so I don't know why you are getting /var/run/samba/unexpected.tdb in the error. There is also a wins.dat file which is readable.

Could you try deleting /var/cache/samba/wins.<anything> and restarting Samba.  As it is WINS it will rebuild itself as systems reannounce themselves.  This is not a good idea for the other databases!

Cheers

Jon

----------

## Kaste

Thanks for the help

There is nothing starting with wins:

```

/var/cache/samba$ ls

browse.dat  printing

```

I'm thinking about deleting unexpected.tdb. It exists and looks rather binary so I have a hard time telling if anything looks suspicious  :Smile: . I think I`ll try that and if it doesn`t help then I`ll remove anything samba except the smb.conf and remerge it and see what happens.

EDIT: 

I just copied the file from another server and at least the error message has gone away. Hopefully that was the source of it all. I`ll have to wait till all the computers have checked in to see if it now works.

----------

## Kaste

hmm it still doesn`t seem to work. There should have been a lot of computers registered in that wins db by now. 

More ideas?

```
 

user@10.149.16.35:~$ nmblookup "*"

added interface ip=10.149.16.35 bcast=10.149.16.63 nmask=255.255.255.224

querying * on 10.149.16.63

Got a positive name query response from 10.149.16.35 ( 10.149.16.35 )

Got a positive name query response from 10.149.16.34 ( 10.149.16.34 )

10.149.16.35 *<00>

10.149.16.34 *<00>

user@10.149.16.35:~$ nmblookup -U 10.149.16.34 "*"

added interface ip=10.149.16.35 bcast=10.149.16.63 nmask=255.255.255.224

querying * on 10.149.16.34

Got a positive name query response from 10.149.16.34 ( 10.149.16.34 )

10.149.16.34 *<00>

```

And on the other server:

```
 

user@10.149.16.34:~$ nmblookup "*"

interpret_interface: Adding interface 127.0.0.1/8

added interface 127.0.0.1/8 ip=127.0.0.1 bcast=127.255.255.255 netmask=255.0.0.0

interpret_interface: using netmask value 255.255.255.224 from config file on interface eth0

added interface eth0 ip=10.149.16.34 bcast=10.149.16.63 netmask=255.255.255.224

Socket opened.

querying * on 127.255.255.255

Got a positive name query response from 127.0.0.1 ( 10.149.16.34 )

10.149.16.34 *<00>

```

EDIT:

On the other hand it now seems to work somewhat. There are now three computers in the workgroup which is way too few but at least it seems to work somewhat. Still confused though

```

smbclient -L localhost

Enter phoenix's password:

Domain=[AREAL] OS=[Unix] Server=[Samba 3.2.0]

        Sharename       Type      Comment

        ---------       ----      -------

        sophos          Disk      Virenscanner RemoteUpdater

        IPC$            IPC       IPC Service (WINS Server eintragen: 10.149.16.34)

Domain=[AREAL] OS=[Unix] Server=[Samba 3.2.0]

        Server               Comment

        ---------            -------

        BLACK                WINS Server eintragen: 10.149.16.34

        RED                  RED Now Stable!

        WHITE                WINS Server eintragen: 10.149.16.34

        Workgroup            Master

        ---------            -------

        AREAL                WHITE

```

----------

## gerdesj

See this: http://wiki.samba.org/index.php/Frequently_Asked_Questions

At the top is a list of .tdb files.  Including unexpected - think we'll have to grep the code to find out what that is all about.  perhaps another day if it is working.

On windows: #ipconfig /rr   I think is the refresh my WINS registration records.  On Samba just reload it (I think, possibly just the nmbd)

Cheers

Jon

----------

## Kaste

I'll mark this solved I think. Thank you for your assistance. 

I still don't see any computers registered but this is a different issue. The broken file has obviously hindered the nmbd from functioning. It is now working proberly as a WINS it's just the browsing that isn't working and it`s unrelated to this issue.  This is somewhat satisfactory as that WINS funcionality was needed and I`ll leave it at that. 

From what i gather from the documentation on the web the browsing problem is not fixable in any way open to me since i would need a fixed lmb machine in every subnet (the computers are almost all in different subnets from this server) that syncs with the server and I dread the idea of having something like 15 servers to administer (despite it being totally infeasible because of  lacking hardware).

So all in all Thank you very much.

----------

## gerdesj

 *Kaste wrote:*   

> 
> 
> From what i gather from the documentation on the web the browsing problem is not fixable in any way open to me since i would need a fixed lmb machine in every subnet (the computers are almost all in different subnets from this server) that syncs with the server and I dread the idea of having something like 15 servers to administer (despite it being totally infeasible because of  lacking hardware).
> 
> So all in all Thank you very much.

 

No problem.  I don't quite follow your last comment, if you can make a Samba server appear on  all subnets eg using VLAN tagging (802.1Q), that might help.

I think you are possibly confusing domains and workgroups and WINS.  Workgroups only work like this:  a master browser for each workgroup PER subnet holds the browse list all done by elections.  A Domain MB on the other hand will hold the list for all subnets, it is not constrained by subnet - all its clients register directly by having machine accounts created when they join the domain.  WINS is just a name to address resolution mechanism similar to DNS.

So if it is browse lists that you are after then you can run Samba as a domain controller and it will provide a full browse list for all clients that join it.  Samba 4 when complete will give you an AD as well (gosh!) but you will get NT4 domain functionality from Samba 3, which I think is what you might need.

If you are stuck with a workgroup setup then try 802.1Q or a lot of NICs/routing!

Cheers

Jon

Cheers

Jon

----------

## Kaste

Well I read a lot of the complete reference back then and i think i came to the conclusion that i couldn`t make use of the domain. Thinking about it now though i don`t remember why anymore. 

I have a rather heterogenous environment. We have a dormitory (or rather a few of them) and people move in and out all the time and tend to use any random OS (seriously we got bsds, solaris and rarer stuff here), so the choice was made long before my time that a workgroup holding all the pcs would be the only thing feasible. 

Then unfortunately the network topology changed and the routers don`t let the broadcasts through. As you have explainend nicely (and i tried to argue rather clumsyly)  you need to have a local master browser in each subnet. This is infeasible because I`m not allowed to do that and I wouldn`t be able to put that many NICs in my Pcs anyway. I don`t have access to the router configuration so I can?t use the VLAn approach and can`t change their behaviour in respect to the broadcast problem.  I thought about using remote announce and remote browse sync but that won`t work because i don?t know the ips of the pcs that are elected as lmbs. 

So the only option is probably a domain or living with the current mess. Since you appear to be in the know can you please tell me the possible drawbacks to this approach, or rather tell me if it is possible to join the domain without any intervention of the administrator. Do i need to setup any accounts/passwords for the pcs/users or will it work transparently. I need it to just work without any passwords i.e. share level security but with a central computer that keeps track of all members in the workgroup/domain at that particular moment. 

Thanks so much for the help.

----------

