Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 302123 - net-fs/samba-server-3.4.5: broken init script config
Summary: net-fs/samba-server-3.4.5: broken init script config
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo's SAMBA Team
URL: http://www.samba.org
Whiteboard:
Keywords:
: 302124 345685 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-01-25 01:38 UTC by Igor Franchuk
Modified: 2013-01-28 19:07 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Franchuk 2010-01-25 01:38:47 UTC
no pid --pidfile

3.4.5 config 

smbd_stop="start-stop-daemon --stop --exec /usr/sbin/smbd"
nmbd_stop="start-stop-daemon --stop --exec /usr/sbin/nmbd"

should be
smbd_stop="start-stop-daemon --stop --exec /usr/sbin/smbd --pidfile /var/run/samba/smbd.pid"

nmbd_stop="start-stop-daemon --stop --exec /usr/sbin/nmbd --pidfile /var/run/samba/nmbd.pid"



Reproducible: Always

Steps to Reproduce:
1./etc/init.d/samba start
2./etc/init.d/samba stop
3.

Actual Results:  
 # /etc/init.d/samba stop
 * samba -> stop: smbd ...                                                                                                                             [ ok ]
 * samba -> stop: nmbd ...                                                                                                                             [ !! ]

Expected Results:  
 # /etc/init.d/samba stop
 * samba -> stop: smbd ...                                                                                                                             [ ok ]
 * samba -> stop: nmbd ...                                                                                                                             [ ok ]
Comment 1 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-01-25 06:30:25 UTC
With your suggestion all child processes of smbd won't get killed during stop leaving the samba-server running for already connected clients. So at least for smbd your solution is a no-go.
Comment 2 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-01-25 06:31:08 UTC
*** Bug 302124 has been marked as a duplicate of this bug. ***
Comment 3 Igor Franchuk 2010-01-25 11:43:39 UTC
(In reply to comment #1)
> With your suggestion all child processes of smbd won't get killed during stop
> leaving the samba-server running for already connected clients. So at least for
> smbd your solution is a no-go.
> 

I thought samba stores PID of a management process which would kill all the childs if killed itslef. At least it looks like that. When I start samba I see several smbd & nmbd running. #/init.d/samba stop seems to stop all the childs. Yet when no --pidfile is specified after 

#/init.d/samba stop 

I see several nmbd and none of smbd. With smbd the original gentoo configuration works fine. I remember that from time to time with older samba I had the problem with nmbd not killed. So may be it's just luck that in most cases --pidfile worked

smbd_stop="start-stop-daemon --stop --exec /usr/sbin/smbd --pidfile /var/run/samba/smbd.pid"

nmbd_stop="start-stop-daemon --stop --exec /usr/sbin/nmbd --pidfile /var/run/samba/nmbd.pid"

/etc/init.d/samba start
 * samba -> start: smbd ...                                                                                                                            [ ok ]
 * samba -> start: nmbd ...                                                                                                                            [ ok ]

root     32377  0.0  0.2  16116  2740 ?        Ss   14:28   0:00 /usr/sbin/smbd -D
root     32378  0.0  0.1  16116  1272 ?        S    14:28   0:00 /usr/sbin/smbd -D

root     32387  0.0  0.1  10064  1724 ?        Ss   14:28   0:00 /usr/sbin/nmbd -D
root     32388  0.0  0.0   9904   896 ?        S    14:28   0:00 /usr/sbin/nmbd -D

 # cat /var/run/samba/smbd.pid
32377

 # cat /var/run/samba/nmbd.pid
32387

# /etc/init.d/samba stop
 * samba -> stop: smbd ...                                                                                                                             [ ok ]
 * samba -> stop: nmbd ...                                                                                                                             [ ok ]

 ps aux | grep "nmbd"
 (empty)
 ps aux | grep "smbd"

Both 32387 && 32388 are killed though PID file was only reffereing to 32387, is it a bug of some kind?

with

smbd_stop="start-stop-daemon --stop --exec /usr/sbin/smbd"

nmbd_stop="start-stop-daemon --stop --exec /usr/sbin/nmbd --pidfile /var/run/samba/nmbd.pid"

after /etc/init.d/samba stop
there will be always two instances of nmbd running. All so restart won't work.


If pidfile isn't an option, maybe killall -15 should be added into init script. 

PS could you please resize Additional Comments window for graphical browsers, it's so small like we're robbing the browser out of comments with that.
Comment 4 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-01-31 22:54:57 UTC
Could you please post the output of 

  emerge --info

from the affected machine?
Comment 5 Igor Franchuk 2010-02-01 10:00:15 UTC
> from the affected machine?

Sure.

Portage 2.1.6.13 (default/linux/x86/10.0/server, gcc-4.3.4, glibc-2.9_p20081201-r2, 2.6.31-gentoo-r6 i686)
=================================================================
System uname: Linux-2.6.31-gentoo-r6-i686-Intel-R-_Celeron-R-_CPU_2.80GHz-with-gentoo-1.12.13
Timestamp of tree: Mon, 25 Jan 2010 00:00:02 +0000
app-shells/bash:     4.0_p35
dev-lang/python:     2.6.4
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.63-r1
sys-devel/automake:  1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://gd.tuwien.ac.at/opsys/linux/gentoo/ ftp://gentoo.inode.at/source/ ftp://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/ http://mirror.netcologne.de/gentoo/ http://mirror.yandex.ru/gentoo-distfiles/ ftp://mirror.yandex.ru/gentoo-distfiles/ ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://mirror.mcs.anl.gov/pub/gentoo/ ftp://lug.mtu.edu/gentoo/ "
LANG=""
LDFLAGS="-Wl,-O1"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl apache2 berkdb bzip2 cairo cgi cli cracklib crypt cups curl cxx dri dvdr fastcgi ffmpeg fortran gd gdbm gif gpm iconv ipv6 jpeg ldap mailwrapper modules mp3 mpeg mudflap mysql ncurses nls nptl nptlonly ogg openmp pam pcre perl php png pppd python readline reflection session snmp spl ssl svg sysfs tcpd threads truetype unicode usb x86 xml xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

Comment 6 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-02-02 10:42:23 UTC
Just as I suspected. You're using unstable samba on a stable machine which uses baselayout-1 and not openrc/baselayout-2.
I think we found a difference in the behavior of start-stop-daemon from baselayout-1 and the one coming with openrc.
The problems I described in my first post can be seen when you use samba with unstable Gentoo (which means openrc/baselayout-2 being installed). 

Now the question is if our samba-maintainers are willing to provide a fix for making unstable samba working with start-stop-daemon from stable baselayout-1.
The usual answer to such problems is to not mix stable and unstable packages. But maybe in this case an exception is appropriate.
Comment 7 Igor Franchuk 2010-02-02 12:04:24 UTC
(In reply to comment #6)
> Just as I suspected. You're using unstable samba on a stable machine which uses
> baselayout-1 and not openrc/baselayout-2.

Thanks for explaining. I had no idea baselayout-2 is so different. SAMBA 3.4.5 which is masked in portage, is quite stable. Many people are using it, it might easily be unmasked provided that problem with init scripts is fixed.

May be an exception in case of samba would be prudent, since the stable samba in portage tree is quite old, and the security bugs in the earlier versions of samba are made public and exploited already. It's dangerous to use stable portage SAMBA with no IP restrictions.

Thanks!
Comment 8 Felix Leimbach 2010-03-06 21:24:02 UTC
> May be an exception in case of samba would be prudent, since the stable samba
> in portage tree is quite old, and the security bugs in the earlier versions of
> samba are made public and exploited already.

I second the wish for an exception and have one more good reason for that:
Samba 3.4.x is needed to be able to (reliably) join windows 7 clients to a samba domain.
Samba 3.4 on stable gentoo is surely a common configuration.

Comment 9 Víctor Ostorga (RETIRED) gentoo-dev 2010-12-20 20:39:01 UTC
*** Bug 345685 has been marked as a duplicate of this bug. ***
Comment 10 Eugene Rosenzweig 2011-05-23 11:16:02 UTC
I am running baselayout 2.0.2, openrc 0.8.2-r1 and samba 3.5.8-r1 and I have had the problem with nmbd failing to stop. The default stop command for nmbd is in /etc/conf.d/samba and is:
nmbd_stop="start-stop-daemon --stop --exec /usr/sbin/nmbd"
All nmbd processes are sent a SIGTERM, there is a 5 second wait and then start-stop-daemon exits with failure code as nmbd just doesn't exit. I worked out that sending a second SIGTERM does the trick (or a SIGHUP). My final solution was to change the nmbd_stop line in /etc/conf.d/samba from the one above to:
nmbd_stop="start-stop-daemon --stop --exec /usr/sbin/nmbd -R SIGTERM/5/SIGTERM/5"
and is seems to work so far.
Comment 11 Víctor Ostorga (RETIRED) gentoo-dev 2011-05-30 15:07:38 UTC
(In reply to comment #10)
> I am running baselayout 2.0.2, openrc 0.8.2-r1 and samba 3.5.8-r1 and I have
> had the problem with nmbd failing to stop.....

Can you provide your smb.conf and /etc/conf.d/samba files which can reproduce the nmbd stale process? If you had made something else with your samba setup please describe it here.