Skip to content

htpdate fails when reconnecting to the network due to its startup being racy vs. Tor Connection restarting tor

When we have already connected to Tor, then disconnected from the network and we're now reconnecting, this can happen:

  1. In 10-tor.sh, we restart tor, Tor Connection, and htpdate.service. The latter waits for tor to have bootstrapped before actually starting htpdate.
  2. Since DisableNetwork is not set anymore, tor bootstraps immediately and very quickly
  3. This creates the flag file that htpdate.service was waiting for, so it starts htpdate.
  4. Tor Connection sets the clock from the network, then restarts tor, which breaks htpdate.

In our test suite, this results in "Scenario The same Tor configuration is applied when the network is reconnected" failing at step "And I wait until Tor is ready" with Time syncing failed (HtpdateError).

We don't see it elsewhere in our test suite because we don't usually reconnect to a network. But I suspect users could see this more often.

My understanding of !558 (merged) (that closed #18517 (closed)) suggests this might affect tails-additional-software-upgrade.service as well, if it's also started a bit too early.

Originally spotted on !1676 (comment 243078).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information