ExchangeUnion / xud-docker

Streamlined setup of xud and all dependencies via docker 🐳
https://docs.exchangeunion.com
GNU Affero General Public License v3.0
5 stars 5 forks source link

xud waiting with creating tls.cert for lndbtc admin macaroon #210

Closed kilrau closed 4 years ago

kilrau commented 5 years ago

Background

xud doesn't start properly unless lndbtc admin macaroon was created

Your environment

Steps to reproduce

run simnet, immediately logs -f xud and and run getinfo in parallel

Expected behaviour

getinfo works

Actual behaviour

getinfo throws

simnet > getinfo
/app/node_modules/yargs/yargs.js:1133
      else throw err
           ^

Error: ENOENT: no such file or directory, open '/root/.xud/tls.cert'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at Object.exports.loadXudClient (/app/dist/cli/command.js:16:31)
    at Object.exports.handler (/app/dist/cli/commands/getinfo.js:49:15)
    at Object.runCommand (/app/node_modules/yargs/lib/command.js:235:44)
    at Object.parseArgs [as _parseArgs] (/app/node_modules/yargs/yargs.js:1046:30)
    at Object.get [as argv] (/app/node_modules/yargs/yargs.js:989:21)
    at Object.<anonymous> (/app/bin/xucli:40:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

xud logs show that it doesn't create tls.cert, but immediately does so when lndbtc's admin macaroon is found:

simnet > logs -f xud
Attaching to simnet_xud_1
xud_1     | 2019-10-08 12:00:34,137 INFO Set uid to user 0 succeeded
xud_1     | 2019-10-08 12:00:34,140 INFO supervisord started with pid 1
xud_1     | 2019-10-08 12:00:35,142 INFO spawned: 'tor' with pid 7
xud_1     | 2019-10-08 12:00:35,143 INFO spawned: 'xud' with pid 8
xud_1     | xud.conf not found - creating a new one...
xud_1     | Oct 08 12:00:35.179 [notice] Tor 0.3.4.11 (git-4fd31340f3355342) running on Linux with Libevent 2.1.8-stable, OpenSSL 1.1.1b, Zlib 1.2.11, Liblzma N/A, and Libzstd N/A.
xud_1     | Oct 08 12:00:35.179 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
xud_1     | Oct 08 12:00:35.179 [notice] Read configuration file "/etc/tor/torrc".
xud_1     | Oct 08 12:00:35.185 [notice] Scheduler type KIST has been enabled.
xud_1     | Oct 08 12:00:35.185 [notice] Opening Socks listener on 127.0.0.1:9050
xud_1     | Oct 08 12:00:35.000 [notice] Parsing GEOIP IPv4 file /usr/share/tor/geoip.
xud_1     | Oct 08 12:00:35.000 [notice] Parsing GEOIP IPv6 file /usr/share/tor/geoip6.
xud_1     | Oct 08 12:00:35.000 [warn] You are running Tor as root. You don't need to, and you probably shouldn't.
xud_1     | Oct 08 12:00:35.000 [notice] Bootstrapped 0%: Starting
xud_1     | Oct 08 12:00:35.000 [notice] Starting with guard context "default"
xud_1     | Onion address for xud is 4v4vqenfnio5y6eo6qhvnaix6v3uteudmjw4vmd7h57jlmw4u4s53xqd.onion
xud_1     | 2019-10-08 12:00:36,167 INFO success: tor entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
xud_1     | 2019-10-08 12:00:36,167 INFO success: xud entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Oct 08 12:00:36.000 [notice] Bootstrapped 5%: Connecting to directory server
xud_1     | Oct 08 12:00:36.000 [notice] Bootstrapped 10%: Finishing handshake with directory server
xud_1     | Oct 08 12:00:37.000 [notice] Bootstrapped 15%: Establishing an encrypted directory connection
xud_1     | Oct 08 12:00:37.000 [notice] Bootstrapped 20%: Asking for networkstatus consensus
xud_1     | Oct 08 12:00:37.000 [notice] Bootstrapped 25%: Loading networkstatus consensus
xud_1     | Oct 08 12:00:38.000 [notice] I learned some more directory information, but not enough to build a circuit: We have no usable consensus.
xud_1     | Oct 08 12:00:38.000 [notice] Bootstrapped 40%: Loading authority key certs
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Oct 08 12:00:39.000 [notice] The current consensus has no exit nodes. Tor can only build internal paths, such as paths to onion services.
xud_1     | Oct 08 12:00:39.000 [notice] Bootstrapped 45%: Asking for relay descriptors for internal paths
xud_1     | Oct 08 12:00:39.000 [notice] I learned some more directory information, but not enough to build a circuit: We need more microdescriptors: we have 0/6304, and can only build 0% of likely paths. (We have 0% of guards bw, 0% of midpoint bw, and 100% of end bw (no exits in consensus) = 0% of path bw.)
xud_1     | Oct 08 12:00:39.000 [notice] Bootstrapped 50%: Loading relay descriptors for internal paths
xud_1     | Oct 08 12:00:39.000 [notice] The current consensus contains exit nodes. Tor can build exit and internal paths.
xud_1     | Oct 08 12:00:40.000 [notice] Bootstrapped 56%: Loading relay descriptors
xud_1     | Oct 08 12:00:40.000 [notice] Bootstrapped 63%: Loading relay descriptors
xud_1     | Oct 08 12:00:40.000 [notice] Bootstrapped 69%: Loading relay descriptors
xud_1     | Oct 08 12:00:40.000 [notice] Bootstrapped 76%: Loading relay descriptors
xud_1     | Oct 08 12:00:40.000 [notice] Bootstrapped 80%: Connecting to the Tor network
xud_1     | Oct 08 12:00:41.000 [notice] Bootstrapped 85%: Finishing handshake with first hop
xud_1     | Oct 08 12:00:41.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
xud_1     | Oct 08 12:00:41.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
xud_1     | Oct 08 12:00:41.000 [notice] Bootstrapped 100%: Done
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Waiting for lndbtc admin.macaroon
xud_1     | Detecting localnet IP for lndbtc...
xud_1     | Detecting localnet IP for lndltc...
xud_1     | Detecting localnet IP for raiden...
xud_1     | 08/10/2019 12:04:46.615 [GLOBAL] info: config file loaded
xud_1     | 08/10/2019 12:04:46.831 [DB] info: connected to database /root/.xud/xud-simnet.db
xud_1     | 08/10/2019 12:04:47.123 [LND-BTC] debug: loaded tls cert from /root/.lndbtc/tls.cert
xud_1     | 08/10/2019 12:04:47.124 [LND-LTC] debug: loaded tls cert from /root/.lndltc/tls.cert
xud_1     | 08/10/2019 12:04:47.128 [RAIDEN] info: trying to verify connection to raiden with uri: raiden:5001
xud_1     | 08/10/2019 12:04:47.140 [LND-BTC] debug: loaded macaroon from /root/.lndbtc/data/chain/bitcoin/simnet/admin.macaroon
xud_1     | 08/10/2019 12:04:47.141 [LND-BTC] info: trying to verify connection to lnd at lndbtc:10009
xud_1     | 08/10/2019 12:04:47.144 [LND-LTC] debug: loaded macaroon from /root/.lndltc/data/chain/litecoin/simnet/admin.macaroon
xud_1     | 08/10/2019 12:04:47.145 [LND-LTC] info: trying to verify connection to lnd at lndltc:10009
xud_1     | 08/10/2019 12:04:47.159 [RAIDEN] debug: address is 0x8989DfD87002e5890F18473ce0A0EFfE76E44fB8
xud_1     | 08/10/2019 12:04:47.162 [RAIDEN] info: RaidenClient status: ConnectionVerified
xud_1     | 08/10/2019 12:04:47.195 [RAIDEN] debug: new outbound capacity for WETH: 0
xud_1     | 08/10/2019 12:04:47.205 [LND-LTC] info: LndClient status: OutOfSync
xud_1     | 08/10/2019 12:04:47.208 [LND-LTC] warn: lnd is out of sync with chain, retrying in 5000 ms
xud_1     | 08/10/2019 12:04:47.212 [RAIDEN] debug: new outbound capacity for DAI: 0
xud_1     | 08/10/2019 12:04:47.214 [LND-BTC] info: LndClient status: OutOfSync
xud_1     | 08/10/2019 12:04:47.215 [LND-BTC] warn: lnd is out of sync with chain, retrying in 5000 ms
xud_1     | 08/10/2019 12:04:47.262 [GLOBAL] info: Local nodePubKey is 02c70c9104dd235877d892d7b83cd5083a8956fe40d49b4c7fe41aad5fbf984be4
xud_1     | 08/10/2019 12:04:47.299 [P2P] info: Connecting to simnet XU network
ghost commented 5 years ago

I think this is xud-docker related.

kilrau commented 5 years ago

How exactly?

ghost commented 5 years ago

https://github.com/ExchangeUnion/xud-docker/blob/master/images/xud-simnet/entrypoint.sh#L43

kilrau commented 5 years ago

Got it. So I guess this sleep is there to ensure lndbtc is ready for the "create" call. Which is legit.

So the only real solution to that is https://github.com/ExchangeUnion/xud/issues/1253. Am I getting that right?

kilrau commented 4 years ago

Not relevant anymore. Closing.