CentOS 9 Tor relay setup keeps getting this error

So on CentOS 9 im trying to set up a relay, but whenever i try to start/restart tor it results in an error. I tried to find solutions online, but couldn’t find any. Here’s the logs from journalctl -xeu tor.service

Subject: Unit failed
Defined-By: systemd
Support: Red Hat Customer Experience & Engagement - Red Hat Customer Portal

The unit tor.service has entered the ‘failed’ state with result ‘exit-code’.
Apr 14 19:46:40 ip-172-26-6-114.ap-northeast-1.compute.internal systemd[1]: Failed to start Anonymizing overlay network for TCP.
Subject: A start job for unit tor.service has failed
Defined-By: systemd
Support: Red Hat Customer Experience & Engagement - Red Hat Customer Portal

A start job for unit tor.service has finished with a failure.
The job identifier is 1734 and the job result is failed.
Apr 14 19:46:41 ip-172-26-6-114.ap-northeast-1.compute.internal systemd[1]: tor.service: Scheduled restart job, restart counter is at 5.
Subject: Automatic restarting of a unit has been scheduled
Defined-By: systemd
Support: Red Hat Customer Experience & Engagement - Red Hat Customer Portal

Automatic restarting of the unit tor.service has been scheduled, as the result for the configured Restart= setting for the unit.
Apr 14 19:46:41 ip-172-26-6-114.ap-northeast-1.compute.internal systemd[1]: Stopped Anonymizing overlay network for TCP.
Subject: A stop job for unit tor.service has finished
Defined-By: systemd
Support: Red Hat Customer Experience & Engagement - Red Hat Customer Portal

A stop job for unit tor.service has finished.
The job identifier is 1797 and the job result is done.
Apr 14 19:46:41 ip-172-26-6-114.ap-northeast-1.compute.internal systemd[1]: tor.service: Start request repeated too quickly.
Apr 14 19:46:41 ip-172-26-6-114.ap-northeast-1.compute.internal systemd[1]: tor.service: Failed with result ‘exit-code’.
Subject: Unit failed
Defined-By: systemd
Support: Red Hat Customer Experience & Engagement - Red Hat Customer Portal

The unit tor.service has entered the ‘failed’ state with result ‘exit-code’.
Apr 14 19:46:41 ip-172-26-6-114.ap-northeast-1.compute.internal systemd[1]: Failed to start Anonymizing overlay network for TCP.
Subject: A start job for unit tor.service has failed
Defined-By: systemd
Support: Red Hat Customer Experience & Engagement - Red Hat Customer Portal

A start job for unit tor.service has finished with a failure.
The job identifier is 1797 and the job result is failed.

Whenever I got this problem in the past (doesn’t matter the OS) it had to do with the torrc config file. If I had to bet on it, I’d say it is some bad config or typo.

Kindly share your configuration here (censor any information you may consider relevant for you).

If torrc is fine, the next thing I’d check are directory and files permissions.

Nickname [thename]
ORPort 443
ContactInfo [myemail]
SocksPort 0
ExitRelay 0
ControlPort 5009
···

On Mon, Apr 15, 2024 at 4:04 PM capole via Tor Project Forum <noreply@forum.torproject.org> wrote:

| capole
April 15 |

  • | - |

Whenever I got this problem in the past (doesn’t matter the OS) it had to do with the torrc config file. If I had to bet on it, I’d say it is some bad config or typo.

Kindly share your configuration here (censor any information you may consider relevant for you).

If torrc is fine, the next thing I’d check are directory and files permissions.


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

Also, this same error came even when I tried in fedora and rhel

···

On Mon, Apr 15, 2024 at 4:17 PM Redacted4ever-2 <serveroverseercouncil@gmail.com> wrote:

Nickname [thename]
ORPort 443
ContactInfo [myemail]
SocksPort 0
ExitRelay 0
ControlPort 5009

On Mon, Apr 15, 2024 at 4:04 PM capole via Tor Project Forum <noreply@forum.torproject.org> wrote:

| capole
April 15 |

  • | - |

Whenever I got this problem in the past (doesn’t matter the OS) it had to do with the torrc config file. If I had to bet on it, I’d say it is some bad config or typo.

Kindly share your configuration here (censor any information you may consider relevant for you).

If torrc is fine, the next thing I’d check are directory and files permissions.


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

It may be that the ORPort is not open. Check if you have a firewall blocking the ORPort. Additionally, if you will post the contents of the following: cat /var/log/syslog | grep ‘Tor’

I checked the firewall, port 443 is open. And when i ran cat /var/log/syslog | grep ‘Tor’ it just says cat: /var/log/syslog: No such file or directory

···

On Mon, Apr 15, 2024 at 8:55 PM Sunshinecowboy via Tor Project Forum <noreply@forum.torproject.org> wrote:

| sunshinecowboy
April 15 |

  • | - |

It may be that the ORPort is not open. Check if you have a firewall blocking the ORPort. Additionally, if you will post the contents of the following: cat /var/log/syslog | grep ‘Tor’


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

The journalctl logs were a bit different this time, I think this might be the issue, I don’t know for sure.

Ahhh, it looks like your user permissions aren’t set correctly. So We can confirm this is the issue, can you paste the contents of /var/log/Tor/log ?

/var/log does not exist.
Log folder does not exist.

Make sure the user tor exists by checking your /etc/passwd file. If it doesn’t create a new one by: sudo useradd -d /var/lib/tor -s /bin/false -g tor

Then make sure tor has ownership of /var/lib/tor by: sudo ls -la /var/lib/tor
if not do: sudo chown -R tor:tor /var/lib/tor

Now finally add the following lines to /etc/tor/torrc:

User tor
Log notice syslog
DataDirectory /var/lib/tor
CookieAuthentication 1

Finally, let’s cleanly restart the systemd service:

sudo systemctl enable tor
sudo systemctl start tor

If everything works you should be able to check your relay by installing nyx, if it’s not already installed, and typing: nyx -i 127.0.0.1:[your_control_port]

If it doesn’t work now you should get a reading from: sudo cat /var/log/syslog | grep 'Tor'

t worked thanks! I guess the user was not created this whole time then.

···

On Thu, Apr 18, 2024 at 2:25 AM Sunshinecowboy via Tor Project Forum <noreply@forum.torproject.org> wrote:

| sunshinecowboy
April 17 |

  • | - |

Make sure the user tor exists by checking your /etc/passwd file. If it doesn’t create a new one by: sudo useradd -d /var/lib/tor -s /usr/sbin/nologin -g tor

Then make sure tor has ownership of /var/lib/tor by: sudo ls -la /var/lib/tor
if not do: sudo chown -R tor:tor /var/lib/tor

Now finally add the following lines to /etc/tor/torrc:

User tor
Log notice syslog
DataDirectory /var/lib/tor
CookieAuthentication 1

Finally, let’s cleanly restart the systemd service:

sudo systemctl enable tor
sudo systemctl start tor

If everything works you should be able to check your relay by installing nyx, if it’s not already installed, and typing: nyx -i 127.0.0.1:[your_control_port]

If it doesn’t work now you should get a reading from: sudo cat /var/log/syslog | grep 'Tor'


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

1 Like

CentOS will often create the default user ‘toranon’ for which you would just need to replace the user ‘tor’ with in the steps above.