Ubuntu – Samba needs additional restart on reboot

11.04samba

So when I first boot or reboot, smbd and nmbd are running but my shared folders aren't available. After a

sudo service smbd restart

everything is fine. My configuration is simple, using the local workgroup without winbind and there aren't any errors in log.(s|n)mbd.

Any ideas on how I can get rid of this additional restart?

Here's my smb.conf and I'm not sharing from a home dir or an encrypted partition.


[global]

   workgroup = WORKGROUP
   server string = %h server (Samba, Ubuntu)
   dns proxy = no

interfaces = lo eth0
hosts allow = 127.0.0.1 192.168.1.0/24 192.168.2.0/24
bind interfaces only = true
client ntlmv2 auth = yes

   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d

security = share
guest account = nobody

   encrypt passwords = true
   passdb backend = tdbsam
   obey pam restrictions = yes

   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s* ...
   pam password change = yes
   map to guest = bad user

   usershare allow guests = yes

[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no

[Media]
    comment = Media 
    path = /media/archive_a
    browseable = no 
    read only = yes
    guest ok = yes

[Firefly]
    comment = Firefly 
    path = /usr/local/firefly
    browseable = no 
    read only = no
    guest ok = yes

Best Answer

You have changed /etc/samba/smb.conf to have smbd bind to a specific interface.

interfaces = lo eth0
bind interfaces only = true

Therefore you also need to edit /etc/init/smbd.conf to ensure that smbd starts only after that your interface is up as described in https://bugs.launchpad.net/ubuntu/+source/samba/+bug/771305/comments/17

so, edit /etc/init/smbd.conf and change

start on (local-filesystems and net-device-up)

with

start on (local-filesystems and net-device-up IFACE=eth0 and started udev-finish)
Related Question