Samba Not Starting

Kernel, Main, Utilities & Applications, Miscellaneous Devices.
Sliff2000
Posts: 28
Joined: Mon Nov 15, 2021 4:18 am
Has thanked: 6 times
Been thanked: 6 times

Samba Not Starting

Unread post 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.

Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: Samba Not Starting

Unread post 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.

Sliff2000
Posts: 28
Joined: Mon Nov 15, 2021 4:18 am
Has thanked: 6 times
Been thanked: 6 times

Re: Samba Not Starting

Unread post 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 $?
Flandango
Core Developer
Posts: 388
Joined: Wed May 26, 2021 9:35 pm
Has thanked: 41 times
Been thanked: 328 times

Re: Samba Not Starting

Unread post by Flandango »

Try changing this line:

Code: Select all

\\#!/bin/sh

to

Code: Select all

#!/bin/sh
Sliff2000
Posts: 28
Joined: Mon Nov 15, 2021 4:18 am
Has thanked: 6 times
Been thanked: 6 times

Re: Samba Not Starting

Unread post 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.

Post Reply