Koozali.org: home of the SME Server

Legacy Forums => Experienced User Forum => Topic started by: Richard Emory on November 13, 2001, 02:12:42 PM

Title: Samba Hack
Post by: Richard Emory on November 13, 2001, 02:12:42 PM
I've had to set a cron at 4:03am "/etc/rc.e/init.d/smb restart" to get samba to re-take control of the domain/workgroup.  But I'de rather not if someone has the answer.

Why is it loosing it at 4:02am but everything is OK if samba is restarted on its own? Also, friday it won back control at 10:30am but kicked all the users off the network. Then friday night (sat morning) at 4:02am dumped everything. I set os level to 165 Sunday to try to help things out to no avail.

If Samba will stay stable one way or the other it would be OK. Samba listed master browser as UNKNOWN for a week and everything was OK. Then it won master browser and screwed everything up. But once everyone re-logged on they could work with the new settings.

BTW there was a NT server in control when E-Smith was first put on the network. It has been off during all of this. I did not promote the E-Smith, I simply turned off the NT Server box.

The client machines are NT4(sp6)ws, 98, 95 and me.
E-Smith 4.1.2
Samba 2.2.2


I get this every night:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[2001/11/12 04:02:01, 0] nmbd/nmbd.c:sig_hup(92)
Got SIGHUP dumping debug info.
[2001/11/12 04:02:01, 0] nmbd/nmbd_workgroupdb.c:dump_workgroups(292)
dump_workgroups()
dump workgroup on subnet 192.168.0.20: netmask= 255.255.255.0:
CADD2(1) current master browser = LSERV
LSERV 400c9b0b (March Networks SME Server)
SERVER7 40011203 ()
SERVER10 40011203 ()
SERVER17 40011203 ()
SERVER2 40011203 ()
SERVER1 40011203 ()
SERVER14 40011203 ()
SERVER8 40412203 ()
SERVER15 40412003 ()
[2001/11/12 04:02:01, 0] nmbd/nmbd_workgroupdb.c:dump_workgroups(292)
dump_workgroups()
dump workgroup on subnet UNICAST_SUBNET: netmask= 192.168.0.20:
CADD2(1) current master browser = UNKNOWN
LSERV 40099b0b (March Networks SME Server)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

I type in this:
smbclient -U% -L localhost
I get

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
added interface ip=127.0.0.1 bcast=127.255.255.255 nmask=255.0.0.0
added interface ip=192.168.0.20 bcast=192.168.0.255 nmask=255.255.255.0
Domain=[CADD2] OS=[Unix] Server=[Samba 2.2.2]

Sharename Type Comment
--------- ---- -------
print$ Disk
Primary Disk Primary site
engfiles Disk Engineers Files
u-acad Disk U-drive
adminfiles Disk Administration Files
webcal Disk Web Calendar
dwg Disk Drawing Drive
arch Disk Architectural Drawings
IPC$ IPC IPC Service (March Networks SME Server)
ADMIN$ Disk IPC Service (March Networks SME Server)
oce9300 Printer Oce 9300

Server Comment
--------- -------
LSERV March Networks SME Server
SERVER1
SERVER10
SERVER14
SERVER15
SERVER17
SERVER2
SERVER7
SERVER8

Workgroup Master
--------- -------
CADD2 LSERV
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

I type in this:
grep -s -e 'os level' /etc/smb.conf

I get
# os level = 33
os level = 165
I set this to this high number to assure me that this will work
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I type in this:
/etc/rc.d/init.d/smb restart

I get this on the command prompt
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Shutting down SMB services: [ OK ]
Shutting down NMB services: [ OK ]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

And I get this in /var/log/samba/log.nmbd

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[2001/11/12 05:52:45, 0] nmbd/nmbd.c:sig_term(65)
Got SIGTERM: going down...
[2001/11/12 05:52:45, 0] nmbd/asyncdns.c:start_async_dns(150)
started asyncdns process 22906
[2001/11/12 05:52:45, 0] nmbd/nmbd_logonnames.c:add_logon_names(158)
add_domain_logon_names:
Attempting to become logon server for workgroup CADD2 on subnet 192.168.0.20
[2001/11/12 05:52:45, 0] nmbd/nmbd_logonnames.c:add_logon_names(158)
add_domain_logon_names:
Attempting to become logon server for workgroup CADD2 on subnet UNICAST_SUBNET
[2001/11/12 05:52:45, 0] nmbd/nmbd_become_dmb.c:become_domain_master_browser_wins(341)
become_domain_master_browser_wins:
Attempting to become domain master browser on workgroup CADD2, subnet UNICAST_SUBNET.
[2001/11/12 05:52:45, 0] nmbd/nmbd_become_dmb.c:become_domain_master_browser_wins(354)
become_domain_master_browser_wins: querying WINS server at IP 192.168.0.20 for domain master browser name CADD2<1b> on workgroup CADD2
[2001/11/12 05:52:45, 0] nmbd/nmbd_logonnames.c:become_logon_server_success(116)
become_logon_server_success: Samba is now a logon server for workgroup CADD2 on subnet UNICAST_SUBNET
[2001/11/12 05:52:45, 0] nmbd/nmbd_become_dmb.c:become_domain_master_stage2(117)
*****

Samba server LSERV is now a domain master browser for workgroup CADD2 on subnet UNICAST_SUBNET

*****
[2001/11/12 05:52:45, 0] nmbd/nmbd_become_dmb.c:become_domain_master_browser_bcast(293)
become_domain_master_browser_bcast:
Attempting to become domain master browser on workgroup CADD2 on subnet 192.168.0.20
[2001/11/12 05:52:45, 0] nmbd/nmbd_become_dmb.c:become_domain_master_browser_bcast(306)
become_domain_master_browser_bcast: querying subnet 192.168.0.20 for domain master browser on workgroup CADD2
[2001/11/12 05:52:49, 0] nmbd/nmbd_logonnames.c:become_logon_server_success(116)
become_logon_server_success: Samba is now a logon server for workgroup CADD2 on subnet 192.168.0.20
[2001/11/12 05:52:53, 0] nmbd/nmbd_become_dmb.c:become_domain_master_stage2(117)
*****

Samba server LSERV is now a domain master browser for workgroup CADD2 on subnet 192.168.0.20

*****
[2001/11/12 05:53:08, 0] nmbd/nmbd_become_lmb.c:become_local_master_stage2(405)
*****

Samba name server LSERV is now a local master browser for workgroup CADD2 on subnet 192.168.0.20

*****
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.

Why is it loosing it at 4:02 but everything is OK if samba is restarted on its own?
Title: Re: Samba Hack
Post by: Greg Zartman on November 13, 2001, 07:38:20 PM
Richard,

I just browsed my nmbd logs and look what I found:

  Got SIGHUP dumping debug info.
[2001/11/11 04:02:02, 0] nmbd/nmbd_workgroupdb.c:dump_workgroups(292)
  dump_workgroups()
   dump workgroup on subnet     192.168.0.1: netmask=  255.255.255.0:
        LEIINC.COM(1) current master browser = SERVER
                SERVER 400c9b0b (Mitel Networks SME Server)
                BACKBONE 40011203 ()
                RECEPTION 40011003 ()
                ATHLON1 40011003 ()
                GREG 40011203 (Windows 2000 Workstation)
                MIKE 40011003 ()
                DALLAS 40011203 ()
[2001/11/11 04:02:02, 0] nmbd/nmbd_workgroupdb.c:dump_workgroups(292)
  dump_workgroups()
   dump workgroup on subnet  UNICAST_SUBNET: netmask=    192.168.0.1:
        LEIINC.COM(1) current master browser = UNKNOWN
                SERVER 40099b0b (Mitel Networks SME Server)

I get a simular log enry at 4:02 as well.  I have no idea what's up here, but I've yet to have any problems with my network.  I'll look into this a little further and report if I find anything.

Regards,

Greg
Title: Re: Samba Hack
Post by: Greg Zartman on November 13, 2001, 08:59:13 PM
OK, I think I found out what's going on.  When e-smith resets the various server logs once a week, it sends a SIGHUP signal to all major processes so that the log files can be cleaned out without losing any log entries.

When nmbd gets a SIGNHUP it:  "dumps out its namelists into the file namelist.debug in the /usr/local/samba/var/locks directory (or the var/locks directory configured under wherever Samba was configured to install itself). This will also cause nmbd to dump out its server database in the log.nmb file."

I think this is a normal process.  I've yet to have any problem with Samba and I've been running on Redhat type Linux flavors for over a year now.

Regards,

Greg Zartman
Title: Re: Samba Hack
Post by: Richard Emory on November 13, 2001, 11:57:18 PM
GregZ thank you for putting the effort on this problem.  

But, like I had posted in my first post of this problem here:

http://forums.contribs.org/index.php?topic=11915.msg44789#msg44789

I have also had my home server working for months without being master browser and everything was fine.  Also the office E-Smith lost being the Master Browser for a week and everything was OK.  The problem is when Samba either looses or wins an election in the middle of a working day with files open, all the users are instantly locked out of the open files.  Hence, no save.  Lost work and data.  All I want is Samba to always win or loose the election for Master Browser in a stable fashion.  So my users have a stable network platform to work from.  If someone knows how to hack the script which dumps the the namelist at 4:02am so I can get it to also reload Samba, I would be very greatful.  Better yet would be a hack on the script to get the dump the namelist without ever loosing control.

BTW I also set os level = 0 and Samba won the election on a restart. Why?
Title: Re: Samba Hack
Post by: Greg Zartman on November 14, 2001, 01:17:15 AM
There's something else going on in your situation.  "Hacking" a script has nothing to do with the reason that Samba is dumping the machine names.  The nmbd daemon is going exactly what it supposted to do when sent a SIGHUP signal.  This signal is being send by the logrotate process that is run by CRON on a weekly basis.  Look at the /etc/logrotate.d/samba file.  You'll see the code that is being send to both the smbd and nmbd deamons.  

You can reproduce the log entries that you send earlier by inputing the following in a terminal session:   /usr/bin/killall -HUP nmbd

As for samba being a stable network platform, I think that it has a track record of being just that.  As I understand it, about 30% of networked windows clients connect to a Samba server.  If this was a problem with Samba, then more than one person would be complaining about problems with network browsing.  Your problem is almost certainly a configuation and/or install problem.

If Samba lost an election with the OS level set to 0 then you definately have a setup/configuration problem.  When you installed Samba did you create symbolic links, for the various files that samba needs, from the default install directory to /etc?  If it were me, I'd go right back to square one and walk through the Samba howto step by step.

Greg
Title: Re: Samba Hack
Post by: Richard Emory on November 14, 2001, 04:54:14 AM
Thanks again Greg for helping.  

Can you point me to where I can dechiper the line
/bin/kill -HUP cat /var/lock/samba/*.pid 2> /dev/null 2> /dev/null || true
and how I would add in
"/etc/rc.d/initd/smb restart"

Samba itself IS stable.  What the problem is the changing from Master Browser to non-Master Browser.  I want Samba to remain or re-aquire Master Browser status during the logrotate process.

Your comments have me a little confused.

First, I installed (and re-installed) from rpms.  From:
http://myEZserver.com/downloads/mitel/dmc-mitel-samba-2.2.2.tar.gz

I got:
dmc-mitel-samba-2.2.2-0.noarch.rpm
samba-2.2.2-1es.i386.rpm
samba-client-2.2.2-1es.i386.rpm
samba-common-2.2.2-1es.i386.rpm

All installed : rpm -Uhv

Second, from:>>>>>>>>>>>>>>>>>>>>>>>>>
http://www.linuxgazette.com/issue50/misc/pollman/samba.html
I read this to mean that the HIGHER the OS level the better the chances of winning elections.

and from:>>>>>>>>>>>>>>>>>>>>>>>>>>>>
http://email.riverdale.k12.or.us/mailarchives/k12linux/352.html

An os level of 0 causes Samba to lose all elections, even if the
only other machines around are Win 3.1/Win9x computers, and those
operating systems are too braindead to properly carry out the duties of a
LMB.  According to samba docs/textdocs/BROWSING.txt, Win9x uses an OS level of 1, and NT uses an OS level of 32.  Currently, I think NT uses a wider
range of OS levels, depending on the flavor (server, workstation, etc),
but I think so far they're all in the range of 31-64.  So setting up your
smb.conf with...

and from:>>>>>>>>>>>>>>>>>>>>>>>>
http://ps-ax.com/samba-fq.html
I found that the HIGHER the better up to 255

When I type in: grep -s -e 'os level' /etc/smb.conf
#   os level = 33
    os level = 165

My current os level is 165.
But why did it win elections with it set to 0 when it should have lost?

BTW have you tried to restart Samba with a file open?  What were your results?

When I type in "/usr/bin/killall -HUP nmbd" I get:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[2001/11/13 20:37:33, 0] nmbd/nmbd.c:sig_hup(92)
  Got SIGHUP dumping debug info.
[2001/11/13 20:37:33, 0] nmbd/nmbd_workgroupdb.c:dump_workgroups(292)
  dump_workgroups()
   dump workgroup on subnet     192.168.1.2: netmask=  255.255.255.0:
        CADD2(1) current master browser = LIMELIGHT
                LIMELIGHT 400c9b0b (e-smith samba server)
[2001/11/13 20:37:33, 0] nmbd/nmbd_workgroupdb.c:dump_workgroups(292)
  dump_workgroups()
   dump workgroup on subnet  UNICAST_SUBNET: netmask=    192.168.1.2:
        CADD2(1) current master browser = UNKNOWN
                LIMELIGHT 40099b0b (e-smith samba server)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Now I don't know if I am better off or not.
Title: Re: Samba Hack
Post by: Greg Zartman on November 14, 2001, 10:16:15 PM
>Can you point me to where I can dechiper the line
The logrotate script for samba is in /etc/logrotate.d/

I wouldn't add a samba restart here as the SIGHUP used by the log rotate is essentially doing that for you.


>I want Samba to remain or re-aquire Master Browser status during the logrotate >process.
>Your comments have me a little confused.
Samba shouldn't win and lose browser elections randomly.  I'm wondering if you Samba isn't looking at the default smb.conf location.  Set you OS level to 0, as you mentioned before, then input the command:

testparm | grep 'os level'

You'll need to hit return after inputting this command to get testparm to dump current parameters to the grep command.  Testparm will tell you what OS level Samba is currently using.  If you have everything setup right and have input 0 for the os level parameter, then testparm should report a 0.

>My current os level is 165.
>But why did it win elections with it set to 0 when it should have lost?
I'm not sure what's going on here.  There are other parameters that set samba up as the master browser (e.g. preferred master).  I can't say as I've ever setup a Samba PDC and then tried to force it not be the master browser.  I guess you'd have to disable all of those parameters that tell Samba to act as a WINS server.

>BTW have you tried to restart Samba with a file open? What were your results?
All network connections are lost, certain apps report errors to the users (especially if you are working in a database program), the network neighborhood goes blank for about 3-5 minutes, and all mapped drive icons show a big red X in them.

>When I type in "/usr/bin/killall -HUP nmbd" I get:
>[2001/11/13 20:37:33, 0] nmbd/nmbd.c:sig_hup(92)
>Got SIGHUP dumping debug info.
>[2001/11/13 20:37:33, 0] nmbd/nmbd_workgroupdb.c:dump_workgroups(292)
>dump_workgroups()
>dump workgroup on subnet 192.168.1.2: netmask= 255.255.255.0:
>CADD2(1) current master browser = LIMELIGHT
>LIMELIGHT 400c9b0b (e-smith samba server)
[>2001/11/13 20:37:33, 0] nmbd/nmbd_workgroupdb.c:dump_workgroups(292)
>dump_workgroups()
>dump workgroup on subnet UNICAST_SUBNET: netmask= 192.168.1.2:
>CADD2(1) current master browser = UNKNOWN
>LIMELIGHT 40099b0b (e-smith samba server)
As you should.  This is EXACTLY what nmbd is supposed to do when send it a SIGHUP signal.  This is what the logrotate process is doing at 4:02 am on our SME machines.

>Now I don't know if I am better off or not.
Well, now you know that this is normal behavor for Samba and not a bug or something.  :o)

As a said previosly, I think you have a configuration error.  Play around with the testparm samba function to make sure Samba is looking at the smb.conf file that you think it's looking at.

Regards,

Greg Zartman
Title: Re: Samba Hack
Post by: Tarl Carpenter on November 15, 2001, 09:48:43 AM
Hum If I remember right and anyone who wants can correct me the max that Microsoft sees os level is 65.

Next you can force the NT Server to not cause an election at all.
http://support.microsoft.com/support/kb/articles/Q136/7/12.asp
will tell you bit about how it all works.

As Always make backups before you edit the registry!!!
Good Luck.