[Pkg-samba-maint] Bug#640668: samba: Updated if-up.d script to function under systemd

Sam Morris sam at robots.org.uk
Tue Sep 6 12:40:34 UTC 2011

Package: samba
Version: 2:3.6.0-1
Severity: normal

When systemd is installed, the behaviour of '/etc/init.d/samba status'
changes (systemd changes the LSB init functions to launch services via
systemctl rather than directly) in a way that breaks the if-up.d script.

I've modified the script to get it to work again; see below.

-- System Information:
Debian Release: wheezy/sid
  APT prefers stable
  APT policy: (545, 'stable'), (540, 'stable-updates'), (530, 'testing'), (520, 'unstable'), (510, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages samba depends on:
ii  adduser                 3.112+nmu2       add and remove users and groups
ii  debconf [debconf-2.0]   1.5.40           Debian configuration management sy
ii  libacl1                 2.2.51-3         Access control list shared library
ii  libattr1                1:2.4.46-3       Extended attribute shared library
ii  libc6                   2.13-18          Embedded GNU C Library: Shared lib
ii  libcap2                 1:2.19-3         support for getting/setting POSIX.
ii  libcomerr2              1.41.12-4stable1 common error description library
ii  libcups2                1.5.0-5          Common UNIX Printing System(tm) - 
ii  libgssapi-krb5-2        1.9.1+dfsg-1+b1  MIT Kerberos runtime libraries - k
ii  libk5crypto3            1.9.1+dfsg-1+b1  MIT Kerberos runtime libraries - C
ii  libkrb5-3               1.9.1+dfsg-1+b1  MIT Kerberos runtime libraries
ii  libldap-2.4-2           2.4.23-7.2       OpenLDAP libraries
ii  libpam-modules          1.1.1-6.1        Pluggable Authentication Modules f
ii  libpam-runtime          1.1.1-6.1        Runtime support for the PAM librar
ii  libpam0g                1.1.1-6.1        Pluggable Authentication Modules l
ii  libpopt0                1.16-1           lib for parsing cmdline parameters
ii  libtalloc2              2.0.6-2          hierarchical pool based memory all
ii  libtdb1                 1.2.9-3          Trivial Database - shared library
ii  libwbclient0            2:3.6.0-1        Samba winbind client library
ii  lsb-base                3.2-28           Linux Standard Base 3.2 init scrip
ii  procps                  1:3.2.8-11       /proc file system utilities
ii  samba-common            2:3.6.0-1        common files used by both the Samb
ii  update-inetd            4.38+nmu1        inetd configuration file updater
ii  zlib1g                  1: compression library - runtime

Versions of packages samba recommends:
ii  logrotate                     3.7.8-6    Log rotation utility
ii  tdb-tools                     1.2.9-3    Trivial Database - bundled binarie

Versions of packages samba suggests:
pn  ctdb                          <none>     (no description available)
pn  ldb-tools                     <none>     (no description available)
pn  openbsd-inetd | inet-superser <none>     (no description available)
pn  smbldap-tools                 <none>     (no description available)

-- Configuration Files:
/etc/network/if-up.d/samba changed:
if [ "$IFACE" = lo ]; then
	exit 0
if [ "$MODE" != start ]; then
	exit 0
case $ADDRFAM in
		exit 0
if test -e /sys/fs/cgroup/systemd; then
	# systemd hijacked the output of '/etc/init.d/samba status'
	if systemctl status samba.service > /dev/null; then
		if ! systemd-cgls /system/samba.service | grep -q nmbd; then
			systemctl restart samba.service
	status=$(/etc/init.d/samba status)
	# Really only necessary to do anything if nmbd is not already running
	if echo "$status" | grep -q 'smbd is running' \
	   && ! echo "$status" | grep -q 'nmbd is running'
		/etc/init.d/samba start
exit 0

-- debconf information:
  samba/run_mode: daemons
  samba/generate_smbpasswd: true

More information about the Pkg-samba-maint mailing list