Page 1 of 1

Samba Not Starting

Posted: Sun Jan 01, 2023 9:44 pm
by Sliff2000

Haven't used samba in awhile but regularly update mister. Ssh into mister and tried running smbd when I couldn't access any of the samba shares and I got the error:

directory_create_or_exist: mkdir failed on directory /var/lib/samba/private/msg.sock: No such file or directory

Made the directory -- smbd then nmbd and everything works ((well had to add a user since passdb.tdb secrets.tdb are in that directory also)). Reboot and /var/lib/samba/private is gone. Tried to use the script samba on then samba off then samba on again with no luck unless I create the directory. Any help would be appreciated. Thanks.


Re: Samba Not Starting

Posted: Sun Jan 01, 2023 9:49 pm
by Malor

The filesystem /var/lib/samba is a "tmpfs"... that's mean it's a RAM disk, and disappears after the system reboots. That's why your manual fix doesn't stick.

The /etc/init.d/S91smb script is used to start Samba, and as part of its setup, should be creating /var/lib/samba/private. These commands are near the top part of mine:

Code: Select all

mkdir -p /var/log/samba
mkdir -p /tmp/samba
mkdir -p /tmp/cache
mkdir -p /tmp/cache/samba
mkdir -p /var/lib/samba/private

Double-check that the last line is in your script. It doesn't have to be in the exact identical spot, but it needs to happen before the script tries to launch the smbd daemon.


Re: Samba Not Starting

Posted: Sun Jan 01, 2023 10:08 pm
by Sliff2000

The lines where in there. Never touch the file. Here is my current /etc/init.d/S91smb :

Code: Select all

\\#!/bin/sh

[ -f /etc/samba/smb.conf ] || exit 0
[ -f /media/fat/linux/samba.sh ] || exit 0

mkdir -p /var/log/samba
mkdir -p /tmp/samba
mkdir -p /tmp/cache
mkdir -p /tmp/cache/samba
mkdir -p /var/lib/samba/private

start() {
	printf "Starting SMB services: "
	smbd -D
	[ $? = 0 ] && echo "OK" || echo "FAIL"

printf "Starting NMB services: "
nmbd -D
[ $? = 0 ] && echo "OK" || echo "FAIL"

/media/fat/linux/samba.sh
}

stop() {
	printf "Shutting down SMB services: "
	kill -9 `pidof smbd`
	[ $? = 0 ] && echo "OK" || echo "FAIL"

printf "Shutting down NMB services: "
kill -9 `pidof nmbd`
[ $? = 0 ] && echo "OK" || echo "FAIL"
}

restart() {
	stop
	start
}

reload() {
        printf "Reloading smb.conf file: "
	kill -HUP `pidof smbd`
	[ $? = 0 ] && echo "OK" || echo "FAIL"
}

case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  restart)
  	restart
	;;
  reload)
  	reload
	;;
  *)
	echo "Usage: $0 {start|stop|restart|reload}"
	exit 1
esac

exit $?

Re: Samba Not Starting

Posted: Sun Jan 01, 2023 10:53 pm
by Flandango

Try changing this line:

Code: Select all

\\#!/bin/sh

to

Code: Select all

#!/bin/sh

Re: Samba Not Starting

Posted: Sun Jan 01, 2023 11:13 pm
by Sliff2000

Not sure why I showed the \\#!/bin/sh ... but it was #!/bin/sh. I did find the problem -- /media/fat/linux/samba.sh was /media/fat/linux/_samba.sh so the script was exiting. Renamed it and everything is working -- even on reboot. Used to work. Must have been playing around with security_fixes.sh script at some point. Should be something in the samba_on.sh to turn it back. Either way -- Thanks everyone and hopefully this can help someone else.