Package: samba
Version: 2:3.6.6-3
Severity: important

If nmbd is started before network interfaces are up, it exits with the
following messages:

        [2013/01/12 20:29:47,  0] nmbd/nmbd.c:861(main)
          nmbd version 3.6.6 started.
          Copyright Andrew Tridgell and the Samba Team 1992-2011
        [2013/01/12 20:29:47,  0] lib/interface.c:520(load_interfaces)
          ERROR: Could not determine network interfaces, you must use a 
interfaces config line

This can be reproduced manually by bringing all interfaces (including
lo) down, and then running 'nmbd -FS'.

(I don't have 'bind interfaces only' in smb.conf.)

In the real world, this happens on an SSD-using system that boots up
*really* quickly. According to the logs, NM does not complete network
configuration (via DHCP) until 20:29:50... three seconds after nmbd has
already given up hope.

This bug seems similar to #433449/#576415, in which nmbd would exit if
all network interfaces (except lo) were brought down while nmbd was
running. Those bugs were fixed by introducing an if-up hook script that
reloaded samba. That script went away in version 2:3.6.5-5, when a patch
(libutil_drop_AI_ADDRCONFIG.patch) was added that stopped nmbd from
exiting in the first place. It appears, however, that we overlooked
nmbd's behaviour when started before any network interfaces are up.

The attached patch, taken from #382429, seems to work for me; with it I
can start nmbd, then bring up lo and eth0 and resolve the system's own
name with nmblookup. I tried bringing the interfaces down and up again a
few times without any further problems.

Patching nmbd would be my preferred fix; re-introducing the hook script
would work around the problem for most users, but my problem with the
hook script in the first place was that it didn't work under systemd
(which does not expect an init script to manage two daemons).

-- System Information:
Debian Release: 7.0
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.7-trunk-amd64 (SMP w/4 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.113+nmu3
ii  debconf [debconf-2.0]  1.5.49
ii  dpkg                   1.16.9
ii  libacl1                2.2.51-8
ii  libattr1               1:2.4.46-8
ii  libc6                  2.13-37
ii  libcap2                1:2.22-1.2
ii  libcomerr2             1.42.5-1
ii  libcups2               1.5.3-2.12
ii  libgssapi-krb5-2       1.10.1+dfsg-3
ii  libk5crypto3           1.10.1+dfsg-3
ii  libkrb5-3              1.10.1+dfsg-3
ii  libldap-2.4-2          2.4.31-1
ii  libpam-modules         1.1.3-7.1
ii  libpam-runtime         1.1.3-7.1
ii  libpam0g               1.1.3-7.1
ii  libpopt0               1.16-7
ii  libtalloc2             2.0.7+git20120207-1
ii  libtdb1                1.2.10-2
ii  libwbclient0           2:3.6.6-3
ii  lsb-base               4.1+Debian8
ii  procps                 1:3.3.3-2
ii  samba-common           2:3.6.6-3
ii  update-inetd           4.43
ii  zlib1g                 1:1.2.7.dfsg-13

Versions of packages samba recommends:
ii  logrotate  3.8.1-4
ii  tdb-tools  1.2.10-2

Versions of packages samba suggests:
pn  ctdb                              <none>
pn  ldb-tools                         <none>
pn  openbsd-inetd | inet-superserver  <none>
pn  smbldap-tools                     <none>

-- debconf information:
  samba/run_mode: daemons
  samba-common/title:


-- 
Sam Morris <s...@robots.org.uk>
Index: samba-3.6.10/source3/lib/interface.c
===================================================================
--- samba-3.6.10.orig/source3/lib/interface.c	2013-01-13 14:37:28.574523129 +0000
+++ samba-3.6.10/source3/lib/interface.c	2013-01-13 14:46:56.413338890 +0000
@@ -515,7 +515,7 @@
 	/* if we don't have a interfaces line then use all broadcast capable
 	   interfaces except loopback */
 	if (!ptr || !*ptr || !**ptr) {
-		if (total_probed <= 0) {
+		if (total_probed < 0) {
 			DEBUG(0,("ERROR: Could not determine network "
 			"interfaces, you must use a interfaces config line\n"));
 			exit(1);

Reply via email to