Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 272527 - net-misc/tor-0.2.0.34-r2: failed to start the 2nd time
Summary: net-misc/tor-0.2.0.34-r2: failed to start the 2nd time
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gustavo Felisberto (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-04 05:29 UTC by Thomas Jäger
Modified: 2009-06-13 01:15 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Ebuild patch with extended uid:gid settings (tor.patch,874 bytes, text/plain)
2009-06-09 13:21 UTC, Christian Faulhammer (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Jäger 2009-06-04 05:29:36 UTC
When starting tor the first time everything seems to be ok. When stopping and starting it again the start fails.

# /etc/init.d/tor stop
# /etc/init.d/tor start
 * Tor configuration (/etc/tor/torrc) not valid.
Jun 04 07:27:35.449 [notice] Tor v0.2.0.34 (r18423). This is experimental software. Do not rely on it for strong anonymity. (Running on Linux x86_64)
Jun 04 07:27:35.450 [notice] Your ContactInfo config option is not set. Please consider setting it, so we can contact you if your server is misconfigured or something else goes wrong.
Jun 04 07:27:35.450 [warn] /var/lib/tor/data is not owned by this user (tor, 107) but by root (0). Perhaps you are running Tor as the wrong user?
Jun 04 07:27:35.450 [warn] Failed to parse/validate config: Couldn't access/create private data directory "/var/lib/tor/data"
Jun 04 07:27:35.450 [err] Reading config failed--see warnings above.


The process tor was not running as user tor (as assumed)

# ps -ef
[...]
root     11398     1  0 07:19 ?        00:00:01 /usr/bin/tor --runasdaemon 1 --P
[...]


The tor data isnt owned by tor:

# ls -l /var/lib/tor
total 4
drwx------ 3 root root 4096 Jun  4 07:19 data



Reproducible: Always

Steps to Reproduce:
1. /etc/init.d/tor start  (1st time)
2. /etc/init.d/tor stop
3. /etc/init.d/tor start  (2nd time)
Comment 1 haarp 2009-06-04 11:49:46 UTC
Funnily enough, it's exactly the other way around for me (having had Tor installed for a while now, just upgrading)

"/var/lib/tor/data is not owned by this user (root, 0) but by tor (107). Perhaps you are running Tor as the wrong user?"
Comment 2 haarp 2009-06-04 12:10:43 UTC
Now that I just deleted /var/lib/tor/data, I'm experiencing the same bug as described in the first comment.

Interestingly, tor will work just fine with a /var/lib/tor/data belonging to root when started manually with the same command as in the init script:
start-stop-daemon --start --user tor --pidfile "${PIDFILE}" --quiet --exec /usr/bin/tor  -- --runasdaemon 1 --PidFile "${PIDFILE}"
(of course, don't forget to point $PIDFILE somewhere before trying)
Comment 3 Sebastian 2009-06-05 12:31:13 UTC
I got an issue with /var/lib/tor/data as well. But for me tor doesn't at all ... only when I remove the data. Strangely then tor runs as root:

8645 root      20   0  9132 6092 2420 S 25.9  1.2   0:02.38 tor

So no wonder the "data" directory belongs to "root".

I got:  start-stop-daemon --start --user tor --pidfile "${PIDFILE}" --quiet --exec /usr/bin/tor  -- --runasdaemon 1 --PidFile "${PIDFILE}" > /dev/null 2>&1

Portage 2.1.6.11 (default/linux/x86/2008.0/desktop, gcc-4.3.2, glibc-2.8_p20080602-r1, 2.6.29.4 i686)
=================================================================
System uname: Linux-2.6.29.4-i686-Intel-R-_Pentium-R-_M_processor_1400MHz-with-glibc2.0
Timestamp of tree: Fri, 05 Jun 2009 11:45:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p39
dev-lang/python:     2.5.4-r2
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.6.4
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 1.7.9-r1, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium-m -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=pentium-m -pipe"
DISTDIR="/home/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps y"
FEATURES="ccache distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.cambrium.nl/pub/os/linux/gentoo/ http://mirror.ovh.net/gentoo-distfiles/"
LDFLAGS="-Wl,-O1"
LINGUAS="en de es en_US es_ES"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/home"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac acpi aio alsa applet archive berkdb bluetooth bzip2 cairo caps cblas cdaudio cdr cli consolekit cracklib crypt cups dbus dvd dvdr dvdread dvi dynamic eds emboss encode evo exif fam ffmpeg fftw firefox fontconfig fortran gcrypt gd gdbm gdm gedit gif glib gnome gnome-keyring gnutls gpac grammar gs gsl gtk gtkhtml hal hunspell iconv id3 id3tag imagemagick isdnlog john jpeg kde kpathsea lame lcms libgda libnotify libsamplerate libsysfs logrotate lzma lzo mad math midi mikmod mjpeg mmap mmx mmxext mp3 mpeg mpeg2 mudflap multiuser nautilus ncurses neXt nls nptl nptlonly ots pam pccts pch pcre pdf perl png ppds pppd pth python qt3support rar readline reflection rtsp sasl session sndfile sox spell spl sse sse2 ssl startup-notification svg sysfs t1lib taglib thesaurus threads tiff truetype unicode usb vim-syntax wifi wireshark wmf wordperfect x264 x86 xft xml xmp xorg xpm xulrunner xv xvid zlib zvbi" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en de es en_US es_ES" USERLAND="GNU" VIDEO_CARDS="radeon"
Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LANG, LC_ALL, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 4 Christian Faulhammer (RETIRED) gentoo-dev 2009-06-08 17:19:40 UTC
Do you still have Tor user and group settings in your /etc/tor/torrc file?
Comment 5 haarp 2009-06-08 17:22:24 UTC
No, I removed them because the sample config file got it removed aswell. Figured users are handled by start-stop-daemon now.
Comment 6 Christian Faulhammer (RETIRED) gentoo-dev 2009-06-08 18:04:03 UTC
(In reply to comment #5)
> No, I removed them because the sample config file got it removed aswell.
> Figured users are handled by start-stop-daemon now.

 I would like you to remove /var/lib/tor and remerge tor.  Does that help?  I have no problems so far and I tested really carefully.  /var/lib/tor needs to have tor:tor as owner setting, just by the way.
Comment 7 haarp 2009-06-08 18:46:36 UTC
No deal. My torrc is exactly the sample file, plus custom exitnodes, nothing more.

After deleting said folder and re-emerging tor, I've got /var/lib/tor owned by tor:tor. I now start tor via init script and it creates /var/lib/tor/data, owned by root:root. Tor itself is running as root.
When I try to restart tor now it fails with the error mentioned at the beginning of this bug report.
When started like in comment 2, it will still start as root, but accept the root-owned /var/lib/data and chuck along nicely.
Comment 8 Christian Faulhammer (RETIRED) gentoo-dev 2009-06-08 19:56:30 UTC
Are all of you running Baselayout 1?
Comment 9 haarp 2009-06-08 19:58:39 UTC
baselayout-1.12.11.1 for me.
Comment 10 Thomas Jäger 2009-06-08 20:26:35 UTC
I'm running baselayout-1.2.11.1
Comment 11 Christian Faulhammer (RETIRED) gentoo-dev 2009-06-09 13:21:08 UTC
Created attachment 193993 [details]
Ebuild patch with extended uid:gid settings

Ok, that seems to be the problem as I run Baselayout 2 on a stable system.  Please delete the /var/lib/tor directory, apply attached patch to the ebuild and remerge.  The failure is caused by the configuration check which is called for the user tor.
Comment 12 haarp 2009-06-09 14:31:52 UTC
Did that, now tor silently fails to start. After removing the redirection to /dev/null in the intiscript to see the log, I got this:

/var/lib/tor/data is not owned by this user (root, 0) but by tor (107). Perhaps you are running Tor as the wrong user?

now I'm confused...
Comment 13 Christian Faulhammer (RETIRED) gentoo-dev 2009-06-12 01:07:46 UTC
I reverted my changes.  Sorry for the trouble, thanks for the patience and report.
Comment 14 haarp 2009-06-13 01:15:11 UTC
Well, my guess would have been that somehow, start-stop-daemon launches tor as root, but tor itself falls back to tor again at a later time...or something...

But never mind that. thanks for 'fixing'.