Problem: Samba Service Crashes Frequently


The Samba service crashes frequently and needs to be restarted manually.


UCS 4.x with Samba v4.10.
In the samba log files you will see entries like this:
smb_panic_default: PANIC (pid 13256): Bad talloc magic value - unknown value
smb_panic_default: PANIC (pid 11993): Bad talloc magic value - access after free


This is a workaround to restore the functionality of Samba as quickly as possible. The frequency of Samba panics must be observed and this workaround should only be used if the Samba panics occur infrequently.

You can configure a samba panic action to restart samba immediately; to keep an eye on the occurrences we will log into syslog.

Step 1 Create a restart script

You can use another path

root@dc0:~ # vi /root/

logger “Samba has Panic… Will restart.”
sleep 1 # let samba settle
/etc/init.d/samba restart
logger “Samba is restarted by Samba Panic Action.”

Step 2 Include the Script in Samba Configuration

We put this into samba local.conf:

root@dc0:~ # vi /etc/samba/local.conf

If the section global already exists extend it or if not create the section:

panic action = /root/

Make script excecuteable:

root@dc0:~ # chmod 770 /root/

Step 3 Restart samba (and test the script)

root@dc0:~ # root@ucs:~# /root/

Step 4 Check Logging and Samba config (is including panic action)

Check the syslog:

root@dc0:~ # grep "Panic" /var/log/syslog

Check the samba configuration:

root@dc0:~ # testparm -svv |grep panic

Step 5 Observe occurrences

You need to observe the frequency of Samba panics:

root@dc0:~ # grep "Panic" /var/log/syslog

This workaround should not be used, if Samba panics weekly or daily! You need to investigate deeper in these cases.

1 Like