0

Tor isn't fully starting nor bootstrapping! and connections keeps on throwing time-out errors...

journalctl -xeu [email protected]

May 13 20:34:56 ZDei systemd[29470]: [email protected]: Executing: /usr/bin/tor --defaults-torrc /usr/share/tor/tor-service-defaults-torrc -f /etc/tor/torrc
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.294 [notice] Tor 0.4.7.13 running on Linux with Libevent 2.1.12-stable, OpenSSL 3.0.2, Zlib 1.2.11, Liblzma 5.2.5, Libzstd 1.4.8 and Glibc 2.35 as libc.
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.294 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://support.torproject.org/faq/staying-anonymous/
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.294 [notice] Read configuration file "/usr/share/tor/tor-service-defaults-torrc".
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.294 [notice] Read configuration file "/etc/tor/torrc".
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.296 [notice] Opening Socks listener on 127.0.0.1:<hidden>
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.296 [notice] Opened Socks listener connection (ready) on 127.0.0.1:90605
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.296 [notice] Opening HTTP tunnel listener on 127.0.0.1:<hidden>
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.296 [notice] Opened HTTP tunnel listener connection (ready) on 127.0.0.1:<hidden>
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.296 [notice] Opening Control listener on 127.0.0.1:<hidden>
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.296 [notice] Opened Control listener connection (ready) on 127.0.0.1:<hidden>
May 13 20:34:56 ZDei systemd[1]: [email protected]: Got notification message from PID 29470 (MAINPID=29470)
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.000 [notice] Parsing GEOIP IPv4 file /var/lib/tor/geoip.
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.000 [notice] Parsing GEOIP IPv6 file /var/lib/tor/geoip6.
May 13 20:34:56 ZDei tor[29470]: May 13 20:34:56.000 [notice] Bootstrapped 0% (starting): Starting
May 13 20:34:57 ZDei tor[29470]: May 13 20:34:57.000 [notice] Starting with guard context "bridges"
May 13 20:34:57 ZDei tor[29470]: May 13 20:34:57.000 [notice] Delaying directory fetches: No running bridges
May 13 20:34:57 ZDei tor[29470]: May 13 20:34:57.000 [notice] Bridge '<hidden>' has both an IPv4 and an IPv6 address.  Will prefer using its IPv4 address (<hidden>) based on the configured Bridge address.
May 13 20:34:57 ZDei tor[29470]: May 13 20:34:57.000 [notice] new bridge descriptor '<hidden>' (cached): <hidden> [<hidden>] at <hidden> and [<hidden>]
May 13 20:34:57 ZDei tor[29470]: May 13 20:34:57.000 [notice] Bridge '<hidden>' has both an IPv4 and an IPv6 address.  Will prefer using its IPv4 address (<hidden>) based on the configured Bridge address.
May 13 20:34:57 ZDei tor[29470]: May 13 20:34:57.000 [notice] new bridge descriptor '<hidden>' (cached): <hidden> [<hidden>] at <hidden> and [<hidden>]
May 13 20:34:57 ZDei tor[29470]: May 13 20:34:57.000 [notice] Signaled readiness to systemd
May 13 20:34:57 ZDei systemd[1]: [email protected]: Got notification message from PID 29470 (READY=1)
May 13 20:34:57 ZDei systemd[1]: [email protected]: Changed start -> running
May 13 20:34:57 ZDei systemd[1]: [email protected]: Job 23707 [email protected]/start finished, result=done
May 13 20:34:57 ZDei systemd[1]: Started Anonymizing overlay network for TCP.
░░ Subject: A start job for unit [email protected] has finished successfully
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ A start job for unit [email protected] has finished successfully.
░░ 
░░ The job identifier is 23707.
May 13 20:34:58 ZDei tor[29470]: May 13 20:34:58.000 [notice] Opening Control listener on /run/tor/control
May 13 20:34:58 ZDei tor[29470]: May 13 20:34:58.000 [notice] Opened Control listener connection (ready) on /run/tor/control
May 13 20:34:58 ZDei tor[29470]: May 13 20:34:58.000 [notice] Your application (using socks5 to port 443) instructed Tor to take care of the DNS resolution itself if necessary. This is good.
May 13 20:34:58 ZDei tor[29470]: May 13 20:34:58.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:58 ZDei tor[29470]: May 13 20:34:58.000 [notice] Your application (using socks5 to port 443) instructed Tor to take care of the DNS resolution itself if necessary. This is good.
May 13 20:34:58 ZDei tor[29470]: May 13 20:34:58.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:58 ZDei tor[29470]: May 13 20:34:58.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:58 ZDei tor[29470]: May 13 20:34:58.000 [notice] Your application (using socks5 to port 80) instructed Tor to take care of the DNS resolution itself if necessary. This is good.
May 13 20:34:58 ZDei tor[29470]: May 13 20:34:58.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:58 ZDei tor[29470]: May 13 20:34:58.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:58 ZDei tor[29470]: May 13 20:34:58.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Your application (using socks5 to port 443) instructed Tor to take care of the DNS resolution itself if necessary. This is good.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Your application (using socks5 to port 443) instructed Tor to take care of the DNS resolution itself if necessary. This is good.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Your application (using socks5 to port 80) instructed Tor to take care of the DNS resolution itself if necessary. This is good.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Your application (using socks5 to port 443) instructed Tor to take care of the DNS resolution itself if necessary. This is good.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:34:59 ZDei tor[29470]: May 13 20:34:59.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:00 ZDei tor[29470]: May 13 20:35:00.000 [notice] Your application (using socks5 to port 443) instructed Tor to take care of the DNS resolution itself if necessary. This is good.
May 13 20:35:00 ZDei tor[29470]: May 13 20:35:00.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:00 ZDei tor[29470]: May 13 20:35:00.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:00 ZDei tor[29470]: May 13 20:35:00.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:00 ZDei tor[29470]: May 13 20:35:00.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:00 ZDei tor[29470]: May 13 20:35:00.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:01 ZDei tor[29470]: May 13 20:35:01.000 [notice] Your application (using socks5 to port 443) instructed Tor to take care of the DNS resolution itself if necessary. This is good.
May 13 20:35:01 ZDei tor[29470]: May 13 20:35:01.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:01 ZDei tor[29470]: May 13 20:35:01.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:01 ZDei tor[29470]: May 13 20:35:01.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:01 ZDei tor[29470]: May 13 20:35:01.000 [notice] Your application (using socks5 to port 80) instructed Tor to take care of the DNS resolution itself if necessary. This is good.
May 13 20:35:01 ZDei tor[29470]: May 13 20:35:01.000 [notice] Your application (using socks5 to port 443) instructed Tor to take care of the DNS resolution itself if necessary. This is good.
May 13 20:35:01 ZDei tor[29470]: May 13 20:35:01.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:01 ZDei tor[29470]: May 13 20:35:01.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:01 ZDei tor[29470]: May 13 20:35:01.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:01 ZDei tor[29470]: May 13 20:35:01.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:01 ZDei tor[29470]: May 13 20:35:01.000 [notice] Application request when we haven't used client functionality lately. Optimistically trying known bridges again.
May 13 20:35:05 ZDei tor[29470]: May 13 20:35:05.000 [notice] Your application (using socks5 to port 80) instructed Tor to take care of the DNS resolution itself if necessary. This is good.

// and alot more of useless repetitive messages

/lib/systemd/system/[email protected]

[Unit]
Description=Anonymizing overlay network for TCP
After=network-online.target nss-lookup.target
PartOf=tor.service
ReloadPropagatedFrom=tor.service

[Service]
Type=notify
NotifyAccess=all
PIDFile=/run/tor/tor.pid
PermissionsStartOnly=yes
ExecStartPre=/usr/bin/install -Z -m 02755 -o debian-tor -g debian-tor -d /run/tor
ExecStartPre=/usr/bin/tor --defaults-torrc /usr/share/tor/tor-service-defaults-torrc -f /etc/tor/torrc --verify-config
ExecStart=/usr/bin/tor --defaults-torrc /usr/share/tor/tor-service-defaults-torrc -f /etc/tor/torrc
ExecReload=/bin/kill -HUP ${MAINPID}
KillSignal=SIGINT
TimeoutStartSec=300
TimeoutStopSec=60
Restart=on-failure
LimitNOFILE=65536
StandardOutput=journal
StandardError=journal

# Hardening
AppArmorProfile=-system_tor
NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
ProtectHome=yes
ProtectSystem=full
ReadOnlyDirectories=/
ReadWriteDirectories=-/proc
ReadWriteDirectories=-/var/lib/tor
ReadWriteDirectories=-/var/log/tor
ReadWriteDirectories=-/run
CapabilityBoundingSet=CAP_SETUID CAP_SETGID CAP_NET_BIND_SERVICE CAP_DAC_READ_SEARCH

/etc/systemd/system/[email protected]/override.conf

[Unit]
Before=shutdown.target
Conflicts=shutdown.target
Wants=network-pre.target nss-lookup.target ufw.service iptables.service ip6tables.service netfilter-persistent.service dhcpcd.service NetworkManager.service networkd-dispatcher.service systemd-networkd.service systemd-resolved.service NetworkManager-dispatcher.service
After=network-online.target nss-lookup.target ufw.service iptables.service ip6tables.service netfilter-persistent.service dhcpcd.service NetworkManager.service networkd-dispatcher.service systemd-networkd.service systemd-resolved.service NetworkManager-dispatcher.service

[Service]
RestartPreventExitStatus=1
RestartForceExitStatus=SIGTERM SIGILL
RestartSec=3

/etc/tor/torrc

SocksPort <hidden>
HTTPTunnelPort <hidden>
ControlPort <hidden>

#SocksPolicy accept 192.168.1.0/24
SocksPolicy accept 127.0.0.1
SocksPolicy reject *
#####
Bridge <hidden>
Bridge <hidden>
Bridge <hidden>
Bridge <hidden>
#####
ClientOnionAuthDir /var/lib/tor/onion-auth
DataDirectory /var/lib/tor
DataDirectoryGroupReadable 0
KeyDirectory /var/lib/tor/keys
KeyDirectoryGroupReadable auto
CacheDirectory /var/lib/tor/.cache
CacheDirectoryGroupReadable auto
GeoIPFile /var/lib/tor/geoip
GeoIPv6File /var/lib/tor/geoip6
UseBridges 1
#CookieAuthentication 0
KeepalivePeriod 7
ProtocolWarnings 1
SafeLogging 1
Sandbox 0
ClientDNSRejectInternalAddresses 1
ClientOnly 1
ClientUseIPv4 1
ClientUseIPv6 1
ConnectionPadding auto
DownloadExtraInfo 1
EnforceDistinctSubnets 1
NewCircuitPeriod 30
MaxCircuitDirtiness 10
SafeSocks 0
TestSocks 1
LearnCircuitBuildTimeout 1
CircuitsAvailableTimeout 7
SocksTimeout 30000
DormantOnFirstStartup 1
AvoidDiskWrites 1
ClientTransportPlugin meek_lite,obfs2,obfs3,obfs4,scramblesuit exec /var/lib/tor/PluggableTransports/obfs4proxy
ClientTransportPlugin snowflake exec /var/lib/tor/PluggableTransports/snowflake-client -url https://snowflake-broker.torproject.net.global.prod.fastly.net/ -front cdn.sstatic.net -ice stun:stun.l.google.com:19302,stun:stun.voip.blackberry.com:3478,stun:stun.altar.com.pl:3478,stun:stun.antisip.com:3478,stun:stun.bluesip.net:3478,stun:stun.dus.net:3478,stun:stun.epygi.com:3478,stun:stun.sonetel.com:3478,stun:stun.sonetel.net:3478,stun:stun.stunprotocol.org:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.voys.nl:3478
ExitPortStatistics 1
ExtraInfoStatistics 1
ExtORPort auto
Log notice stdout
#DisableNetwork 1

/lib/systemd/system/tor.service

# This service is actually a systemd target,
# but we are using a service since targets cannot be reloaded.

[Unit]
Description=Anonymizing overlay network for TCP (multi-instance-master)

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

[Install]
WantedBy=multi-user.target

/etc/systemd/system/tor.service.d/override.conf

[Unit]
Before=shutdown.target
Conflicts=shutdown.target
Wants=network-pre.target nss-lookup.target ufw.service iptables.service ip6tables.service netfilter-persistent.service dhcpcd.service NetworkManager.service networkd-dispatcher.service systemd-networkd.service systemd-resolved.service NetworkManager-dispatcher.service
After=network-online.target nss-lookup.target ufw.service iptables.service ip6tables.service netfilter-persistent.service dhcpcd.service NetworkManager.service networkd-dispatcher.service systemd-networkd.service systemd-resolved.service NetworkManager-dispatcher.service

[Service]
StandardError=journal
StandardOutput=journal
1
  • Happens to me once in every few months. I do sudo rm -rf /var/lib/tor/*; sudo systemctl restart tor. It works fine then
    – balki
    Jun 9, 2023 at 20:22

1 Answer 1

0

This odd behaviour is because of the bridges. It thinks that it has started if it has bootstrapped directly or successfully connected to the bridges specified(no matter of pluggable transports used, if any). Actually, the real connectivity check is needed in both cases - and this is just a place for another service that starts after Tor, uses Python and Stem library and resolves some dot-onion DNS names you need in a while+sleep loop, after that it exits, it's a one-shot service. And all your services that do require Tor connectivity has to be dependent on that checker service, not on Tor one, because even if you're not using bridges - you're still have a case "Host not found" even if it's 100% bootstrapped - for a first time it will not resolve it properly in time, but the second request will be just fine. That's why you need that tiny service

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .