jamaljsr / polar

One-click Bitcoin Lightning networks for local app development & testing
https://lightningpolar.com
MIT License
770 stars 145 forks source link

Bug: network doesn't start #722

Closed philosopher-phaedrus closed 1 year ago

philosopher-phaedrus commented 1 year ago

Describe the bug Can't start the default network with single bitcoind and c-ln, lnd, eclair.

To Reproduce

  1. Start polar
  2. Create default network
  3. Start the network

Expected behavior Bitcoind and 3 LN nodes running, but instead it fails. I see:

21:28:10.385 › AppIpcListener: send error "app-http-response-429043030427" {
  "errno": -111,
  "code": "ECONNREFUSED",
  "syscall": "connect",
  "address": "127.0.0.1",
  "port": 8283
}
21:28:10.394 › LndProxyServer: received request "lnd-list-peers-request" [
  {
    "node": {
      "id": 0,
      "networkId": 2,
      "name": "alice",
      "type": "lightning",
      "implementation": "LND",
      "version": "0.16.0-beta",
      "status": 0,
      "backendName": "backend1",
      "paths": {
        "tlsCert": "/root/.polar/networks/2/volumes/lnd/alice/tls.cert",
        "adminMacaroon": "/root/.polar/networks/2/volumes/lnd/alice/data/chain/bitcoin/regtest/admin.macaroon",
        "invoiceMacaroon": "/root/.polar/networks/2/volumes/lnd/alice/data/chain/bitcoin/regtest/invoice.macaroon",
        "readonlyMacaroon": "/root/.polar/networks/2/volumes/lnd/alice/data/chain/bitcoin/regtest/readonly.macaroon"
      },
      "ports": {
        "rest": 8081,
        "grpc": 10001,
        "p2p": 9735
      },
      "docker": {
        "image": "",
        "command": ""
      }
    },
    "replyTo": "lnd-list-peers-response-1325335891265"
  }
]
21:28:10.396 › LndProxyServer: send error "lnd-list-peers-response-1325335891265" {
  "errno": -2,
  "code": "ENOENT",
  "syscall": "open",
  "path": "/root/.polar/networks/2/volumes/lnd/alice/tls.cert"
}

The folder /root/.polar/networks/2/volumes/lnd/alice exists, but the tls.cert file is not there.

The UI is showing error as well:

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

jamaljsr commented 1 year ago

Can you right-click on alice and click View Logs to see the LND logs. This will likely give more info as to why it is not starting up and generating the TLS cert.

philosopher-phaedrus commented 1 year ago

backend1 (Bitcoind) says in the UI: Unable to connect to bitcoin node connect ECONNREFUSED 127.0.0.1:18443

alice (lnd) log:

Search

0 matches
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
useradd: UID 0 is not unique
adding user lnd (0:0)
philosopher-phaedrus commented 1 year ago

Can't open bitcoind logs (UI window opens up but the logs never load)

# docker ps
CONTAINER ID   IMAGE                               COMMAND                  CREATED         STATUS                          PORTS     NAMES
575dabe0c9ab   polarlightning/lnd:0.16.0-beta      "/entrypoint.sh lnd …"   8 minutes ago   Restarting (4) 21 seconds ago             polar-n2-alice
7f95f7a69f5b   polarlightning/eclair:0.8.0         "/entrypoint.sh pola…"   8 minutes ago   Restarting (4) 1 second ago               polar-n2-carol
09770f942b9b   polarlightning/clightning:23.02.2   "/entrypoint.sh ligh…"   8 minutes ago   Restarting (4) 1 second ago               polar-n2-bob
a20544adb002   polarlightning/lnd:0.16.0-beta      "/entrypoint.sh lnd …"   14 hours ago    Restarting (4) 27 seconds ago             polar-n1-alice

Is it expected that there isn't a docker container for bitcoind?

philosopher-phaedrus commented 1 year ago

Also, I'm running this on Fedora running as Qubes OS vm, but I got Polar running on Qubes OS Fedora before without any problems.

jamaljsr commented 1 year ago

Are you logged in as root on this machine? It appears that way based on the 0:0 userid. I think this is the issue.

Can you try temporarily logging in as a different user and running Polar, just to confirm that this is what's causing the issue.

philosopher-phaedrus commented 1 year ago

I'm logged in as regular user, but need to start Polar with sudo, because of Docker running as root (otherwise Polar doesn't detect Docker). See https://github.com/jamaljsr/polar/issues/553

I guess I can try to reconfigure Docker to run as regular user.

philosopher-phaedrus commented 1 year ago

Alright, I'm good, it's working.

I didn't need to change docker to run as user. Instead, just adding my user into the docker group enabled running polar without sudo:

sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker  ## refresh the changes

Now bitcoind and lnd starts fine. Thank you @jamaljsr

philosopher-phaedrus commented 1 year ago

I'm closing this, since it's nothing to be fixed in Polar. Maybe change the error when Docker is not detected into something like "Install docker and make sure the user running Polar is in docker group".

jamaljsr commented 1 year ago

Awesome! Glad to hear its working now. Thanks for the suggestion