Skip to content

Instantly share code, notes, and snippets.

@Robertof
Created January 29, 2023 19:18
Show Gist options
  • Save Robertof/eb93c4bcd8d3502f9637b4d7b8084530 to your computer and use it in GitHub Desktop.
Save Robertof/eb93c4bcd8d3502f9637b4d7b8084530 to your computer and use it in GitHub Desktop.
Fix for "can't open /opt/var/run/smbd-ZyXELSambaReplacement.conf.pid: Error was File exists"

This happens because /opt/var/run is not a tmpfs, and the data is never removed on reboot.

As a workaround, the fs can be mounted as tmpfs on boot before the new Samba is loaded and replaced. Place the S00runtmpfs file attached to this gist in /opt/etc/init.d, run:

chmod a+x /opt/etc/init.d/S00runtmpfs

Reboot your NAS. Profit!

#!/bin/sh
#
case "$1" in
start)
/bin/mount -t tmpfs -o rw,relatime,size=100k tmpfs /opt/var/run/
;;
stop)
;;
restart)
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment