problems with default libreelec samba config

  • For some time now I knew that there was something wrong with LibreELEC (and OpenELEC) samba, but only now I decided to look at it in detail and try to find the real reason...


    The issue is that if we just connect a LibreELEC device (with default config) on a LAN with Windows machines (in my case W7 and XP pc's) as soon as the LibreELEC device is elected the smb master browser (and this is easy after short time, with the current samba config on it...) then problems start, Windows machines can no longer browse Workgroup and properly see other smb devices/pc's on the LAN.


    (though note that some may be cached for some time on "Network" folder on W7 at least... and it may seem tricky... but 'net view' shows them with no cache apparently, then easy to test)


    Example, you can see LibreELEC is master browser and 'net view' can't show devices list:


    I used to just edit OE samba config and set 'local master = no' to prevent it becoming local master (and I could find a few other posts on OE forum about doing same), thus avoiding the problem, however now that I did a clean LibreELEC install I decided to do further research and some tests about this... and... I'm very confident that the reason for this is that stock LibreELEC samba config defines 'smb ports = 445' instead of the samba default 'smb ports = 445 139'... i.e. disabling port 139 means no NetBIOS is available (force using Direct-hosted smb only), however then it just doesn't work as NetBIOS browser service and thus it cannot be the master browser or it breaks browsing Workgroup devices on the whole LAN.


    My suggestion to fix the problem (and yes, I did fully test it before posting this) is either replace 'smb ports = 445' to 'smb ports = 445 139' (or just omit that 'smb ports' line completely, as this is the samba default anyway...) OR if you really want to keep NetBIOS disabled for some reason (I don't see what one honestly, as both are supposed to be always available and devices should auto-negociate and use Direct-hosted vs NetBIOS automatically) then just set 'local master = no' to prevent LibreELEC device to participate on elections for master browser.

    Edited once, last by nars ().

  • You can put your own config file in /storage/.config/samba.conf to test your theory. It will override the default /etc/samba/smb.conf.


  • You can put your own config file in /storage/.config/samba.conf to test your theory. It will override the default /etc/samba/smb.conf.


    Yes, I know that and I did surely test it before posting my fix suggestion With NetBIOS (139) port enabled it works perfect as master browser, all pc's are able to get Workgroup devices list with no problems at all.


    My suggestion is just for developers to fix it as default as I guess it causes trouble to a lot more users.

    Edited once, last by nars ().

  • Yes, I know that and I did surely test it before posting my fix suggestion With NetBIOS (139) port enabled it works perfect as master browser, all pc's are able to get Workgroup devices list with no problems at all.


    My suggestion is just for developers to fix it as default as I guess it causes trouble to a lot more users.


    I'd second that (fix the default config). I'm also seeing erratic bahavior with OS X El Capitan connecting to my recently installed LibreELEC box (never had any troubles with OpenELEC).

  • hm, strange. maybe it was because I was fiddling around with several LibreELEC installations running on different machines/platforms.
    I will keep an eye on this...

  • escalade : sorry if I didn't made myself clear, English is not my native language, I did tried to explain the issue in detail, but maybe it got too long and not fully clear I did just edit my 1st post to make it clear that I did test it.


    mikeboss : Yes, I can also confirm that OE 6 / LE 7 uses same exact samba config, I did compare it myself before. The random problems that you get may be related to the issue I report on the 1st post... it may work ok when LE device is not yet elected the master browser, but after you turn off other PC's, etc... (it all depends on the other smb devices on your LAN) then LE will eventually become master browser... then the problems will start. Anyway you may test to create /storage/.config/samba.conf (just copy the sample file there) and change (or comment with starting #) the 'smb ports' line.

    Edited once, last by nars ().

  • Imagine my surprise; I searched for something related to Linux and immediately found a simple answer!


    I changed that line in samba.conf. I still can't see libreelec from Windows 10. Do I have to reboot all of my machines now?


    libreelec still shows as : MS_BROWSE_<01> GROUP Registered

  • If you see that line for 'nbtstat -a LibreELEC' then LibreELEC is acting as smb master browser on your LAN. I'm not sure what change of the ones I described you made:
    - if you enabled port 445 and 139 to allow it to work properly as master browser, then it's normal it sill shows like that...
    - if you disabled 'local master' to just prevent LibreELEC to become master browser then something is not OK for sure.
    In either case note that you must restart LibreELEC after changing samba config... and if you still have problems then yes you may try to restart other PC's, as I remember that on W7 (at least) sometimes after problems with weird configs then devices will not show anymore on the 'Network' folder until restart... thought they would show on 'net view' if I remember correctly.

    Edited once, last by nars ().

  • I changed only the ports line, rebooted.


    It worked! I am amazed that a linux related question can be answered so easily.


  • I am amazed that a linux related question can be answered so easily.


    I cannot count the number of times I have seen Microsoft give wrong information or tell someone there is no solution to your problem, the registry is probably corrupted, just reinstall Windows. Never had to do that with Linux or BSD. The range of hardware support may not be quite as broad on Linux, but Windows is a fragile house of cards which breaks easily and often, takes much more effort to fix or troubleshoot, and is infinitely less secure. Like the old saying goes, those who dont understand Unix are doomed to reinvent it, badly.

  • Thank you for the information! Yes, I agree that this does need to be changed in the default config for LibreElec (if it has not been changed already).
    There is another aspect that needs to be changed and that is when there are 2+ LibreElec (raspberry pi builds) on the network a conflict develops over the master browser and ultimately one is not able to browse SAMBA shares.
    By making one the master and the other not with adding port 139, this resolves these issues.


    I used the information on this page as well as from here. (excerpt listed listed below)

  • From my tests (and I do also have 3 RPi's) if I just add port 139 on all of them then I can't experience any kind of problems anymore... only one system will "randomly" win election for master browser (it depends on 'os level' value and uptime) but no issues at all... no conflicts... independently of what one gets master browser it will always work fine... that's why I suggested it to be default.


    If you "force" one of them to be master browser by increasing 'os level' then you may not need to fix config (i.e. add port 139) on any other system(s), as you will know these others will never win the election... and then the problem will not show up (until the day you disconnect the one you set to be always the master browser). Anyway also this sort of config always needs to be applied manually, as it is different on each system... then despite a valid solution no way it can be made the default...


    I did never needed to add wins for name resolution to work... maybe adding it makes it work even without netbios port 139 available? (just a guess, I didn't test that). Anyway again not a solution for default config, requires manual config.


  • Thank you for the information! Yes, I agree that this does need to be changed in the default config for LibreElec (if it has not been changed already).
    There is another aspect that needs to be changed and that is when there are 2+ LibreElec (raspberry pi builds) on the network a conflict develops over the master browser and ultimately one is not able to browse SAMBA shares.
    By making one the master and the other not with adding port 139, this resolves these issues.


    I used the information on this page as well as from here. (excerpt listed listed below)


    I also had to do this in order to see my Windows network.

    Edited once, last by shedrock ().

  • I cannot count the number of times I have seen Microsoft give wrong information or tell someone there is no solution to your problem, the registry is probably corrupted, just reinstall Windows. Never had to do that with Linux or BSD. The range of hardware support may not be quite as broad on Linux, but Windows is a fragile house of cards which breaks easily and often, takes much more effort to fix or troubleshoot, and is infinitely less secure. Like the old saying goes, those who dont understand Unix are doomed to reinvent it, badly.


    What I meant was that the very first result too my search phrase gave me the exact concise answer. Normally there are so many right answers to Linux problems that I can't figure out what to do, or there is no answer. Just take a look at the unanswered questions on any Linux board. Just about every Linux "expert" thinks that the answers are too obvious to discuss.


    I have been trying to understand how to use Linux/Unix/OS9 (Level1/Level2) since 1980. I don't have the time to become an expert, and GoOgle is way to noisy to get a straight answer.


    I just never imagined that a fix to a Linux system could be as easy as adding 3 digits to an unprotected easy to find file.


    Has anyone figured out why the smb config file was changed from default in the first place? It's a pretty odd little thing to change and that breaks access to an entire file system. Also odd that nobody admits that samba is a part of a system, just because "Linux snobs" don't think anybody would ever interface with a "lowly" Windows computer.

  • The issue with Windows browsing (aside from it being designed by morons) is that there is not ONE configuration that works. This is due to different versions of SMB protocol and other OS-unique variations that have evolved in the 20-years since Windows '95. So the only consistent thing you'll find when you look in forums is one group of users (with a certain era of OS) arguing that their defaults are the enlightened best approach, while another group (with another era of OS) argue for a different set. The current configuration in LE is not the best configuration (as that doesn't exist) but more of a "least worst" arrangement that results in fewer support posts. You are encouraged to figure out what works best for your scenario with a custom samba.conf.

    Edited once, last by chewitt ().

  • Actually the default samba configuration in LE is broken, as pointed out in this thread. While true that the SMB protocol have changed and introduced new issues at times, the Samba development team have always been quick to fix them. Samba is capable of quite amazing things, I used to maintain a Samba 2.x server which handled cross subnet browsing (using WINS) across three offices with mixed Linux/Windows/Mac clients. This was almost 15 years ago and much have improved since. The default values are good, and should not be changed unless for a purpose.


    I don't use Samba much myself these days and only from Linux/Mac, but I'll create a PR to fix the issue in this thread.


    EDIT: samba: fix browsing and clean up smb.conf by escalade · Pull Request #849 · LibreELEC/LibreELEC.tv · GitHub

    Edited once, last by escalade ().