lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.67k stars 2.07k forks source link

Tor update and LND can't connect #4809

Closed tweetytoo closed 3 years ago

tweetytoo commented 3 years ago

Background

I was running RaspiBlitz (Fulmo) for a few weeks, without issues.

I then ran "update TOR from source code" and after reboot (and some errors on the way), Tor would not connect and LND (a dependency wouldn't either).

After removing/reinstalling Tor, I have a "maybe" connection with "Public null:8333 10 peers"

...but LND still cannot start.

Your environment

Steps to reproduce

When I start up/reboot, Bitcoin starts, Tor starts, but LND cannot connect, so fails:

More details on this thread, but I am posting here b/c there seems to be an issue with LND and Tor. If I turn off Tor (running "naked") then LND works...

Expected behaviour

LND should start and sync.

Actual behaviour

Fails


*** LND SYSTEMD STATUS ***
● lnd.service - LND Lightning Daemon
   Loaded: loaded (/etc/systemd/system/lnd.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sun 2020-11-29 17:21:48 CET; 31s ago
  Process: 31876 ExecStartPre=/home/admin/config.scripts/blitz.systemd.sh log lightning STARTED (code=exited, status=0/SUCCESS)
  Process: 31879 ExecStart=/usr/local/bin/lnd --tor.active --tor.streamisolation --tor.v3 --listen=127.0.0.1:9735 ${lndExtraParameter} (code=exited, status=1/FAILURE)
 Main PID: 31879 (code=exited, status=1/FAILURE)

*** LAST LND ERROR LOGS ***
sudo journalctl -u lnd -b --no-pager -n12
-- Logs begin at Sun 2020-11-29 13:49:33 CET, end at Sun 2020-11-29 17:22:19 CET. --
Nov 29 17:20:14 zPi systemd[1]: Started LND Lightning Daemon.
Nov 29 17:20:31 zPi lnd[30240]: unable to initialize tor controller: unable to connect to Tor server: dial tcp 127.0.0.1:9051: connect: connection refused
Nov 29 17:20:31 zPi systemd[1]: lnd.service: Main process exited, code=exited, status=1/FAILURE
Nov 29 17:20:31 zPi systemd[1]: lnd.service: Failed with result 'exit-code'.
Nov 29 17:21:31 zPi systemd[1]: lnd.service: Service RestartSec=1min expired, scheduling restart.
Nov 29 17:21:31 zPi systemd[1]: lnd.service: Scheduled restart job, restart counter is at 162.
Nov 29 17:21:31 zPi systemd[1]: Stopped LND Lightning Daemon
```.
guggero commented 3 years ago

From the error it looks like lnd cannot connect to the Tor control port (9051). Which means, even if the curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s https://check.torproject.org command now succeeds, Tor is still not configured properly for lnd to work. The Tor control port must be open and lnd must find the credentials to connect to it in the default place. I think perhaps the installing/reinstalling of Tor overwrote some configuration. If possible, try reverting to a stock RaspiBlitz image that is known to work.

Closing for now until there's more evidence for an actual problem in lnd.

basilesportif commented 3 years ago

For anyone who might hit this later: it happens because you need to configure the Tor control port in /etc/tor/torrc. See, for example, this guide: https://wiki.ion.radar.tech/tutorials/nodes/tor