Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
tor can not create pid file
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
SarahS93
l33t
l33t


Joined: 21 Nov 2013
Posts: 693

PostPosted: Wed Jan 03, 2018 3:44 pm    Post subject: tor can not create pid file Reply with quote

If i run tor, it shows me an error that its not possible to create a pid file at /var/run
the problem is "drwxr-xr-x 1 root root 122 1. Nov 00:26 var", no "w" for others.
should i set it myself for write for others or is this an bad idea?
tor runs, thats not the problem, but i will have the pid in a file.
i can change the path to the pid file by the torrc file.
what way shoul i chose?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Wed Jan 03, 2018 4:54 pm    Post subject: Reply with quote

SarahS93 ...

Firstly, /var/run is a symbolic link to /run ... the init script should create the required directory structure with the required permissions:

/etc/init.d/tor:
start_pre() {
    checkconfig || return 1
    checkpath -d -m 0755 -o tor:tor /var/run/tor
}

Sounds as though you may have changed 'PIDFile' to /run, if so then set the following:

/etc/tor/torrc:
PIDFile /run/tor/tor.pid

HTH & best ... khay
Back to top
View user's profile Send private message
SarahS93
l33t
l33t


Joined: 21 Nov 2013
Posts: 693

PostPosted: Wed Jan 03, 2018 5:39 pm    Post subject: Reply with quote

"PIDFile /run/tor/tor.pid" in /etc/tor/torrc brings me again "unable to open /run/tor/tor.pid"
if i write "PIDFile /tmp/tor.pid" - no problems, and i have the tor.pid file.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Wed Jan 03, 2018 6:23 pm    Post subject: Reply with quote

SarahS93 ...

you're starting tor via /etc/init.d/tor? ... because the directory (with correct permissions) should be created. Stop tor, set PIDFile to /run/tor/tor.pid, and start, if it errors then check the presence of /run/tor/

edit to add: I just tested, and the directory should be created, and the permissions set, by the init script

Code:
# /etc/init.d/tor start
 * /var/run/tor: creating directory
 * /var/run/tor: correcting owner
 * Starting tor ...          [OK]

HTH & best ... khay
Back to top
View user's profile Send private message
SarahS93
l33t
l33t


Joined: 21 Nov 2013
Posts: 693

PostPosted: Wed Jan 03, 2018 6:44 pm    Post subject: Reply with quote

Sorry, my mistake, i dont tell you that i run tor not via /etc/init.d/.
I start tor from the console with -f ...torrc, becouse i have four different config files.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Wed Jan 03, 2018 7:42 pm    Post subject: Reply with quote

SarahS93 wrote:
I start tor from the console with -f ...torrc, becouse i have four different config files.

SarahS93 ... ok, well, you should be able to do the following:

Edit /etc/init.d/tor and add the following addition of "configfile":

Code:
command_args="-f \"$configfile\" --hush --runasdaemon 1 --pidfile \"${pidfile}\""
[...]
checkconfig() {
    ${command} -f "$configfile" --verify-config --hush > /dev/null 2>&1
    if [ $? -ne 0 ] ; then
        eerror "Tor configuration (\"$configfile\") is not valid."

Then create a symlink to /etc/init.d/tor for each of the four instances, and create the respective conf.d/tor.<name>:

Code:
# ln -s /etc/init.d/tor /etc/init.d/tor.foo
# ln -s /etc/init.d/tor /etc/init.d/tor.ba
... etc
# echo "configfile=\"/etc/tor/torrc-foo\"" > /etc/conf.d/tor.foo
# echo "configfile=\"/etc/tor/torrc-ba\"" > /etc/conf.d/tor.ba
... etc
# rm -f /etc/conf.d/tor

Your four torrc would then be located under /etc/tor/:

Code:
# ls /etc/tor/
torrc-foo
torrc-ba
torrc-bing
torrc-bang

... and would then start each as '/etc/init.d/tor.<name> start'.

HTH & best ... khay
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Wed Feb 07, 2018 1:46 am    Post subject: Reply with quote

Moved from Multimedia to Other Things Gentoo. Not related to Multimedia.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum