"bind interfaces only" requires a manual change to /etc/init/smbd.conf

Bug #823878 reported by Vasya Pupkin
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
samba (Ubuntu)
Triaged
Low
Unassigned

Bug Description

Sometimes smbd daemon failes to start after system restart. As a result, fileserver is not accessible after power failure and requires someone to fix that manually, which sometimes is very hard to do. Today this happened again and here's what was in logs:

===
Aug 10 14:40:32 shadow-server smbd[713]: [2011/08/10 14:40:32, 0] lib/interface.c:550(load_interfaces)
Aug 10 14:40:32 shadow-server smbd[713]: WARNING: no network interfaces found
Aug 10 14:40:32 shadow-server smbd[713]: [2011/08/10 14:40:32, 0] smbd/server.c:1115(main)
Aug 10 14:40:32 shadow-server smbd[713]: standard input is not a socket, assuming -D option
Aug 10 14:40:32 shadow-server smbd[713]: [2011/08/10 14:40:32, 0] smbd/server.c:616(open_sockets_smbd)
Aug 10 14:40:32 shadow-server smbd[713]: open_sockets_smbd: No sockets available to bind to.
Aug 10 14:40:32 shadow-server smbd[713]: [2011/08/10 14:40:32, 0] smbd/server.c:837(exit_server_common)
Aug 10 14:40:32 shadow-server smbd[713]: ===============================================================
Aug 10 14:40:32 shadow-server smbd[713]: [2011/08/10 14:40:32, 0] smbd/server.c:839(exit_server_common)
Aug 10 14:40:32 shadow-server smbd[713]: Abnormal server exit: open_sockets_smbd() failed
Aug 10 14:40:32 shadow-server smbd[713]: [2011/08/10 14:40:32, 0] smbd/server.c:840(exit_server_common)
Aug 10 14:40:32 shadow-server smbd[713]: ===============================================================
Aug 10 14:40:32 shadow-server smbd[713]: [2011/08/10 14:40:32, 0] lib/util.c:1584(log_stack_trace)
Aug 10 14:40:32 shadow-server smbd[713]: BACKTRACE: 6 stack frames:
Aug 10 14:40:32 shadow-server smbd[713]: #0 smbd(log_stack_trace+0x1a) [0x7f898f57295a]
Aug 10 14:40:32 shadow-server smbd[713]: #1 smbd(+0x5a9f90) [0x7f898f801f90]
Aug 10 14:40:32 shadow-server smbd[713]: #2 smbd(+0x5aa161) [0x7f898f802161]
Aug 10 14:40:32 shadow-server smbd[713]: #3 smbd(main+0x90d) [0x7f898f802ebd]
Aug 10 14:40:32 shadow-server smbd[713]: #4 /lib/libc.so.6(__libc_start_main+0xfd) [0x7f898bcffc4d]
Aug 10 14:40:32 shadow-server smbd[713]: #5 smbd(+0xc0a49) [0x7f898f318a49]
Aug 10 14:40:32 shadow-server smbd[713]: [2011/08/10 14:40:32, 0] lib/fault.c:326(dump_core)
Aug 10 14:40:32 shadow-server smbd[713]: dumping core in /var/log/samba/cores/smbd
Aug 10 14:40:32 shadow-server smbd[713]:
Aug 10 14:40:33 shadow-server init: smbd main process (713) killed by ABRT signal
Aug 10 14:40:33 shadow-server init: smbd main process ended, respawning

*** repeated the same several times ***

Aug 10 14:40:33 shadow-server init: smbd main process (902) killed by ABRT signal
Aug 10 14:40:33 shadow-server init: smbd respawning too fast, stopped
===

It's a server, network is configured via DHCP, there is no Network Manager installed, and according to log, it was configured just a second after smbd failed to start:

Aug 10 14:40:34 shadow-server dhclient: bound to 192.168.0.156 -- renewal in 40397 seconds.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: samba 2:3.4.7~dfsg-1ubuntu3.7
ProcVersionSignature: Ubuntu 2.6.32-33.72-server 2.6.32.41+drm33.18
Uname: Linux 2.6.32-33-server x86_64
Architecture: amd64
Date: Wed Aug 10 15:44:21 2011
InstallationMedia: Ubuntu-Server 10.04.2 LTS "Lucid Lynx" - Release amd64 (20110211.1)
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SambaServerRegression: No
SourcePackage: samba

Revision history for this message
Vasya Pupkin (shadowlmd) wrote :
Dave Walker (davewalker)
Changed in samba (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Steve Langasek (vorlon) wrote :

Is this the same as bug #771305, manifesting differently in lucid?

Revision history for this message
Vasya Pupkin (shadowlmd) wrote :

Looks like it is. Also, I have similar configuration as in cremersdh's last post:

   interfaces = 192.168.0.0/24
   bind interfaces only = yes

So, it really has to wait before all defined network interfaces are up.

Revision history for this message
Robie Basak (racb) wrote :

Vasya,

If you manually change /etc/samba/smb.conf to have smbd bind to a specific interface, you also need to edit /etc/init/smbd.conf to make sure the smbd is started only after that particular interface is up, in the style "start on (local-filesystems and net-device-up IFACE=eth0)" (as described in https://bugs.launchpad.net/ubuntu/+source/samba/+bug/771305/comments/17).

Ideally upstart would pick up on this automatically, but we also have to cater for environments where a network might not come up until much later if at all, and local access to smbd over loopback should still be available in that case (see https://bugs.launchpad.net/ubuntu/+source/samba/+bug/771305/comments/10).

It is unfortunate that a sysadmin would have to know to do this when adding interfaces/bind interfaces only to smbd, so I'm leaving this bug open in case someone can come up with a way of solving this problem without issues in both cases. I'm setting Importance to Low as this workaround is available and the problem only occurs when the sysadmin changes smb.conf by hand.

summary: - smbd failed to start after system restart
+ "bind interfaces only" requires a manual change to /etc/init/smbd.conf
Changed in samba (Ubuntu):
importance: Medium → Low
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in samba (Ubuntu):
status: New → Confirmed
Robie Basak (racb)
Changed in samba (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
camden lindsay (camden-lindsay+launchpad) wrote :

After modifying 'net-device-up IFACE=eth0' to the 'start on' clause, i now am running into the problem that /var/run/samba does not exist, as described here:
https://bugs.launchpad.net/ubuntu/lucid/+source/samba/+bug/596064

Revision history for this message
camden lindsay (camden-lindsay+launchpad) wrote :

I'm sorry i wasn't clear in #6 -- samba now starts on boot, but nmbd does not, for the reasons indicated in the above bug.

Revision history for this message
Steve Langasek (vorlon) wrote :

What exactly did you set the start line to? It currently is set to 'start on (local-filesystems and net-device-up IFACE!=lo)'. If you drop the 'local-filesystems' part, of course there will be problems with the job starting before the filesystem is mounted.

> as described here:
> https://bugs.launchpad.net/ubuntu/lucid/+source/samba/+bug/596064

The followups in that bug are entirely incorrect and probably not related to your issue.

Revision history for this message
camden lindsay (camden-lindsay+launchpad) wrote :

To be clear and recap--

smb.conf has the following
interfaces = eth0

Static IP was assigned via network manager.

smbd would not start up-- as per https://bugs.launchpad.net/ubuntu/+source/samba/+bug/836849 (open_socket_smbd fail)

As per this bug (the one i am currently updating), i edited the startup in /etc/init/smbd.conf to be the following
start on (local-filesystems and net-device-up IFACE=eth0)

smbd started without a problem, but nmbd no longer started at boot.

Following the debug tips in the bug
https://bugs.launchpad.net/ubuntu/lucid/+source/samba/+bug/596064
I identified that nmbd was not starting because /var/run/samba did not exist. I added 'mkdir -p /var/run/samba' to the pre-start script of /etc/init/nmbd.conf as suggested by bug 596064, and now everything starts up as expected.

hope this explains it..

Revision history for this message
Steve Langasek (vorlon) wrote :

What version of the samba package do you have installed? Your bug report says you're running lucid, but the lucid version of the nmbd, upstart job already includes code to handle creation of the /var/run/samba directory.

Revision history for this message
Steve Langasek (vorlon) wrote :

And do you have the samba-common-bin package installed? If not, you're seeing bug #572410 which was fixed in maverick.

Revision history for this message
Borim (borim) wrote :

A solution for the future can be the use of the network-services event. It is mentioned in the upstart cookbook (http://upstart.ubuntu.com/cookbook/#networkservices) and Bug #701576 also target the introduction of this event.

In the cookbook it is "announced" for 11.10.

I checked the existence of the network-services event with Ubuntu 12.10 by starting Ubuntu with the debug switch. But I can not find the network-services event in /var/log/dmesg where all triggered events are listed.

So I guess the network-services event is still not implemented. In the case the network-services event gets added, smbd should use it to fix this bug.

Revision history for this message
Steve Langasek (vorlon) wrote : Re: [Bug 823878] Re: "bind interfaces only" requires a manual change to /etc/init/smbd.conf

On Tue, Dec 25, 2012 at 02:08:37PM -0000, Borim wrote:

> I checked the existence of the network-services event with Ubuntu 12.10
> by starting Ubuntu with the debug switch. But I can not find the
> network-services event in /var/log/dmesg where all triggered events are
> listed.

This probably refers to the 'static-network-up' event.

Revision history for this message
Borim (borim) wrote :

> This probably refers to the 'static-network-up' event.

In my case this maybe enough, as I use static configured network interfaces, but what if smbd is bound to a interface using DHCP?
I did not check if this case will work. But I think smbd should handle binding to static and dynamic configured interfaces without random hiccups.

Revision history for this message
yetanotherion (nolaridebi) wrote :

With quite a delay :) (almost three years after), I had the same issue, on 14.04.3 LTS (GNU/Linux 3.19.0-33-generic x86_64).
After reading this bug and https://bugs.launchpad.net/ubuntu/+source/samba/+bug/596064
As a workaround, I set

"start on (local-filesystems and net-device-up IFACE=eth0 and started nmbd)" in /etc/init/smbd.conf.

I have two remarks, regarding:
- "IFACE=eth0": shouldn't "net-device-up" wait for all interfaces to have an ip address ? (for interfaces configured on DHCP among others)
- "started nmbd": I wonder whether that should not be put per default by the samba's installation script. What do you think ?

Revision history for this message
Steve Langasek (vorlon) wrote :

> - "IFACE=eth0": shouldn't "net-device-up" wait for all interfaces to have an ip address ?

No. That's the 'static-network-up' event, mentioned above. 'net-device-up' is a per-device event.

> - "started nmbd": I wonder whether that should not be put per default by the samba's installation script. What do you think ?

No, that's definitely wrong and will cause 'service nmbd restart' to hang. And I don't know why this would be necessary on your system.

Regardless, beyond 14.04 the system init is handled completely differently (via systemd instead of upstart) so this bug will no longer apply in 16.04 LTS.

Revision history for this message
yetanotherion (nolaridebi) wrote :

> - "IFACE=eth0": shouldn't "net-device-up" wait for all interfaces to have an ip address ?

>>No. That's the 'static-network-up' event, mentioned above. 'net-device-up' is a per-device event.

I have another question then, for which device does the service wait when 'net-device-up' is used without arguments ?
(as it is in the default smbd.conf)

> - "started nmbd": I wonder whether that should not be put per default by the samba's installation script. What do you think ?

>>No, that's definitely wrong and will cause 'service nmbd restart' to hang.
Good point.

>>And I don't know why this would be necessary on your system.

My server correctly boots without "started nmbd" during the 3/4 test reboots I made. However, I kept that line
"just in case" I got into a racy situation during reboots in the future (https://bugs.launchpad.net/ubuntu/+source/samba/+bug/596064)

>>Regardless, beyond 14.04 the system init is handled completely differently (via systemd instead of upstart) so this bug will no longer apply in 16.04 LTS.

That's (very) good to know, thanks for your answers !

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.