Question on starting USB and starting Samba

This is actually 2 seperate questions both related to starting these services at boot time under 6.3.

  1. Samba

In my rc.local I start the samba demons with ‘smbd -D’ and ‘nmbd -D’. Everything works just fine.

However, after doing a shutdown via the shutdown command during the re-boot samba fails to start correctly because it leaves and in the /var/lock directory. So of course I added an ‘rm -f /var/lock/’ and ‘rm -f /var/lock/’ into rc.local. This fixed that problem.

Now I am noticing that sometimes the ‘connections.tbd’ file in /var/lock is busy after a re-boot so samba won’t allow connections. To solve this I have to do a chkfsys by hand to unbusy the file and restart the daemons.

Now I can add this to the rc.local as well but this seems like one giant kludge to me. So my question is how is everyone else handling this issue? Can I just go ahead and remove the .tbd files as well in /var/lock and if so, can then all be removed at boot time or just certain ones?

I don’t re-boot this server often (maybe once every couple of months) so it’s not a huge problem but it’s an annoying one because I always have to remember what to do to get samba working again.

  1. USB drivers

I have started the USB driver with the following commands:

io-usb -duhci
waitfor /dev/io-usb/io-usb
usb -v
devb-umass &

At boot time the io-usb launches and the system waits a few seconds for /dev/io-usb/io-usb to be created. Then when ‘usb -v’ runs it reports 3 USB ports but nothing plugged into them (which is incorrect because I have a SanDisk 6-1 Image mate connected with a flash card plugged into it). So when the debv-umass driver runs it reports no mass devices and exits immediately.

Then about 1-2 seconds later I see power go to the San Disk cardreader.

After the boot finishes, I can run ‘usb -v’ from the shell and it reports the card reader. Then I run devb-umass and it immediately finds the device and I can mount the flash card and use it quite fine as a drive. So that’s not an issue.

What I don’t understand is why the device is not powered immediately during boot after running io-usb. How do others handle this? I can just add a sleep of a few seconds but I wanted to know in general if there was something else I could waitfor to tell me that power has been delivered to the USB devices before attempting to start specific drivers.


  1. Samba
    We currently use your suggested kludge (rm -f /var/lock/*). You could, however, create a shutdown script and use an alias so that the shutdown command actually runs your script. In the script, issue a ‘slay -f -sSIGTERM smbd’ and a ‘slay -f -sSIGTERM nmbd’ and then call the OS shutdown utility (remeber to enter the full path). Not sure if this will make the *.pid and connections.tdb files clean up nicely or not, but it might be worth a try.