smbd.conf needs to wait for network up event

Bug #740777 reported by Egon A. Rath
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
samba (Ubuntu)
In Progress
Medium
Clint Byrum

Bug Description

Binary package hint: samba

The upstart script smb.conf should not only wait for the local-filesystems event, but also for the network up event (like its done for the nmbd.conf file which is also part of the samba package).

Tags: upstart
Revision history for this message
Egon A. Rath (egon-rath) wrote :

File in question is /etc/init/smbd.conf.

Original:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
description "SMB/CIFS File Server"
author "Steve Langasek <email address hidden>"

start on local-filesystems
stop on runlevel [!2345]

respawn

pre-start script
        RUN_MODE="daemons"

        [ -r /etc/default/samba ] && . /etc/default/samba

        [ "$RUN_MODE" = inetd ] && { stop; exit 0; }

        install -o root -g root -m 755 -d /var/run/samba
end script

exec smbd -F
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Modified as it should be:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
description "SMB/CIFS File Server"
author "Steve Langasek <email address hidden>"

start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]

respawn

pre-start script
        RUN_MODE="daemons"

        [ -r /etc/default/samba ] && . /etc/default/samba

        [ "$RUN_MODE" = inetd ] && { stop; exit 0; }

        install -o root -g root -m 755 -d /var/run/samba
end script

exec smbd -F
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Changed in samba (Ubuntu):
assignee: nobody → Clint Byrum (clint-fewbar)
importance: Undecided → Medium
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Egon, thanks for the bug report.

Can you explain what is not working correctly when samba comes up early?

It shouldn't cause any problems for samba to begin listening without any network interfaces, unless you bind it to a specific IP address. When you do that, you need to customize the init script to wait for that interface to come up anyway.

Absent that answer though, I do think that there's no real benefit to having smbd up before the network. It would probably be better to just do 'start on runlevel [2345] or net-device-up IFACE!=lo'. This will make sure that its started back up when moving from runlevel 1 -> 2, and will make sure its started any time a network device is configured and its not running.

I'm going to mark the bug as Triaged, and lower the importance to Low. If there are real, adverse affects caused by the early start, we can raise the importance once they are documented here.

Changed in samba (Ubuntu):
status: New → Triaged
importance: Medium → Low
assignee: Clint Byrum (clint-fewbar) → nobody
tags: added: upstart
tags: added: bitesize
Revision history for this message
Egon A. Rath (egon-rath) wrote :

In fact the problem only occurs when smbd is configured to listen only to a specific interface - in this situation smbd doesn't even comes up.

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Actually I just saw where smbd starts and is respawned several times before lo is up, so indeed we need at least lo up for smbd to function properly with the default config.

Raising importance to Medium, as this probably causes a boot performance regression.

Changed in samba (Ubuntu):
importance: Low → Medium
tags: removed: bitesize
Changed in samba (Ubuntu):
assignee: nobody → Clint Byrum (clint-fewbar)
status: Triaged → In Progress
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.