Page MenuHomePhabricator

Tor fails after reload related to torrc DisableNetwork setting issue
Closed, ResolvedPublic

Description

whonixsetup or whonix-setup-wizard will run sudo service tor reload. That will exit 0, but Tor will die. sudo service tor status will then show.

● tor.service - LSB: Starts The Onion Router daemon processes
   Loaded: loaded (/etc/init.d/tor)
   Active: active (exited) since Wed 2015-05-20 17:10:03 UTC; 10min ago
  Process: 3468 ExecReload=/etc/init.d/tor reload (code=exited, status=0/SUCCESS)
  Process: 688 ExecStart=/etc/init.d/tor start (code=exited, status=0/SUCCESS)

/var/log/tor/log contains an error message.

May 20 17:34:56.000 [warn] Could not bind to 10.152.152.10:53: Permission denied

Could be an issue in Tor, jessie, anon-gw-anonymizer-config or systemd.

Could be a related misunderstanding on how Tor's configs are supposed to be used:
https://trac.torproject.org/projects/tor/ticket/15261

How to reproduce? (Warning: this following command wipes your whole /etc/tor/torrc.)

sudo su
echo "DisableNetwork 1" > /etc/tor/torrc
sudo service tor restart
sleep 2
echo "DisableNetwork 0" > /etc/tor/torrc
sudo service tor reload

Details

Impact
High

Event Timeline

Patrick raised the priority of this task from to Normal.
Patrick updated the task description. (Show Details)
Patrick set Impact to High.
Patrick added a subscriber: Patrick.

Updated ticket description with instructions on how to reproduce this issue.

Reported a bug upstream.
Tor dies on reload when swichting to 'DisableNetwork 0' when using 'DnsPort 127.0.0.1:53':
https://trac.torproject.org/projects/tor/ticket/16161

Until upstream fixes that bug and until their fix landed in deb.torproject.org, which will take a while... Our options are:

  • a) abstain from using reload and always use restart or
  • b) check if the Tor pid is still running after reload and if it died, start it.
In T320#4855, @Patrick wrote:

Reported a bug upstream.
Tor dies on reload when swichting to 'DisableNetwork 0' when using 'DnsPort 127.0.0.1:53':
https://trac.torproject.org/projects/tor/ticket/16161

Issue was confirmed.

In T320#4856, @Patrick wrote:

Until upstream fixes that bug and until their fix landed in deb.torproject.org, which will take a while... Our options are:

  • a) abstain from using reload and always use restart or
  • b) check if the Tor pid is still running after reload and if it died, start it.

Judging by https://trac.torproject.org/projects/tor/ticket/918 I think it might take quite some time until they fix this issue. Until then, I think for code simplicity we're better off forgetting about reload and just using restart.

Done in whonixsetup,
fix 'Tor fails after reload related to torrc DisableNetwork setting issue' by only restarting Tor, no longer trying to reload Tor - https://phabricator.whonix.org/T320
https://github.com/Whonix/whonixsetup/commit/bc8cb713430a655eb3bb8dd3f8397babce1b6d3e

Patrick changed the task status from Open to Review.May 23 2015, 2:49 PM

fix 'Tor fails after reload related to torrc DisableNetwork setting issue' by only restarting Tor, no longer trying to reload Tor - https://phabricator.whonix.org/T320:
https://github.com/Whonix/whonix-setup-wizard/commit/d5aacf5c58d5aad1c158e589b43d0dd5ccc9cc3f

Tested restart instead of start reload before your post, working. Could not check if that solves the issue at first boot in Whonix Gateway, (tor active, exited) but I guess it does, because a manual sudo service tor restart works.

Patrick claimed this task.

Fixed in Whonix 11.0.0.2.0-developers-only.