The underling problem is that sockd -D -p/var/run/sockd.pid has no rights to create the pidfile if run in user.unprivileged mode, correct? But, in the current situation, socks -D deataches itself by forking and the pid registered by start-stop-daemon is approx one lower then the remaining sockd instance/fork and start-stop-daemon fails to rediscover/stop the service x ~ # /etc/init.d/dante-sockd start * Caching service dependencies ... [ ok ] * Starting dante sockd ... [ ok ] x ~ # cat /var/run/sockd.pid 24181 x ~ # ps ax | grep sockd 24182 ? Ss 0:00 /usr/sbin/sockd -D -n 24183 ? S 0:00 sockd: negotiator: 0 24185 ? S 0:00 sockd: requestcomple 24186 ? S 0:00 sockd: requestcomple 24187 ? S 0:00 sockd: requestcomple 24188 ? S 0:00 sockd: requestcomple 24189 ? S 0:00 sockd: iorelayer: 0/ 24193 pts/7 S+ 0:00 grep sockd x ~ # /etc/init.d/dante-sockd stop * Stopping dante sockd ... [ ok ] x ~ # ps ax | grep sockd 24182 ? Ss 0:00 /usr/sbin/sockd -D -n 24183 ? S 0:00 sockd: negotiator: 0 24185 ? S 0:00 sockd: requestcomple 24186 ? S 0:00 sockd: requestcomple 24187 ? S 0:00 sockd: requestcomple 24188 ? S 0:00 sockd: requestcomple 24189 ? S 0:00 sockd: iorelayer: 0/ 24268 pts/7 S+ 0:00 grep sockd My proposed patch to the /etc/init.d/dante-sockd file drops the built-in detach method (-D) and uses start-stop-daemon --background instead. The chown hack on the pid file can be removed, too. --- /etc/init.d/dante-sockd.orig 2011-08-24 10:23:13.000000000 +0200 +++ /etc/init.d/dante-sockd 2011-08-24 10:37:41.000000000 +0200 @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/net-proxy/dante/files/dante-sockd-init,v 1.6 2009/03/05 19:31:13 mrness Exp $ -SOCKD_OPT="-D" +SOCKD_OPT="" [ "${SOCKD_FORKDEPTH:-1}" -gt 1 ] && SOCKD_OPT="${SOCKD_OPT} -N ${SOCKD_FORKDEPTH}" [ "${SOCKD_DEBUG:-0}" -eq 1 ] && SOCKD_OPT="${SOCKD_OPT} -d" [ "${SOCKD_DISABLE_KEEPALIVE:-0}" -eq 1 ] && SOCKD_OPT="${SOCKD_OPT} -n" @@ -31,20 +31,15 @@ fi rm /tmp/dante-sockd.checkconf - #Create pidfile with owner set to daemon's uid - DAEMON_UID=`sed -e '/^[ \t]*user[.]notprivileged[ \t]*:/{s/.*:[ \t]*//;q};d' /etc/socks/sockd.conf` - if [ -n "$DAEMON_UID" ]; then - touch $PIDFILE && chown $DAEMON_UID $PIDFILE - fi - return 0 } start() { checkconfig || return 1 ebegin "Starting dante sockd" - start-stop-daemon --start --quiet --pidfile $PIDFILE \ - --make-pidfile --exec /usr/sbin/sockd -- ${SOCKD_OPT} >/dev/null 2>&1 + start-stop-daemon --start --quiet \ + --background --pidfile $PIDFILE --make-pidfile \ + --exec /usr/sbin/sockd -- ${SOCKD_OPT} >/dev/null 2>&1 eend $? "Failed to start sockd" } Do you grant me permission to commit this to tree?! Thanks Michael
Looks fine to me. Feel free to commit it. :)
+*dante-1.3.2-r1 (05 Oct 2011) + + 05 Oct 2011; Michael Weber <xmw@gentoo.org> +files/dante-sockd-init-1.3.2, + +dante-1.3.2-r1.ebuild: + Revision bump to fix bug 380449 (thanks to radhermit for granting permission) +
*** Bug 465092 has been marked as a duplicate of this bug. ***
+ 09 Apr 2013; Tom Wijsman <TomWij@gentoo.org> +dante-1.3.2-r1.ebuild, + +dante-1.4.0_pre1-r1.ebuild, +files/dante-1.3.2-sockd-init, + dante-1.1.19-r4.ebuild, dante-1.3.2.ebuild, dante-1.4.0_pre1.ebuild: + Revision bump of 1.3.2 and 1.4.0_pre1 fix bug #380449 (duplicate bug #465092), + meanwhile also added GPL-2 to LICENSE of all versions to fix bug #426122.