SAMBA digest 1706

Dan Wilder dan at gasboy.com
Tue Jun 2 22:34:28 GMT 1998


> 
> ------------------------------
> 
> Date: Tue, 02 Jun 1998 17:28:41 +0000
> From: Jeff Wiegley <jeff at la.usweb.com>
> To: samba at samba.anu.edu.au
> Subject: ARGH!! why does my samba server lose domain master elections??
> Message-ID: <35743649.5CF3502F at la.usweb.com>
> 
> Subject pretty much says it all.
> 
> (And *please* don't point me BROWSING.txt since I've been there done
> that and it still doesn't work)

[ ... ]

> 
> Now for my problem:
>   I have a samba machine which has the following WINS settings...
> 
>      domain master = yes
>      local master = yes
>      os level = 255
>      preferred master = yes
>      wins support = yes
> 
>   now, even though I have the os level set to a hideously high setting
>   which should beat everything out there I still keep getting beaten
>   by WinNT machines that are on my net.

Me too.  Samba 1.9.18p7.  It doesn't happen right away, though.  Several
days of running, and nmbd begins losing elections consistently, although
it is still responding.

My workaround is a script that runs once a minute looking to see who is
master.  When it sees the samba server isn't, kills nmbd on the
server then restarts it.  Then all is fine for 5-10 days again.

>   So everynow and then my users come to me and say... "I can't seem to
>   see all the machines I should in the Network Neighborhood; why is that?"

Yup, that's what happened.

>   and of course I send a HUP to nmbd and check the log.nmb file and
>   sure enough some WinNT box came up, forced an election and won.
> 
>   I thought an os level of 255 would beat *everything* out there so
>   why are NT machines still capable of becoming the domain master
>   browser???  The WinNT installations are just simple typical installations.
> 
> Thanks for any help you can offer,
> 
> - Jeff Wiegley

The script I'm running, once a minute from cron, as root:

-------------------------------------------------------------------
#!/bin/sh
#
# If master host loses samba browse master, restart nmbd.
#
TMPFILE=/root/tmp/.grab$$
MASTER=lolead
/usr/bin/smbclient -N -U guest -L ${MASTER} |\
/bin/sed -n '/Workgroup..*Master/,$p' > ${TMPFILE}
b=$(/bin/fgrep ${MASTER} ${TMPFILE})
if [ "$b" ]; then
  if [ -f /root/RESTART_NMBD ]; then
    rm -f /root/RESTART_NMBD
    mail root <<EOF
${MASTER} nmbd regained browse master.
EOF
  fi
elif [ ! -f /root/RESTART_NMBD ]; then
    /bin/touch /root/RESTART_NMBD
    /usr/bin/killall -KILL nmbd
    /usr/sbin/nmbd -D
    echo "${MASTER} nmbd lost browse master:" >${TMPFILE}.1
    cat ${TMPFILE} >> ${TMPFILE}.1
    mail root < ${TMPFILE}.1
fi
rm -f ${TMPFILE} ${TMPFILE}.1

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

Warning: TMPFILE should be located in a directory with write permissions
only to root.  Adjust paths as appropriate.

My guess is there's a static variable in nmbd that gets scribbled on
once in a while.  If somebody can suggest an appropriate debug
level to trap this thing closer to red-handed I'd be happy to
rotate log files frequently and have my little script save the
relevant chunk when it sees a problem.

-- 
Dan Wilder		                <dan at gasboy.com>


More information about the samba mailing list