Sunday, April 14, 2013

Fixing Samba master browser conflicts between multiple OpenElec instances

The default OpenELEC Samba configuration (in the 1.x and 2.x versions I ran) appears to set itself up as the local network "master browser," which is responsible for managing the list of network shares and so on. This makes some sense, since the computer with shared media files is likely to be left on all the time. 

But if you have more than one OpenELEC instance running (or have set up Samba with borrowed settings from the OpenELEC config), it's possible for the wrong computer to become the master browser, and when it's shut down or rebooted all of the network shares suddenly become un-browsable. This was happening when I would temporarily boot one Raspberry Pi to OpenELEC, watch or listen to stuff shared from the "main" HTPC for a few hours, then reboot it back into Raspbian.

To resolve this I changed the Samba configs as below; I believe the wins support settings are needed for name resolution in Network Neighborhood in Windows:

On the primary instance (the one that will always be running):
  - domain master = yes
  - local master = yes
  - preferred master = yes
  - os level = 100
  - wins support = yes
  - name resolve order = lmhosts wins bcast host

On the other instances (the ones not left on all the time):
  - preferred master = no
  - domain master = no
  - local master = no
  - os level = 5
  - wins server = <ip address of the primary instance>
  - name resolve order = lmhosts wins bcast host

Check which computer is currently the master browser:
smbclient -L <ip address>