Bug#698056: samba: nmbd fails to start when no interfaces are up

2013-01-13 Thread Sam Morris
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  adduser3.113+nmu3
ii  debconf [debconf-2.0]  1.5.49
ii  dpkg   1.16.9
ii  libacl12.2.51-8
ii  libattr1   1:2.4.46-8
ii  libc6  2.13-37
ii  libcap21: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  libtdb11.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 +
+++ samba-3.6.10/source3/lib/interface.c	2013-01-13 14:46:56.413338890 +
@@ -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);


Bug#698056: samba: nmbd fails to start when no interfaces are up

2013-01-13 Thread Steve Langasek
On Sun, Jan 13, 2013 at 03:35:45PM +, Sam Morris wrote:
 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.

If you can only reproduce this by bringing lo down, then the question is:
why are you bringing lo down?

The loopback interface should be up by the time the system finishes
processing /etc/rcS.d and should stay up until the system shuts down.  It's
entirely reasonable for nmbd to assume this is the case.

 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).

 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 
 +
 +++ samba-3.6.10/source3/lib/interface.c  2013-01-13 14:46:56.413338890 
 +
 @@ -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);

I don't think this is a correct fix; I think you have a boot ordering
problem on your systemd-using system.

-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
Ubuntu Developerhttp://www.debian.org/
slanga...@ubuntu.com vor...@debian.org


signature.asc
Description: Digital signature


Bug#698056: [Pkg-samba-maint] Bug#698056: samba: nmbd fails to start when no interfaces are up

2013-01-13 Thread Christian PERRIER
severity 698056 normal
thanks

Quoting Steve Langasek (vor...@debian.org):

 If you can only reproduce this by bringing lo down, then the question is:
 why are you bringing lo down?
 
 The loopback interface should be up by the time the system finishes
 processing /etc/rcS.d and should stay up until the system shuts down.  It's
 entirely reasonable for nmbd to assume this is the case.

And I think we already had such reports, which have all been closed as
invalid.

Any, the severity is overflated, assuming that bug is valid.




signature.asc
Description: Digital signature