ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.84k stars 901 forks source link

Missing instruction to add user to tor group in `doc/TOR.md` #4208

Closed billygarrison closed 3 years ago

billygarrison commented 3 years ago

Edited by ZmnSCPxj

Missing instruction in doc/TOR.md:

usermod -a -G ${TORGROUP} ${LIGHTNINGUSER}

Original post:

System

Tor v0.4.2.7 Bitcoin Core v0.20.1 c-lightning v0.9.1

Issue and Steps to Reproduce

I installed Tor and set it up using the "Quick Start On Linux" section here.

I didn't do anything in detailed discussion because I am under the impression that the quick start has all the required steps that I need? I get the following error message when trying to run lightningd:

lightning_connectd: Could not open Tor cookie file '/run/tor/control.authcookie': Permission denied (version v0.9.1)
0x564342f5098d send_backtrace
        common/daemon.c:38
0x564342f54030 status_failed
        common/status.c:206
0x564342f4d691 negotiate_auth
        connectd/tor_autoservice.c:269
0x564342f4de2a tor_fixed_service
        connectd/tor_autoservice.c:359
0x564342f4a00e setup_listeners
        connectd/connectd.c:1213
0x564342f4a2dd connect_init
        connectd/connectd.c:1296
0x564342f4ab75 recv_req
        connectd/connectd.c:1597
0x564342f50ae8 handle_read
        common/daemon_conn.c:31
0x564342f748ea next_plan
        ccan/ccan/io/io.c:59
0x564342f74d95 do_plan
        ccan/ccan/io/io.c:407
0x564342f74e32 io_ready
        ccan/ccan/io/io.c:417
0x564342f76776 io_loop
        ccan/ccan/io/poll.c:445
0x564342f4b11d main
        connectd/connectd.c:1679
0x7faae80190b2 ???
        ???:0
0x564342f465bd ???
        ???:0
0xffffffffffffffff ???
        ???:0
lightningd: connectd failed (exit status 242), exiting.

My config file looks like:

alias=BillyGarrison
rgb=009900
network=bitcoin
log-level=debug
fee-base=995
fee-per-satoshi=15
plugin-dir=/home/billy/.lightning/plugins/
log-file=/home/billy/.lightning/log.log
proxy=127.0.0.1:9050
bind-addr=127.0.0.1:9735
addr=statictor:127.0.0.1:9051
always-use-proxy=true

The log file:

2020-11-18T00:35:25.920Z DEBUG   lightningd: Opened log file /home/billy/.lightning/log.log
2020-11-18T00:35:25.920Z DEBUG   lightningd: Opened log file /home/billy/.lightning/log.log
2020-11-18T00:35:25.921Z DEBUG   plugin-manager: started(211519) /usr/local/bin/../libexec/c-lightning/plugins/autoclean
2020-11-18T00:35:25.921Z DEBUG   plugin-manager: started(211520) /usr/local/bin/../libexec/c-lightning/plugins/bcli
2020-11-18T00:35:25.922Z DEBUG   plugin-manager: started(211521) /usr/local/bin/../libexec/c-lightning/plugins/keysend
2020-11-18T00:35:25.923Z DEBUG   plugin-manager: started(211522) /usr/local/bin/../libexec/c-lightning/plugins/pay
2020-11-18T00:35:25.924Z DEBUG   plugin-manager: started(211523) /usr/local/bin/../libexec/c-lightning/plugins/txprepare
2020-11-18T00:35:25.925Z DEBUG   plugin-manager: started(211524) /usr/local/bin/../libexec/c-lightning/plugins/spenderp
2020-11-18T00:35:25.929Z DEBUG   lightningd: testing /usr/local/libexec/c-lightning/lightning_channeld
2020-11-18T00:35:25.930Z DEBUG   lightningd: testing /usr/local/libexec/c-lightning/lightning_closingd
2020-11-18T00:35:25.931Z DEBUG   lightningd: testing /usr/local/libexec/c-lightning/lightning_connectd
2020-11-18T00:35:25.932Z DEBUG   lightningd: testing /usr/local/libexec/c-lightning/lightning_gossipd
2020-11-18T00:35:25.933Z DEBUG   lightningd: testing /usr/local/libexec/c-lightning/lightning_hsmd
2020-11-18T00:35:25.934Z DEBUG   lightningd: testing /usr/local/libexec/c-lightning/lightning_onchaind
2020-11-18T00:35:25.935Z DEBUG   lightningd: testing /usr/local/libexec/c-lightning/lightning_openingd
2020-11-18T00:35:25.936Z DEBUG   hsmd: pid 211532, msgfd 28
2020-11-18T00:35:26.010Z DEBUG   connectd: pid 211533, msgfd 32
2020-11-18T00:35:26.011Z DEBUG   hsmd: Client: Received message 11 from client
2020-11-18T00:35:26.011Z DEBUG   hsmd: Client: Received message 9 from client
2020-11-18T00:35:26.011Z DEBUG   hsmd: new_client: 0
2020-11-18T00:35:26.027Z DEBUG   hsmd: Client: Received message 1 from client
2020-11-18T00:35:26.127Z DEBUG   connectd: Proxy address: 127.0.0.1:9050
2020-11-18T00:35:26.127Z DEBUG   connectd: Created IPv4 listener on port 9735
2020-11-18T00:35:26.127Z **BROKEN** connectd: Could not open Tor cookie file '/run/tor/control.authcookie': Permission denied (version v0.9.1)
2020-11-18T00:35:26.127Z **BROKEN** connectd: backtrace: common/daemon.c:43 (send_backtrace) 0x563b478e99d5
2020-11-18T00:35:26.127Z **BROKEN** connectd: backtrace: common/status.c:206 (status_failed) 0x563b478ed030
2020-11-18T00:35:26.127Z **BROKEN** connectd: backtrace: connectd/tor_autoservice.c:269 (negotiate_auth) 0x563b478e6691
2020-11-18T00:35:26.127Z **BROKEN** connectd: backtrace: connectd/tor_autoservice.c:359 (tor_fixed_service) 0x563b478e6e2a
2020-11-18T00:35:26.127Z **BROKEN** connectd: backtrace: connectd/connectd.c:1213 (setup_listeners) 0x563b478e300e
2020-11-18T00:35:26.127Z **BROKEN** connectd: backtrace: connectd/connectd.c:1296 (connect_init) 0x563b478e32dd
2020-11-18T00:35:26.127Z **BROKEN** connectd: backtrace: connectd/connectd.c:1597 (recv_req) 0x563b478e3b75
2020-11-18T00:35:26.127Z **BROKEN** connectd: backtrace: common/daemon_conn.c:31 (handle_read) 0x563b478e9ae8
2020-11-18T00:35:26.128Z **BROKEN** connectd: backtrace: ccan/ccan/io/io.c:59 (next_plan) 0x563b4790d8ea
2020-11-18T00:35:26.128Z **BROKEN** connectd: backtrace: ccan/ccan/io/io.c:407 (do_plan) 0x563b4790dd95
2020-11-18T00:35:26.128Z **BROKEN** connectd: backtrace: ccan/ccan/io/io.c:417 (io_ready) 0x563b4790de32
2020-11-18T00:35:26.128Z **BROKEN** connectd: backtrace: ccan/ccan/io/poll.c:445 (io_loop) 0x563b4790f776
2020-11-18T00:35:26.128Z **BROKEN** connectd: backtrace: connectd/connectd.c:1679 (main) 0x563b478e411d
2020-11-18T00:35:26.128Z **BROKEN** connectd: backtrace: (null):0 ((null)) 0x7f8ba66180b2
2020-11-18T00:35:26.128Z **BROKEN** connectd: backtrace: (null):0 ((null)) 0x563b478df5bd
2020-11-18T00:35:26.128Z **BROKEN** connectd: backtrace: (null):0 ((null)) 0xffffffffffffffff
2020-11-18T00:35:26.128Z **BROKEN** connectd: STATUS_FAIL_INTERNAL_ERROR: Could not open Tor cookie file '/run/tor/control.authcookie': Permission denied
billy@AcerUbuntu:~/.lightning$ Could not open Tor cookie file '/run/tor/control.authcookie': Permission denied
ZmnSCPxj commented 3 years ago

Just to confirm, you have the following lines uncommented out in your torrc?

 ControlPort 9051
 CookieAuthentication 1
 CookieAuthFileGroupReadable 1

And you restarted the tor service/the entire system?

If the file /run/tor/control.authcookie exists in your system but the user running lightningd cannot access it (try cat /run/tor/control.authcookie with the user that runs lightningd), then possibly the missing step is to usermod -a -G ${TORGROUP} ${LIGHTNINGUSER}.

You can get ${TORGROUP} by using ls -la /run/tor/control.authcookie to see the user and group of the file. The second name is the group. On most Debian-derived systems that would be debian-tor. ${LIGHTNINGUSER} is whatever user is running lightningd.

If the user trying to run lightningd can successfully cat /run/tor/control.authcookie > /dev/null then it "should" work.

billygarrison commented 3 years ago

Thank you @ZmnSCPxj, running usermod -a -G ${TORGROUP} ${LIGHTNINGUSER} and rebooting did the trick!

ZmnSCPxj commented 3 years ago

Okay, I suppose that is a missing instruction in the guide, will update as well.

Reopening. Will change OP to a "documentation bug".