#4329 Samba Restart fails in 1.660 against LinuxMint 16 / Ubuntu 13.10

1.660
closed-fixed
nobody
None
5
2016-03-27
2013-12-08
fbachofner
No

I installed 1.660 on LinuxMint 16 yesterday. Now, restarting Samba from within Webmin produces the following error:

"Failed to restart Samba servers : /etc/init.d/samba start || (/etc/init.d/nmbd start ; /etc/init.d/smbd start) failed"

In an Ubuntu based distro (LinuxMint 16 is based on Ubuntu 13.10) the Samba services running state should best be managed thusly:

sudo service smbd stop
sudo service smbd start

or
sudo service smbd restart

Previously I had 1.630 (or maybe 1.610 or even 1.590 since I last needed to restart Samba within Webmin) running on LinuxMint 15 and restarting Samba worked fine. This therefore seems to be a regression.

Webmin seems to call "restart.cgi" when clicking the button. Where is this file located? I'd like to try editing it to see whether I can fix the problem in this version.

Thanks!

Discussion

1 2 > >> (Page 1 of 2)
  • Jamie Cameron

    Jamie Cameron - 2013-12-08

    Do the scripts /etc/init.d/smbd and /etc/init.d/nmbd exist on your system?

    The command "service smbd restart" should just call those scripts.

     
    • fbachofner

      fbachofner - 2013-12-08

      Hi Jamie:

      Yes, those scripts do exist. And all of the respective "service smbd ..." calls work for me from the command line.

      Sorry, I didn't realize those calls just invoked those scripts.

      Seems like it might make sense to use the "service smbd ..." calls in Webmin in case Ubuntu decides to rename those scripts and/or change locations in the future . . ?

       
      • fbachofner

        fbachofner - 2013-12-08

        Interesting:

        At the terminal, invoking EITHER
        "/etc/init.d/samba start"

        or "/etc/init.d/samba start || (/etc/init.d/nmbd start ; /etc/init.d/smbd start)" [as in the Webmin Samba config file]

        does not throw an error.

         
  • fbachofner

    fbachofner - 2013-12-08

    at:
    /etc/webmin/samba

    I found a config file with the "offending" command.

    "start_cmd=/etc/init.d/samba start || (/etc/init.d/nmbd start ; /etc/init.d/smbd start)"

    CHANGED TO:
    "start_cmd=service smbd restart"

    Samba restart from Webmin now works! ("sudo" not required, guess Webmin automatically has admin rights)

    Strangely, from the same config file
    "stop_cmd=/etc/init.d/samba stop || (/etc/init.d/nmbd stop ; /etc/init.d/smbd stop)"

    properly stops the service whereas the best practice seems to be:
    "sudo service smbd stop"

    If anyone has an explanation, I would appreciate it.

    I hope Webmin 1.6x can be updated for Ubuntu-based distros so that less skilled persons have Samba restarts work from Webmin "out of the box."

    Thanks!

     
    Last edit: fbachofner 2013-12-08
  • Jamie Cameron

    Jamie Cameron - 2013-12-08

    I re-checked the Webmin code, and it turns out that to restart Samba it actually runs the following commands in sequence :

    /etc/init.d/samba stop || (/etc/init.d/nmbd stop ; /etc/init.d/smbd stop)
    /etc/init.d/samba start || (/etc/init.d/nmbd start ; /etc/init.d/smbd start)

    If you run that from the shell as root, does it report any errors?

     
    • fbachofner

      fbachofner - 2013-12-08

      so:
      1. I opened a "regular" terminal
      2. sudo gnome-terminal (opens a new terminal as root)
      3. /etc/init.d/samba stop || (/etc/init.d/nmbd stop ; /etc/init.d/smbd stop) [no error]
      4. /etc/init.d/samba start || (/etc/init.d/nmbd start ; /etc/init.d/smbd start) [no error]
      Is there anything else you would like me to test?

       
  • fbachofner

    fbachofner - 2013-12-08

    Since there is a Samba restart command, wouldn't it be better to use that?

    Also, (from memory, which may be in error) it seems Webmin used to allow three button options: stop, start and restart

    I can imagine use cases where each of these might be useful independently . . .

     
    Last edit: fbachofner 2013-12-08
  • Jamie Cameron

    Jamie Cameron - 2013-12-09
    • status: open --> closed-fixed
     
  • Jamie Cameron

    Jamie Cameron - 2013-12-09

    Ok, I think I see the issue - if the stop and start commands are run too close together, it can trigger this failure. I will fix this by adding a time delay in the next Webmin release.

     
    • fbachofner

      fbachofner - 2013-12-10

      I will test in the next version and report back.

      Will installing the next version overwrite the changes I made at /etc/webmin/samba or will I need to revert them myself?

      Also, I find it odd that Webmin has this problem as I can call the scripts back to back with basically no delay in the terminal and not get an error. Can you explain your theory or might it be something else?

      Finally, I do hope that you will consider 3 buttons: stop, start and restart, just like the commands offered by the OS. [Leads to less confusion among users when things are consistent.]

      Thanks for all your efforts.

       
    • fbachofner

      fbachofner - 2014-01-25

      Hi Jaime:

      I just set up a new Linux Mint 16 machine, also with Webmin, this time 1.670 (i.e. next version since I started this thread)

      The "restart samba servers" button unfortunately still fails, with the same error message:

      "Failed to restart Samba servers : /etc/init.d/samba start || (/etc/init.d/nmbd start ; /etc/init.d/smbd start) failed"

      Once again, I changed the command being invoked to "start_cmd=service smbd restart" and the restart once again works.

      One concern I have (which I must not have explained clearly before) is that a button labled "restart samba servers" does not actually "restart" the samba daemon -- it stops it and then starts it. I'm not trying to be pedantic . . . semantic correctnes will makes it easier to understand Webmin.

      I still think that a button marked "restart" should invoke the Samba service restart command (even if it is itself calling two scripts, stop ans start). [There is also a samba service start command which would be appropriate to wire to a "start samba servers" button if you wish to have it (as before, though certainly not neccessary).

      It occurs to me that non-Ubuntu based distros may not have the "service smbd restart" command. Is this the reason you do not call it thusly?

      Thanks for your great work on Webmin!

       
  • Jamie Cameron

    Jamie Cameron - 2013-12-10

    You wouldn't see this issue when you run the commands manually, as you likely aren't running them as fast as Webmin does.

    BTW, the reason there is no restart button is that Samba doesn't need to be restarted to apply config changes.

     
  • Jamie Cameron

    Jamie Cameron - 2013-12-10

    You wouldn't see this issue when you run the commands manually, as you likely aren't running them as fast as Webmin does.

    BTW, the reason there is no restart button is that Samba doesn't need to be restarted to apply config changes.

     
  • Jamie Cameron

    Jamie Cameron - 2014-01-26

    You're right - I will have Webmin use the restart script in the next release.

     
    • fbachofner

      fbachofner - 2014-04-21

      On Webmin 1.680 on LinuxMint 16, "restarting" Samba with the Webmin Samba module button still fails (with a default Webmin install).

      As before, I have edited the relevant lines at /etc/webmin/samba/config

      After such edit, it works as expected

      "restart_cmd=service smbd restart"

      also
      "start_cmd=service smbd start"

      although there is no "start" button in the Samba Webmin module . . .

       
  • fbachofner

    fbachofner - 2014-05-29

    I recently upgraded Webmin on a couple LinuxMint 16 machines to version 1.690

    Once again, this has broken Samba restart and stop control within Webmin.

    You are actually a little closer to using Samba's new service commands -- this version uses "service smbd restart" -- UNFORTUNATELY, this is used at the start_cmd line (in /etc/webmin/samba/config) [which does not seem to be invoked by the "restart" button -- at least NOT successfully]

    The correct implementation for all modern Debian distributions should be as follows:

    start_cmd=service smbd start
    stop_cmd=service smbd stop
    restart_cmd=service smbd restart

    This approach works fine in every install I have tried (across various distros to include recent versions of Mint, Ubuntu and Debian) where I have edited the Webmin Samba config file. [ If I do not edit the file, the Webmin restart and stop buttons simply do NOT work. ]

    For organization and config file readability it might also be helpful to order these commands as suggested above.

    I hope a consistently working method will be implemented (consistently!) in future Webmin upgrades.

    Thank you for your consideration.

     
  • Jamie Cameron

    Jamie Cameron - 2014-05-29

    Now I'm even more confused - from looking at the list of files in the samba Debian package, the init script is called "samba" and not "smbd" : https://packages.debian.org/wheezy/amd64/samba/filelist

     
  • fbachofner

    fbachofner - 2014-06-09

    smbd is at
    /usr/sbin/smbd

    I guess "service smbd 'arg' " where arg= stop, start or restart
    calls the init script at /etc/init.d/ with the relevant argument

     
  • Jamie Cameron

    Jamie Cameron - 2014-06-10

    Sure the samba server is called smbd, but the init script (which the service command calls) appears to have a different name.

     
  • fbachofner

    fbachofner - 2014-06-17

    Fresh install today of Webmin 1.690 on LinuxMint 17

    The Samba stop and restart functionality seems to be working. [although you are still using the init.d calls rather than the Samba-preferred service calls]

    Unfortunately, Webmin gives no visual indication that a stop or restart has taken place (which is not confidence inspiring to those of us bitten by the earlier bug).

    Is there a Webmin config file somewhere which could be edited to coax Webmin to confirm what has taken place short of having to manually check running processes or drop out to a terminal to check Samba status?

    Thanks again for your great work on Webmin.

     
  • Jamie Cameron

    Jamie Cameron - 2014-06-18

    You should be able to tell if a stop or start has been done by looking at what buttons appear in the Samba module - if "Stop" appears then the servers are running, and if "Start" appears then they are down.

     
    • fbachofner

      fbachofner - 2014-12-08

      I installed 1.720 on a fresh installation of LinuxMint 17.1 today and the Samba module still can NOT stop or restart the smbd daemon "out of the box"

      the "restart" button fails and the "stop" button does NOT change to "start" as your post above indicates.

      Changing the values at /etc/webmin/samba/config as I have indicated earlier in this thread ( https://sourceforge.net/p/webadmin/bugs/4329/#1649 ) DOES allow the buttons to work. However, the stop button never changes to "start" when Samba is down . . .

       
  • Rodrigo R. Magalhães

    Hello there, apparently this issue still stands, O have an ubuntu server 14.04 box and had to change /etc/webmin/samba/config *_cmd lines onto the following so the samba restart/stop/start buttons work properly.

    stop_cmd=sudo service smbd stop; sudo service nmbd stop
    restart_cmd=sudo service smbd restart; sudo service nmbd restart
    start_cmd=sudo service smbd start; sudo service nmbd start

    Is there a way it could work out of the box for ubuntu (and think also other debian derivatives)?

     
  • Jamie Cameron

    Jamie Cameron - 2015-10-04

    Wait, why is the sudo command needed? Webmin already runs with root priviliges.

     
1 2 > >> (Page 1 of 2)

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks