[tor-bugs] #16175 [Tor]: when 'sudo service tor reload' fails, Tor exits '0', while it should exit non-zero

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun May 24 18:11:34 UTC 2015


#16175: when 'sudo service tor reload' fails, Tor exits '0', while it should exit
non-zero
--------------------+---------------------
 Reporter:  proper  |          Owner:
     Type:  defect  |         Status:  new
 Priority:  major   |      Milestone:
Component:  Tor     |        Version:
 Keywords:          |  Actual Points:
Parent ID:          |         Points:
--------------------+---------------------
 When {{{sudo service tor reload}}} fails, Tor exits {{{0}}}, while it
 should exit non-zero.

 Using Tor on Debian jessie. Version:

 {{{
 dpkg-query --show --showformat='${Version}' "tor"
 0.2.5.12-1
 }}}

 For reproduction of this issue, you could run the following script as
 root. (Similar to #16161.)

 {{{
 #!/bin/bash

 set -x

 echo '
 DnsPort 127.0.0.1:53
 DisableNetwork 1
 ' > /etc/tor/torrc

 service tor restart

 sleep 2

 echo '
 DnsPort 127.0.0.1:53
 DisableNetwork 0
 ' > /etc/tor/torrc

 service tor reload
 }}}

 Log output:

 {{{
 May 22 22:06:59.000 [notice] Tor 0.2.5.12 (git-3731dd5c3071dcba) opening
 log file.
 May 22 22:06:59.000 [notice] Parsing GEOIP IPv4 file /usr/share/tor/geoip.
 May 22 22:06:59.000 [notice] Parsing GEOIP IPv6 file
 /usr/share/tor/geoip6.
 May 22 22:06:59.000 [notice] Bootstrapped 0%: Starting
 May 22 22:06:59.000 [notice] Delaying directory fetches: DisableNetwork is
 set.
 May 22 22:07:01.000 [notice] Received reload signal (hup). Reloading
 config and resetting internal state.
 May 22 22:07:01.000 [notice] Read configuration file "/usr/share/tor/tor-
 service-defaults-torrc".
 May 22 22:07:01.000 [notice] Read configuration file "/etc/tor/torrc".
 May 22 22:07:01.000 [notice] Opening Socks listener on 127.0.0.1:9050
 May 22 22:07:01.000 [notice] Opening DNS listener on 127.0.0.1:53
 May 22 22:07:01.000 [warn] Could not bind to 127.0.0.1:53: Permission
 denied
 May 22 22:07:01.000 [notice] Closing partially-constructed Socks listener
 on 127.0.0.1:9050
 May 22 22:07:01.000 [warn] Failed to parse/validate config: Failed to bind
 one of the listener ports.
 May 22 22:07:01.000 [err] Reading config failed--see warnings above. For
 usage, try -h.
 May 22 22:07:01.000 [warn] Restart failed (config error?). Exiting.
 }}}

 {{{sudo service tor status}}} output:

 {{{
 ● tor.service - LSB: Starts The Onion Router daemon processes
    Loaded: loaded (/etc/init.d/tor)
    Active: active (exited) since Sun 2015-05-24 18:07:30 UTC; 38s ago
   Process: 9943 ExecStop=/etc/init.d/tor stop (code=exited,
 status=0/SUCCESS)
   Process: 9980 ExecReload=/etc/init.d/tor reload (code=exited,
 status=0/SUCCESS)
   Process: 9956 ExecStart=/etc/init.d/tor start (code=exited,
 status=0/SUCCESS)

 May 24 18:08:06 host Tor[9971]: Closing partially-constructed Socks
 listener on 127.0.0.1:9120
 May 24 18:08:06 host Tor[9971]: Closing partially-constructed Socks
 listener on 127.0.0.1:9121
 May 24 18:08:06 host Tor[9971]: Closing partially-constructed Socks
 listener on 127.0.0.1:9122
 May 24 18:08:06 host Tor[9971]: Closing partially-constructed Socks
 listener on 127.0.0.1:9123
 May 24 18:08:06 host Tor[9971]: Closing partially-constructed Socks
 listener on 127.0.0.1:9124
 May 24 18:08:06 host Tor[9971]: Closing partially-constructed Socks
 listener on 127.0.0.1:9150
 May 24 18:08:06 host Tor[9971]: Closing partially-constructed Transparent
 pf/netfilter listener on 10.152.152.10:9040
 May 24 18:08:06 host Tor[9971]: Failed to parse/validate config: Failed to
 bind one of the listener ports.
 May 24 18:08:06 host Tor[9971]: Reading config failed--see warnings above.
 For usage, try -h.
 May 24 18:08:06 host Tor[9971]: Restart failed (config error?). Exiting.
 }}}

 This is problematic, because then systemd cannot figure out, that Tor
 actually failed. So users cannot rely on {{{sudo service tor status}}} to
 check if the Tor daemon is up and running.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/16175>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list