Package: tinc
Version: 1.1~pre6-1
Severity: normal

Hi,

when using --chroot / --user parameters, tincd cannot remove the pidfile at exit (being the creation of the file before - and the unlink after - the chroot and drop_privs calls). I suspect a proper patch is probably quite intrusive as the pidfile should be placed in a dir writeable by the unprivileged user and residing inside the chroot. On the other side, the config files should stay inside the chroot too, as for the reload functionality.

Attached there's a simple workaround in order to let ifdown cleanly shut down the interface.

-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages tinc depends on:
ii  dpkg          1.16.10
ii  install-info  4.13a.dfsg.1-10
ii  libc6         2.13-38
ii  liblzo2-2     2.06-1
ii  libncurses5   5.9-10
ii  libreadline6  6.2+dfsg-0.1
ii  libssl1.0.0   1.0.1e-2
ii  libtinfo5     5.9-10
ii  zlib1g        1:1.2.7.dfsg-13

tinc recommends no packages.

tinc suggests no packages.

-- Configuration Files:
/etc/default/tinc changed [not included]

-- no debconf information
Thu Apr  4 14:18:04 CEST 2013  Gian Piero Carrubba <[email protected]>
  * workaround for avoiding ifdown exits with rc=1
  when tincd is running with --chroot and/or --user
diff -rN -u old-tinc-1.1~pre6/debian/tinc.if-post-down new-tinc-1.1~pre6/debian/tinc.if-post-down
--- old-tinc-1.1~pre6/debian/tinc.if-post-down	2013-04-04 21:22:40.882845353 +0200
+++ new-tinc-1.1~pre6/debian/tinc.if-post-down	2013-04-04 21:22:40.882845353 +0200
@@ -6,7 +6,8 @@
 	tincctl -n "$IF_TINC_NET" stop
 	sleep 0.1
 	i=0;
-	while [ -f "/var/run/tinc.$IF_TINC_NET.pid" ] ; do
+	pidfile="/var/run/tinc.$IF_TINC_NET.pid"
+	while pgrep -F "$pidfile" -x tincd >/dev/null 2>&1; do
 		if [ $i = '30' ] ; then
 			echo 'Failed to stop tinc daemon!'
 			exit 1
@@ -14,6 +15,7 @@
 		sleep 0.1
 		i=$(($i+1))
 	done
+	rm -f "$pidfile"
 fi
 
 exit 0

Reply via email to