Bug#642325: [tor] /etc/init.d/tor refuses to start, complaining about /var/run/tor directory

2011-09-22 Thread ras

> Ok, that script looks like it creates /var/run/tor - what happens when
> you remove the one you created and try to run the init script? 

All is fine now. Thanks. Tor still complains about wrong permissions of 
/var/run/tor directory when started by vidalia under regular user,
but that is completely different issue, I guess:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=642223




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#642325: [tor] /etc/init.d/tor refuses to start, complaining about /var/run/tor directory

2011-09-22 Thread Dererk
On 21/09/11 21:11, ras wrote:
>  
>> Please show me your /etc/init.d/tor script.
> I didn't touch it in any way. Here it is:
> =
> #! /bin/bash
>
> ### BEGIN INIT INFO
> # Provides:  tor
> # Required-Start:$local_fs $remote_fs $network $named $time
> # Required-Stop: $local_fs $remote_fs $network $named $time
> # Should-Start:  $syslog
> # Should-Stop:   $syslog
> # Default-Start: 2 3 4 5
> # Default-Stop:  0 1 6
> # Short-Description: Starts The Onion Router daemon processes
> # Description:   Start The Onion Router, a TCP overlay
> #network client that provides anonymous
> #transport.
> ### END INIT INFO
>
> set -e
>
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
> DAEMON=/usr/sbin/tor
> NAME=tor
> DESC="tor daemon"
> TORPIDDIR=/var/run/tor
> TORPID=$TORPIDDIR/tor.pid
> DEFAULTSFILE=/etc/default/$NAME
> WAITFORDAEMON=60
> ARGS=""
> # Let's try to figure our some sane defaults:
> if [ -r /proc/sys/fs/file-max ]; then
>   system_max=`cat /proc/sys/fs/file-max`
>   if [ "$system_max" -gt "8" ] ; then
>   MAX_FILEDESCRIPTORS=32768
>   elif [ "$system_max" -gt "4" ] ; then
>   MAX_FILEDESCRIPTORS=16384
>   elif [ "$system_max" -gt "1" ] ; then
>   MAX_FILEDESCRIPTORS=8192
>   else
>   MAX_FILEDESCRIPTORS=1024
>   cat << EOF
>
> Warning: Your system has very few filedescriptors available in total.
>
> Maybe you should try raising that by adding 'fs.file-max=10' to your
> /etc/sysctl.conf file.  Feel free to pick any number that you deem 
> appropriate.
> Then run 'sysctl -p'.  See /proc/sys/fs/file-max for the current value, and
> file-nr in the same directory for how many of those are used at the moment.
>
> EOF
>   fi
> else
>   MAX_FILEDESCRIPTORS=8192
> fi
>
> NICE=""
>
> test -x $DAEMON || exit 0
>
> # Include tor defaults if available
> if [ -f $DEFAULTSFILE ] ; then
>   . $DEFAULTSFILE
> fi
>
> wait_for_deaddaemon () {
>   pid=$1
>   sleep 1
>   if test -n "$pid"
>   then
>   if kill -0 $pid 2>/dev/null
>   then
>   echo -n "."
>   cnt=0
>   while kill -0 $pid 2>/dev/null
>   do
>   cnt=`expr $cnt + 1`
>   if [ $cnt -gt $WAITFORDAEMON ]
>   then
>   echo " FAILED."
>   return 1
>   fi
>   sleep 1
>   echo -n "."
>   done
>   fi
>   fi
>   return 0
> }
>
>
> check_torpiddir () {
>   if test ! -d $TORPIDDIR; then
>   #echo "There is no $TORPIDDIR directory.  Creating one for you."
>   mkdir -m 02750 "$TORPIDDIR"
>   chown debian-tor:debian-tor "$TORPIDDIR"
>   fi
>
>   if test ! -x $TORPIDDIR; then
>   echo "Cannot access $TORPIDDIR directory, are you root?" >&2
>   exit 1
>   fi
> }
>
> check_config () {
>   if ! $DAEMON --verify-config > /dev/null; then
>   echo "ABORTED: Tor configuration invalid:" >&2
>   $DAEMON --verify-config >&2
>   exit 1
>   fi
> }
>
>
> case "$1" in
>   start)
>   if [ "$RUN_DAEMON" != "yes" ]; then
>   echo "Not starting $DESC (Disabled in $DEFAULTSFILE)."
>   exit 0
>   fi
>
>   if [ -n "$MAX_FILEDESCRIPTORS" ]; then
>   echo -n "Raising maximum number of filedescriptors (ulimit -n) 
> to $MAX_FILEDESCRIPTORS"
>   if ulimit -n "$MAX_FILEDESCRIPTORS" ; then
>   echo "."
>   else
>   echo ": FAILED."
>   fi
>   fi
>
>   check_torpiddir
>
>   echo "Starting $DESC: $NAME..."
>   check_config
>
>   start-stop-daemon --start --quiet --oknodo \
>   --pidfile $TORPID \
>   $NICE \
>   --exec $DAEMON -- $ARGS
>   echo "done."
>   ;;
>   stop)
>   echo -n "Stopping $DESC: "
>   pid=`cat $TORPID 2>/dev/null` || true
>
>   if test ! -f $TORPID -o -z "$pid"; then
>   echo "not running (there is no $TORPID)."
>   exit 0
>   fi
>
>   if start-stop-daemon --stop --signal INT --quiet --pidfile $TORPID 
> --exec $DAEMON; then
>   wait_for_deaddaemon $pid
>   echo "$NAME."
>   elif kill -0 $pid 2>/dev/null
>   then
>   echo "FAILED (Is $pid not $NAME?  Is $DAEMON a different binary 
> now?)."
>   else
>   echo "FAILED ($DAEMON died: process $pid not running; or 
> permission denied)."
>   fi
>   ;;
>   reload|force-reload)
>   echo -n "Reloading 

Bug#642325: [tor] /etc/init.d/tor refuses to start, complaining about /var/run/tor directory

2011-09-21 Thread Peter Palfrader
On Thu, 22 Sep 2011, ras wrote:

>  
> > Please show me your /etc/init.d/tor script.
> 
> I didn't touch it in any way. Here it is:

Ok, that script looks like it creates /var/run/tor - what happens when
you remove the one you created and try to run the init script?  If it
doesn't work, try with bash -x /etc/init.d/tor.

> check_torpiddir () {
>   if test ! -d $TORPIDDIR; then
>   #echo "There is no $TORPIDDIR directory.  Creating one for you."
>   mkdir -m 02750 "$TORPIDDIR"
>   chown debian-tor:debian-tor "$TORPIDDIR"
>   fi

-- 
   |  .''`.   ** Debian **
  Peter Palfrader  | : :' :  The  universal
 http://www.palfrader.org/ | `. `'  Operating System
   |   `-http://www.debian.org/



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#642325: [tor] /etc/init.d/tor refuses to start, complaining about /var/run/tor directory

2011-09-21 Thread ras
 
> Please show me your /etc/init.d/tor script.

I didn't touch it in any way. Here it is:
=
#! /bin/bash

### BEGIN INIT INFO
# Provides:  tor
# Required-Start:$local_fs $remote_fs $network $named $time
# Required-Stop: $local_fs $remote_fs $network $named $time
# Should-Start:  $syslog
# Should-Stop:   $syslog
# Default-Start: 2 3 4 5
# Default-Stop:  0 1 6
# Short-Description: Starts The Onion Router daemon processes
# Description:   Start The Onion Router, a TCP overlay
#network client that provides anonymous
#transport.
### END INIT INFO

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/tor
NAME=tor
DESC="tor daemon"
TORPIDDIR=/var/run/tor
TORPID=$TORPIDDIR/tor.pid
DEFAULTSFILE=/etc/default/$NAME
WAITFORDAEMON=60
ARGS=""
# Let's try to figure our some sane defaults:
if [ -r /proc/sys/fs/file-max ]; then
system_max=`cat /proc/sys/fs/file-max`
if [ "$system_max" -gt "8" ] ; then
MAX_FILEDESCRIPTORS=32768
elif [ "$system_max" -gt "4" ] ; then
MAX_FILEDESCRIPTORS=16384
elif [ "$system_max" -gt "1" ] ; then
MAX_FILEDESCRIPTORS=8192
else
MAX_FILEDESCRIPTORS=1024
cat << EOF

Warning: Your system has very few filedescriptors available in total.

Maybe you should try raising that by adding 'fs.file-max=10' to your
/etc/sysctl.conf file.  Feel free to pick any number that you deem appropriate.
Then run 'sysctl -p'.  See /proc/sys/fs/file-max for the current value, and
file-nr in the same directory for how many of those are used at the moment.

EOF
fi
else
MAX_FILEDESCRIPTORS=8192
fi

NICE=""

test -x $DAEMON || exit 0

# Include tor defaults if available
if [ -f $DEFAULTSFILE ] ; then
. $DEFAULTSFILE
fi

wait_for_deaddaemon () {
pid=$1
sleep 1
if test -n "$pid"
then
if kill -0 $pid 2>/dev/null
then
echo -n "."
cnt=0
while kill -0 $pid 2>/dev/null
do
cnt=`expr $cnt + 1`
if [ $cnt -gt $WAITFORDAEMON ]
then
echo " FAILED."
return 1
fi
sleep 1
echo -n "."
done
fi
fi
return 0
}


check_torpiddir () {
if test ! -d $TORPIDDIR; then
#echo "There is no $TORPIDDIR directory.  Creating one for you."
mkdir -m 02750 "$TORPIDDIR"
chown debian-tor:debian-tor "$TORPIDDIR"
fi

if test ! -x $TORPIDDIR; then
echo "Cannot access $TORPIDDIR directory, are you root?" >&2
exit 1
fi
}

check_config () {
if ! $DAEMON --verify-config > /dev/null; then
echo "ABORTED: Tor configuration invalid:" >&2
$DAEMON --verify-config >&2
exit 1
fi
}


case "$1" in
  start)
if [ "$RUN_DAEMON" != "yes" ]; then
echo "Not starting $DESC (Disabled in $DEFAULTSFILE)."
exit 0
fi

if [ -n "$MAX_FILEDESCRIPTORS" ]; then
echo -n "Raising maximum number of filedescriptors (ulimit -n) 
to $MAX_FILEDESCRIPTORS"
if ulimit -n "$MAX_FILEDESCRIPTORS" ; then
echo "."
else
echo ": FAILED."
fi
fi

check_torpiddir

echo "Starting $DESC: $NAME..."
check_config

start-stop-daemon --start --quiet --oknodo \
--pidfile $TORPID \
$NICE \
--exec $DAEMON -- $ARGS
echo "done."
;;
  stop)
echo -n "Stopping $DESC: "
pid=`cat $TORPID 2>/dev/null` || true

if test ! -f $TORPID -o -z "$pid"; then
echo "not running (there is no $TORPID)."
exit 0
fi

if start-stop-daemon --stop --signal INT --quiet --pidfile $TORPID 
--exec $DAEMON; then
wait_for_deaddaemon $pid
echo "$NAME."
elif kill -0 $pid 2>/dev/null
then
echo "FAILED (Is $pid not $NAME?  Is $DAEMON a different binary 
now?)."
else
echo "FAILED ($DAEMON died: process $pid not running; or 
permission denied)."
fi
;;
  reload|force-reload)
echo -n "Reloading $DESC configuration: "
pid=`cat $TORPID 2>/dev/null` || true

if test ! -f $TORPID -o -z "$pid"; then
echo "not running (there is no $T

Bug#642325: [tor] /etc/init.d/tor refuses to start, complaining about /var/run/tor directory

2011-09-21 Thread Peter Palfrader
On Wed, 21 Sep 2011, ras wrote:

> Package: tor
> Version: 0.2.2.32-1
> Severity: normal
> 
> "# invoke-rc.d tor start" command refuses to start tor, complaining about 
> wrong permissions of /var/run/tor directory:
> "the directory "/var/run/tor" needs to exist, and to be accessible only by 
> the user and group account that is running Tor." 
> 
> I should notice, that no such directory existed before, so I created it and 
> assigned needed permissions. Before that tor was complaining about missing 
> directory.
> So, now
> $ ls -ld /var/run/tor
> drwxrwx--- 2 debian-tor debian-tor 40 Sep 20 20:51 /var/run/tor

You shouldn't have to.

Please show me your /etc/init.d/tor script.


> But if I do
> # invoke-rc.d tor start
> 
> it fails:
> 
> Raising maximum number of filedescriptors (ulimit -n) to 32768.
> Starting tor daemon: tor...
> Sep 21 22:13:49.495 [notice] Tor v0.2.2.32 (git-84a279ff87e5bfea). This is 
> experimental software. Do not rely on it for strong anonymity. (Running on 
> Linux x86_64)
> Sep 21 22:13:49.497 [notice] Initialized libevent version 1.4.14b-stable 
> using method epoll. Good.
> Sep 21 22:13:49.497 [notice] Opening Socks listener on 127.0.0.1:9050
> Sep 21 22:13:49.497 [warn] Permissions on directory /var/run/tor are too 
> permissive.
> Sep 21 22:13:49.498 [warn] Before Tor can create a control socket in 
> "/var/run/tor/control", the directory "/var/run/tor" needs to exist, and to 
> be accessible only by the user and group account that is running Tor.  (On 
> some Unix systems, anybody who can list a socket can conect to it, so Tor is 
> being careful.)
> Sep 21 22:13:49.498 [notice] Closing partially-constructed listener Socks 
> listener on 127.0.0.1:9050
> Sep 21 22:13:49.498 [warn] Failed to parse/validate config: Failed to bind 
> one of the listener ports.
> Sep 21 22:13:49.498 [err] Reading config failed--see warnings above.
> invoke-rc.d: initscript tor, action "start" failed.

please show me the output of 'getent passwd debian-tor' and
'getent group debian-tor'.  Also run ls -ld /var/run/tor for me one more
time.

-- 
   |  .''`.   ** Debian **
  Peter Palfrader  | : :' :  The  universal
 http://www.palfrader.org/ | `. `'  Operating System
   |   `-http://www.debian.org/



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#642325: [tor] /etc/init.d/tor refuses to start, complaining about /var/run/tor directory

2011-09-21 Thread ras
Package: tor
Version: 0.2.2.32-1
Severity: normal

"# invoke-rc.d tor start" command refuses to start tor, complaining about wrong 
permissions of /var/run/tor directory:
"the directory "/var/run/tor" needs to exist, and to be accessible only by the 
user and group account that is running Tor." 

I should notice, that no such directory existed before, so I created it and 
assigned needed permissions. Before that tor was complaining about missing 
directory.
So, now
$ ls -ld /var/run/tor
drwxrwx--- 2 debian-tor debian-tor 40 Sep 20 20:51 /var/run/tor

But if I do
# invoke-rc.d tor start

it fails:

Raising maximum number of filedescriptors (ulimit -n) to 32768.
Starting tor daemon: tor...
Sep 21 22:13:49.495 [notice] Tor v0.2.2.32 (git-84a279ff87e5bfea). This is 
experimental software. Do not rely on it for strong anonymity. (Running on 
Linux x86_64)
Sep 21 22:13:49.497 [notice] Initialized libevent version 1.4.14b-stable using 
method epoll. Good.
Sep 21 22:13:49.497 [notice] Opening Socks listener on 127.0.0.1:9050
Sep 21 22:13:49.497 [warn] Permissions on directory /var/run/tor are too 
permissive.
Sep 21 22:13:49.498 [warn] Before Tor can create a control socket in 
"/var/run/tor/control", the directory "/var/run/tor" needs to exist, and to be 
accessible only by the user and group account that is running Tor.  (On some 
Unix systems, anybody who can list a socket can conect to it, so Tor is being 
careful.)
Sep 21 22:13:49.498 [notice] Closing partially-constructed listener Socks 
listener on 127.0.0.1:9050
Sep 21 22:13:49.498 [warn] Failed to parse/validate config: Failed to bind one 
of the listener ports.
Sep 21 22:13:49.498 [err] Reading config failed--see warnings above.
invoke-rc.d: initscript tor, action "start" failed.


--- System information. ---
Architecture: amd64
Kernel:   Linux 3.0.4-custom-1

Debian Release: wheezy/sid
  500 testing ftp.de.debian.org 

--- Package information. ---
Depends  (Version) | Installed
==-+-
libc6 (>= 2.8) | 2.13-18
libevent-1.4-2 (>= 1.4.14b-stable) | 1.4.14b-stable-1
libssl1.0.0 (>= 1.0.0) | 1.0.0d-3
zlib1g(>= 1:1.1.4) | 1:1.2.3.4.dfsg-3
adduser| 3.113


Recommends   (Version) | Installed
==-+-===
polipo (>= 1)  | 1.0.4.1-1.1
 OR privoxy| 
socat  | 1.7.1.3-1.1
logrotate  | 3.7.8-6
tor-geoipdb| 0.2.2.32-1
torsocks   | 1.1+git20110826-1
 OR tsocks | 1.8beta5-9.1


Suggests   (Version) | Installed
-+-===
mixmaster| 
xul-ext-torbutton| 1.4.1-1







-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org