Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 380117 - net-misc/tor fails to start if /var/log/tor is not present
Summary: net-misc/tor fails to start if /var/log/tor is not present
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-21 17:22 UTC by Agostino Sarubbo
Modified: 2011-09-01 19:25 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2011-08-21 17:22:38 UTC
As per $summary, I run tor, stable version; from my shell:

amd64box ~ # /etc/init.d/tor status
 * status: stopped
# Now is stopped

amd64box ~ # rm -fr /var/log/tor/
# I remove log direcotry

amd64box ~ # /etc/init.d/tor start
tor             | * Tor configuration (/etc/tor/torrc) is valid.
tor             | * Starting Tor ...                                                                 [ !! [34m]
tor             | * ERROR: tor failed to start
#I try to start and fails

amd64box ~ # mkdir /var/log/tor
# I create a directory bu won't start because it should have tor:tor permissions

amd64box ~ # /etc/init.d/tor start
tor             | * Tor configuration (/etc/tor/torrc) is valid.
tor             | * Starting Tor ...                                                                 [ !! ]
tor             | * ERROR: tor failed to start
amd64box ~ # chown tor:tor /var/log/tor/
#change permission

amd64box ~ # /etc/init.d/tor start
tor             | * Tor configuration (/etc/tor/torrc) is valid.
tor             | * Starting Tor ...                                                                 [ ok ]
#Now it works
Comment 1 Anthony Basile gentoo-dev 2011-08-27 00:25:19 UTC
I've been talking with WilliamH and others, and we're not sure about whether the init scripts should be responsible for creating /var/log.  My gut reaction is that, if a file or directory is installed by the ebuild and the user deletes it, then expect breakage.  I know some people mount /var/log as a tmpfs system, but I think this is done at one's own risk.

I'm cc-ing the base-system herd to see what the general consensus is.  I'm not sure if there's a POSIX standard here.
Comment 2 SpanKY gentoo-dev 2011-08-28 22:34:16 UTC
POSIX says nothing of filesystem layout.  we're not talking about /var/log/ here, but /var/log/tor/.

i wonder why tor is even writing to logs itself.  it should be using syslog like any sane daemon.
Comment 3 Anthony Basile gentoo-dev 2011-08-29 11:41:57 UTC
(In reply to comment #2)
> POSIX says nothing of filesystem layout.  we're not talking about /var/log/
> here, but /var/log/tor/.
> 
> i wonder why tor is even writing to logs itself.  it should be using syslog
> like any sane daemon.

It can log via syslog.  The choice is there to log to file or syslog, probably because of windows.

You're right though, we should switch to using syslog, not just for this bug, but for other reasons.  I'll get that into a future rev bump.
Comment 4 SpanKY gentoo-dev 2011-08-29 18:22:36 UTC
so let's default to sysloging, and if the user wants to modify their config to log elsewhere, it's now their problem to make sure the relevant dirs exist :)
Comment 5 Anthony Basile gentoo-dev 2011-08-30 14:08:54 UTC
Okay, I just committed tor-0.2.2.32-r1 and tor-0.2.3.2_alpha-r3.  Both of these use syslog for logging and don't even try to create /var/log/tor.  Also, to avoid the same problem with /var/run/tor, I added checkvarrun() to the init script.  The ebuild still creates /var/run/tor and gives it the correct ownership/perms, but in case it gets deleted (eg /var/run is tmpfs) the init scripts will recreate it.

Please test, especially since upstream just bumped their stable from 0.2.1 to 0.2.2 branch.  This means tor-0.2.2.32-r1 is the next candidate for stabilization in 30 days.  Lots of stuff changing here, so I'd like it well tested before I submit a stablereq.   (Luckily there's not CVE against current stable so there's no rush, unlike in the past.)
Comment 6 Agostino Sarubbo gentoo-dev 2011-08-30 23:25:42 UTC
The bug stills with metalog, with its default configuration, so probably it should be changed from default?
Comment 7 SpanKY gentoo-dev 2011-08-31 03:35:01 UTC
no idea what you're talking about wrt metalog
Comment 8 Agostino Sarubbo gentoo-dev 2011-09-01 14:38:32 UTC
Ok, tor starts and runs well, but there isn't /var/log/tor
Comment 9 Anthony Basile gentoo-dev 2011-09-01 16:24:25 UTC
(In reply to comment #8)
> Ok, tor starts and runs well, but there isn't /var/log/tor

Correct.  It logs to syslog.  For metalog, look in /var/log/everything/current.

Also, I switched from my own home grown check for /var/run/tor to openrc's checkpath.  Can you test the next two version bumps as well?  Thanks.
Comment 10 Agostino Sarubbo gentoo-dev 2011-09-01 19:25:07 UTC
FIXED

(In reply to comment #9)
> Can you test the next two version bumps as well?  Thanks.

Will be done ;)