2

While trying to run Stem's To Russia With Love example, I am getting the following error:

~$ python practice.py

Starting Tor:

Traceback (most recent call last):
  File "practice.py", line 49, in <module>
    init_msg_handler = print_bootstrap_lines,
  File "/usr/local/lib/python2.7/dist-packages/stem/process.py", line 266, in launch_tor_with_config
    return launch_tor(tor_cmd, args, torrc_path, completion_percent, init_msg_handler, timeout, take_ownership)
  File "/usr/local/lib/python2.7/dist-packages/stem/process.py", line 143, in launch_tor
    raise OSError('Process terminated: %s' % last_problem)
OSError: Process terminated: Timed out

I was initially getting the path error that was solved over here. I tried restarting the Ubuntu instance (I am running Ubuntu 14.04 in VirtualBox) just in case if any other running tor was conflicting but its giving the same error. Could anyone please help?

EDIT: My torrc file also seems to be empty right now if this is in any way connected.

Community
  • 1
  • 1
QPTR
  • 1,620
  • 7
  • 26
  • 47

1 Answers1

3

It might be failing because you are missing the GeoIP database which is required to use an exit node from a specific country.

Try removing the 'ExitNodes': '{ru}', line from the python script, or since you're on Ubuntu, try sudo apt-get install tor-geoipdb and see if that helps get the connection up and running.

Since it takes time to build the circuits, you can try increasing the timeout a bit as well (though this probably isn't why its failing).

tor_process = stem.process.launch_tor_with_config(
  #tor_cmd = '/usr/bin/tor',
  timeout = 300,
  config = {
    'SocksPort': str(SOCKS_PORT),
#    'ExitNodes': '{ru}',
    'DataDir': '/tmp/tor',
    'Log': [
        'NOTICE file /tmp/tor.notice.log',
        'ERR file /tmp/tor.log',
    ],
  },
  init_msg_handler = print_bootstrap_lines,
)
drew010
  • 68,777
  • 11
  • 134
  • 162
  • Thank you so much !! I installed the tor-geoipdb package, and it still didn't work but I saw the `usr/bin/tor` path inside your code, and I wondered why was I giving the exact path of `tor` inside my installed `tor-browser` folder (when I first installed tor) instead of the `usr/bin/tor` one. I used this and it worked! I do not understand whats the difference between both paths though, and why the first wasn't working when it was also a path to the executable (or seemed so). – QPTR Feb 24 '16 at 09:23