[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #25182 [Core Tor/Tor]: systemd unit file starts Tor before IPv6 address is available



#25182: systemd unit file starts Tor before IPv6 address is available
---------------------------+------------------------------------
 Reporter:  sjmurdoch      |          Owner:  (none)
     Type:  defect         |         Status:  closed
 Priority:  Medium         |      Milestone:  Tor: 0.3.4.x-final
Component:  Core Tor/Tor   |        Version:  Tor: 0.3.3.1-alpha
 Severity:  Normal         |     Resolution:  invalid
 Keywords:  ipv6, systemd  |  Actual Points:
Parent ID:  #24403         |         Points:
 Reviewer:                 |        Sponsor:
---------------------------+------------------------------------

Old description:

> On Ubuntu xenial, systemd starts Tor before the IPv6 address is available
> and so Tor fails to assign an IPv6 address then exits. systemd tries to
> restart Tor (I think three times) but even by the last time there's still
> no IPv6 address assigned and hence Tor fails to start.
>
> As a work-around I added `RestartSec=10` to the systemd unit file to slow
> down the restart such that by the second time tor starts, there is an
> IPv6 address available.
>
> See log file below.
>
> {{{
> Feb 08 15:06:28 ephemer tor[1313]: Feb 08 15:06:28.587 [notice] Tor
> 0.3.3.1-alpha (git-dc340725f08717e3) running on Linux with Libevent
> 2.0.21-stable, OpenSSL 1.0.2g, Zlib 1.2.8, Liblzma 5.1
> .0alpha, and Libzstd N/A.
> Feb 08 15:06:28 ephemer tor[1313]: Feb 08 15:06:28.588 [notice] Tor can't
> help you if you use it wrong! Learn how to be safe at
> https://www.torproject.org/download/download#warning
> Feb 08 15:06:28 ephemer tor[1313]: Feb 08 15:06:28.588 [notice] This
> version is not a stable Tor release. Expect more bugs than usual.
> Feb 08 15:06:28 ephemer tor[1313]: Feb 08 15:06:28.588 [notice] Read
> configuration file "/usr/share/tor/tor-service-defaults-torrc".
> Feb 08 15:06:28 ephemer tor[1313]: Feb 08 15:06:28.588 [notice] Read
> configuration file "/etc/tor/torrc".
> Feb 08 15:06:28 ephemer tor[1313]: Feb 08 15:06:28.591 [notice] Based on
> detected system memory, MaxMemInQueues is set to 8192 MB. You can
> override this by setting MaxMemInQueues by hand.
> Feb 08 15:06:28 ephemer tor[1313]: Configuration was valid
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.651 [notice] Tor
> 0.3.3.1-alpha (git-dc340725f08717e3) running on Linux with Libevent
> 2.0.21-stable, OpenSSL 1.0.2g, Zlib 1.2.8, Liblzma 5.1
> .0alpha, and Libzstd N/A.
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.651 [notice] Tor can't
> help you if you use it wrong! Learn how to be safe at
> https://www.torproject.org/download/download#warning
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.651 [notice] This
> version is not a stable Tor release. Expect more bugs than usual.
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.651 [notice] Read
> configuration file "/usr/share/tor/tor-service-defaults-torrc".
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.651 [notice] Read
> configuration file "/etc/tor/torrc".
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Based on
> detected system memory, MaxMemInQueues is set to 8192 MB. You can
> override this by setting MaxMemInQueues by hand.
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Scheduler
> type KIST has been enabled.
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Opening
> Socks listener on 127.0.0.1:9050
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Opening
> OR listener on 0.0.0.0:9001
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Opening
> OR listener on [2001:630:212:2a8:a6bf:1ff:fe25:b961]:9001
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [warn] Could not
> bind to 2001:630:212:2a8:a6bf:1ff:fe25:b961:9001: Cannot assign requested
> address
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Opening
> Directory listener on 0.0.0.0:9030
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Closing
> partially-constructed Socks listener on 127.0.0.1:9050
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Closing
> partially-constructed OR listener on 0.0.0.0:9001
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Closing
> partially-constructed Directory listener on 0.0.0.0:9030
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [warn] Failed to
> parse/validate config: Failed to bind one of the listener ports.
> Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [err] Reading
> config failed--see warnings above.
> Feb 08 15:06:28 ephemer systemd[1]: tor@default.service: Main process
> exited, code=exited, status=1/FAILURE
> -- Subject: Unit tor@default.service has failed
> -- Unit tor@default.service has failed.
> Feb 08 15:06:28 ephemer systemd[1]: tor@default.service: Unit entered
> failed state.
> Feb 08 15:06:28 ephemer systemd[1]: tor@default.service: Failed with
> result 'exit-code'.
> }}}

New description:

 On Ubuntu xenial, systemd starts Tor before the IPv6 address is available
 and so Tor fails to assign an IPv6 address then exits. systemd tries to
 restart Tor (I think three times) but even by the last time there's still
 no IPv6 address assigned and hence Tor fails to start.

 As a work-around I copied `/lib/systemd/system/tor*` to
 `/etc/systemd/system/` and added `RestartSec=10` to the `[Service]`
 section of `tor@default.service` and `tor@.service`. This slows down the
 restart such that by the second time tor starts, there is an IPv6 address
 available.

 See log file below.

 {{{
 Feb 08 15:06:28 ephemer tor[1313]: Feb 08 15:06:28.587 [notice] Tor
 0.3.3.1-alpha (git-dc340725f08717e3) running on Linux with Libevent
 2.0.21-stable, OpenSSL 1.0.2g, Zlib 1.2.8, Liblzma 5.1
 .0alpha, and Libzstd N/A.
 Feb 08 15:06:28 ephemer tor[1313]: Feb 08 15:06:28.588 [notice] Tor can't
 help you if you use it wrong! Learn how to be safe at
 https://www.torproject.org/download/download#warning
 Feb 08 15:06:28 ephemer tor[1313]: Feb 08 15:06:28.588 [notice] This
 version is not a stable Tor release. Expect more bugs than usual.
 Feb 08 15:06:28 ephemer tor[1313]: Feb 08 15:06:28.588 [notice] Read
 configuration file "/usr/share/tor/tor-service-defaults-torrc".
 Feb 08 15:06:28 ephemer tor[1313]: Feb 08 15:06:28.588 [notice] Read
 configuration file "/etc/tor/torrc".
 Feb 08 15:06:28 ephemer tor[1313]: Feb 08 15:06:28.591 [notice] Based on
 detected system memory, MaxMemInQueues is set to 8192 MB. You can override
 this by setting MaxMemInQueues by hand.
 Feb 08 15:06:28 ephemer tor[1313]: Configuration was valid
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.651 [notice] Tor
 0.3.3.1-alpha (git-dc340725f08717e3) running on Linux with Libevent
 2.0.21-stable, OpenSSL 1.0.2g, Zlib 1.2.8, Liblzma 5.1
 .0alpha, and Libzstd N/A.
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.651 [notice] Tor can't
 help you if you use it wrong! Learn how to be safe at
 https://www.torproject.org/download/download#warning
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.651 [notice] This
 version is not a stable Tor release. Expect more bugs than usual.
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.651 [notice] Read
 configuration file "/usr/share/tor/tor-service-defaults-torrc".
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.651 [notice] Read
 configuration file "/etc/tor/torrc".
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Based on
 detected system memory, MaxMemInQueues is set to 8192 MB. You can override
 this by setting MaxMemInQueues by hand.
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Scheduler
 type KIST has been enabled.
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Opening
 Socks listener on 127.0.0.1:9050
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Opening OR
 listener on 0.0.0.0:9001
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Opening OR
 listener on [2001:630:212:2a8:a6bf:1ff:fe25:b961]:9001
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [warn] Could not
 bind to 2001:630:212:2a8:a6bf:1ff:fe25:b961:9001: Cannot assign requested
 address
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Opening
 Directory listener on 0.0.0.0:9030
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Closing
 partially-constructed Socks listener on 127.0.0.1:9050
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Closing
 partially-constructed OR listener on 0.0.0.0:9001
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [notice] Closing
 partially-constructed Directory listener on 0.0.0.0:9030
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [warn] Failed to
 parse/validate config: Failed to bind one of the listener ports.
 Feb 08 15:06:28 ephemer tor[1352]: Feb 08 15:06:28.653 [err] Reading
 config failed--see warnings above.
 Feb 08 15:06:28 ephemer systemd[1]: tor@default.service: Main process
 exited, code=exited, status=1/FAILURE
 -- Subject: Unit tor@default.service has failed
 -- Unit tor@default.service has failed.
 Feb 08 15:06:28 ephemer systemd[1]: tor@default.service: Unit entered
 failed state.
 Feb 08 15:06:28 ephemer systemd[1]: tor@default.service: Failed with
 result 'exit-code'.
 }}}

--

Comment (by sjmurdoch):

 I've updated the description to note that you need to copy the unit files
 out of /lib/systemd/system/ to /etc/systemd/system/ because otherwise
 upgrading Tor will overwrite your changes.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/25182#comment:9>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs