tor.service does not start properly

Sometimes, nyx says that tor is not running. This may be because tor must be started as user “tor”, otherwise starting of `tor.service` fails and exits with errors. Here is how to fix this.

Diagnostics

First we should check for more info why tor does not start properly. For this, check systemctl status tor and – if this does not help – journalctl -xe. In the journal, this error appears:

[warn] /var/lib/tor is not owned by this user (root, 0) but by tor (43). Perhaps you are running Tor as the wrong user?

Solution: Run tor.service as user tor

Edit /usr/lib/systemd/system/tor.service and make sure that in the [Service]-section, the User and Group is included:

[Service]

Type=notify

User=tor

Group=tor

NotifyAccess=all

ExecStartPre=/usr/bin/tor -f /etc/tor/torrc —verify-config

Then save tor.service

Reload tor.service and start tor

Reload tor.service with systemctl daemon-reload and try to start it with systemctl start tor.

Tor.service should start without errors, and also nyx should work now. Yay!