Ubuntu – TOR process will not start automatically on Ubuntu 16.04

16.04PROXYtor

I am trying to install TOR on a new server running Ubuntu 16.04. This worked for me several times in the past. I use the following command:

sudo apt-get install tor

Unfortunately, the tor process does not seem to be running at all. When I do "ps aux | grep tor" all I get is:

1322  0.0  0.0  14512  1020 pts/0    S+   12:19   0:00 grep --color=auto tor

Interestingly, when I do "systemctl status tor", I get the following:

tor.service - Anonymizing overlay network for TCP (multi-instance-master)
   Loaded: loaded (/lib/systemd/system/tor.service; enabled; vendor preset: enabled)
   Active: active (exited) since Sun 2017-02-12 12:17:45 UTC; 2min 48s ago
  Process: 428 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 428 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/tor.service

Feb 12 12:17:45 SR332 systemd[1]: Starting Anonymizing overlay network for TCP (multi-instance-master)...
Feb 12 12:17:45 SR332 systemd[1]: Started Anonymizing overlay network for TCP (multi-instance-master).

Any attempt to restart the service shows that it is working fine – but it doesn't. Stopping the service with "sudo systemctl stop tor" changes the status to "loaded", then doing "sudo systemctl start tor" shows as active – yet nothing changes. /var/log/tor/ is completely empty, including when debugging mode is enabled.

Moreover, when I type "tor", either as root or debian-tor (the user created during TOR installation) it starts working. Doing "tor &" basically solves the issue, but it means that the server will not run TOR after it is rebooted, which is a problem for me.
Only when running a tor process manually, is the log starts becoming populated.

Any suggestions would be highly appreciated.

Best Answer

Debian/Ubuntu encourage the use of multiple tor instances on a system as opposed to a single instance. As such, the decision was made to make the default instance tor@default as opposed to simple tor. To that end the installed tor.service file is invalid:

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecReload=/bin/true

While Tor is installed with a valid /etc/init.d/tor service script, attempts to use this script on 16.04 result in systemd attempting to load the invalid tor.service instead. Removing or renaming offending file /lib/systemd/system/tor.service and reloading the scripts w/ systemctl daemon-reload will fix the problem.

Alternatively you can use the tor@default instance: E.g. service tor@default start, or you can create new instances with tor-instance-create.