[Samba] When to restart samba

Andrew Masterson Andrew.Masterson at nuvistaenergy.com
Sat Aug 30 19:33:17 GMT 2008


> On Friday 29 August 2008 16:15:41 you wrote:
> > Thanks for the info - I've gotten conflicting info from SWAT, Webmin
and
> > the man pages, so I thought I would ask.  It appears that there
isn't a
> > hard rule for when to restart vs. wait for autoload so I'll have to
play
> > with it a bit to figure out when and what.
> 
> Instead of null inuendo, please share with us what the conflicting
> information is.

1) _webmin_ gives:

"Click this button to restart the running Samba servers on your system.
This will force the current configuration to be applied. This will also
disconnect any connections to the server, so if you do not want the
current configuration to be applied immediately you should just wait 1
minute until Samba reloads the configuration automatically."

This implies that the configuration is applied automatically after 1
minute - with no disconnects necessary.  Webmin is of questionable
utility, however, given that most smb options are not configurable.

Furthermore, using the "restart" option only restarts smbd.
[root at solar ~]# ps -ae | grep win 
[root at solar ~]# ps -ae | grep mbd
 8530 ?        00:00:00 smbd
 8537 ?        00:00:00 smbd
[root at solar ~]#
And I have to manually restart the nmbd and winbindd daemons

[root at solar ~]# ps -ae | grep mbd
 8530 ?        00:00:00 smbd
 8537 ?        00:00:00 smbd
 8553 ?        00:00:00 nmbd
[root at solar ~]# ps -ae | grep win
 8555 ?        00:00:00 winbindd
 8556 ?        00:00:00 winbindd
[root at solar ~]# service smb stop
Shutting down SMB services:                                [  OK  ]
Shutting down NMB services:                                [  OK  ]
Shutting down Winbind services:                            [  OK  ]
[root at solar ~]# service smb start
Starting NMB services:                                     [  OK  ]
Starting SMB services:                                     [  OK  ]
Starting Winbind services:                                 [  OK  ]
[root at solar ~]# ps -ae | grep win
[root at solar ~]# ps -ae | grep mbd
 8627 ?        00:00:00 smbd
 8633 ?        00:00:00 smbd

So start failed to load all the daemons (even though it claims it did)
and you have to manually restart them.  This is true whether you use
webmin or a command line "service smb stop/restart"

[root at solar ~]# service smb stop
Shutting down SMB services:                                [  OK  ]
Shutting down NMB services:                                [FAILED]
Shutting down Winbind services:                            [FAILED]
[root at solar ~]# nmbd
[root at solar ~]# smbd
[root at solar ~]# winbindd
[root at solar ~]# ps -ae | grep mbd
 8666 ?        00:00:00 nmbd
 8668 ?        00:00:00 smbd
 8670 ?        00:00:00 smbd
[root at solar ~]# ps -ae | grep win
 8672 ?        00:00:00 winbindd
 8673 ?        00:00:00 winbindd

This is probably an init.d/smb issue, but either version of the daemon
initialisation gives the same result.  Stop works, start claims to work
but does not.  This was all out of the box or copied from how-to/by
example.

start() {
        KIND="NMB"
        echo -n $"Starting $KIND services: "
        daemon nmbd -D
#        daemon nmbd $NMBDOPTIONS
        RETVAL=$?
        echo
        KIND="SMB"
        echo -n $"Starting $KIND services: "
        daemon smbd -D
#       daemon smbd $SMBDOPTIONS
        RETVAL2=$?
        echo
        KIND="Winbind"
        echo -n $"Starting $KIND services: "
        daemon winbindd
#        daemon winbindd $WINBINDDOPTIONS
        RETVAL3=$?
        echo
        [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0  ] && \
                 touch /var/lock/subsys/smb || RETVAL=1
        return $RETVAL
}

_man smb.conf_ doesn't have any specific information, that I can find,
about when (or how) to restart samba, or that shares are auto-reloaded,
or that global config changes "generally" require a restart.  Does
restarting cause users to be disconnected?  What if they are in the
middle of using something on a share?  Is there the potential for data
corruption?  I prefer to be safe but I thought I would ask the experts
to find out.

_samba HOW-TO_ 
Is fairly clear that you need nmbd first, then smbd, then winbindd.  It
doesn't, as far as I can find, tell you when you *need* to restart samba
(or even that you ever need to).

Nor does it contain the information that you passed on that shares are
automatically reloaded but not global configs.  I may have missed it,
but I couldn't find any info on when and how in the how-to.  You guys
have done a good job with the HOW-TO, but I needed some supplemental
info.

Sysinfo:
RHEL 5.2.0.4
Webmin 1.370-1
Samba 3.0.31-35

> How "hard" does information need to be to be useful?

I just need to know that if I'm pissing around with the config on one of
the test shares on a production server in the middle of the day that I
don't have to disrupt hundreds of users and risk data corruption to see
if my config is correct or not.  I don't want to have to plan outages of
production shares unless I have to.

So I am asking what I *can* change without having to disrupt everyone.
I'm just a regular schmuck who wants to use Linux/Samba in a
predominantly Windows world.

-=Andrew


> 
> - John T.
> 
> >
> > -=Andrew
> >
> > On Friday 29 August 2008 10:27:10 Andrew Masterson wrote:
> > > > > If I understand correctly, in order to have the smb.conf file
> > >
> > > applied
> > >
> > > > > you need to restart smbd.
> > > > >
> > > > > Is "service smbd reload" sufficient (which does a "killproc
smbd
> > >
> > > -HUP")?
> > >
> > > > > Will this kill any active connections to samba resources
causing
> > >
> > > user
> > >
> > > > > disruption?  Or is this a seamless process that can be carried
out
> > > > > midday?
> > > > >
> > > > > I ask because if I need to kill all user connections to
production
> > > > > shares in order to test different share parameters that
changes my
> > > > > approach.
> > > >
> > > > If you make changes to the [global] stanza in smb.conf you need
to
> > >
> > > restart
> > >
> > > > Samba's smbd and nmbd daemons.
> > >
> > > And winbind as well?  The documentation seems to indicate that
> winbindd
> > > needs to be started after nmbd and smbd - so does it need to be
> > > restarted as well, or will it remain active?  Are there potential
> > > conflicts if winbind isn't shut down before restarting the nmbd
and
> smbd
> > > daemons?
> >
> > Yes, winbindd and smbd should be restarted after changing the global
> stanza
> > of smb.conf.  In reality, this is only necessary when global
parameters
> > have been changed that may impact Samba's behavior.  For example,
> changing
> > the "log level" parameter does not require restarting of any Samba
> daemon.
> > Check the man page for smb.conf to determine if a restart is perhaps
> > necessary.
> >
> > > > Changes to the share stanzas in smb.conf generally do not
require a
> > > > restart of smbd. Smbd monitors the smb.conf file for changes.
> > >
> > > Could you elaborate on "generally" and give me an estimate of how
long
> > > it takes for the changes to be reloaded?
> >
> > That depends on the OS.  On some older systems this can take 20 sec
or
> so,
> > on all modern systems the change is almost immediately effective.
> >
> > - John T.
> >
> > > Thanks a bunch for your answers,
> > > Andrew
> > >
> > > > Existing connections will not see the changes made, so clients
that
> > >
> > > have
> > >
> > > > an
> > > > existing connection should log off and logon again.
> > > >
> > > > - John T.
> >
> > --
> > John H Terpstra
> >
> > "Don't do as I do; Show me better!" - Anonymous.
> > --
> > To unsubscribe from this list go to the following URL and read the
> > instructions:  https://lists.samba.org/mailman/listinfo/samba



More information about the samba mailing list