Open FaySmash opened 6 years ago
My first guess is that your tor proxy is binding to a unix socket instead of to localhost, which would explain why zeronet can't connect to it.
You also need to make sure tor is configured to accept control connections: https://www.torproject.org/docs/tor-manual.html.en#ControlPort
My last (least likely) guess is that you have some strange firewall rule that's filtering out connections to port 9051.
Lastly, the reason zeronet is being started without a tor connection is that systemd can't know whether tor and zeronet are correctly configured; it can only know that it launched tor and tor didn't error, which is usually good enough.
EDIT: actually it looks like you're misusing EnvironmentFile
. Remove that line, and add --config /home/pi/ZeroNet-master/zeronet.conf
to the ExecStart
line.
@skwerlman I probably should have mentioned that this config works totally fine if I start it manually through systemctl start zeronet.service. Tor is correctly configured. The firewall is set to accept everything (turned off). The problem seems to be that zeronet simply starts before tor and because tor hasn't finished initialization yet zeronet just starts without it. The proper way would be to check when tor is ready to connect and if the connection fails for a period of time zeronet should just abort the startup. Running without tor even if it's set to always only because tor wasn't ready during zeronets initialization is a terrible configuration.
I've already tried the --config_path parameter but it's unnecessary anyway, zeronet.py looks for the zeronet.conf in the same folder during the initialization anyway. The EnviromentFile variable is unnecessary.
For more discussion of this topic: https://www.reddit.com/r/zeronet/comments/8bjyht/start_and_end_zeronet_per_initd/
Could you try adding Requires=tor.service
? According to this After
allows a service to start even if the service mentioned isn't started, so it seems like both are needed here.
@skwerlman my zeronet.service now looks like this
[Unit]
Description=Zeronet daemon
Requires=tor.service
After=network.target tor.service
[Service]
EnvironmentFile=/home/pi/ZeroNet-master/zeronet.conf
ExecStart=/home/pi/ZeroNet-master/zeronet.py --ui_host 10.0.0.252:43110 misconline.zapto.org
User=pi
TimeoutStopSec=30min
[Install]
WantedBy=multi-user.target
but zeronet still boots up before tor is ready. Also the main part of this opened issue is, that zeronet just connects without tor, even if it's set to always. If I set it to always I want it to only use tor, otherwise stop and disconnect
Step 1: Please describe your environment
Step 2: Describe the problem:
If I start zeronet by a systemd unit on bootup, it doesn't connect to Tor.
Steps to reproduce:
[Service] EnvironmentFile=/home/pi/ZeroNet-master/zeronet.conf ExecStart=/home/pi/ZeroNet-master/zeronet.py --tor always User=
TimeoutStopSec=30min
[Install] WantedBy=multi-user.target
sudo systemctl daemon-reload sudo systemctl enable zeronet.service sudo reboot
[2018-04-14 15:57:15,386] WARNING TorManager Tor controller connect error: error: [Errno 111] Connection refused in TorManager.py line 170 > _socket2.py line 228 [2018-04-14 15:57:15,386] INFO TorManager Starting self-bundled Tor, due to Tor proxy port 127.0.0.1:9050 check error: No connection