lnbits: Problems with admin.macaroon for LNbits 0.9.4 with LND 0.15.2 on myNodeBTC 0.3.03
Introduction
There are two problems notified in this report, with a workaround for one. It seems there is an issue for LNbits presenting admin.macaroon information to lnd, sometimes, for some users, that can be worked around. The problem is attributed to LNbits as the same information can be manually presented to lnd and it responds with success.
And, perhaps related, I have a rendering issue which I suspect is obvious to someone with more experience.
This repository seems the appropriate primary location as the issue is reported on distributions other than @tehelsper’s myNodeBTC, though it maybe of interest to that project as well.
Description
After suffering a bit of difficulty (some due to my own actions) upgrading LNbits on myNodeBTC, the migration to a Dockerised version was complete but LNbits reported:
Oct 11 15:22:11 myNode lnbits[12816]: 2022-10-11 02:22:11.69 | INFO | Retrying connection to backend in 5 seconds...
While at the same time lnd reported:
Oct 11 15:21:36 myNode lnd[27369]: 2022-10-11 15:21:36.484 [ERR] RPCS: [/lnrpc.Lightning/ChannelBalance]: cannot determine data format of binary-encoded macaroon
Examining the .env
configuration file showed no issues with the LND_REST_MACAROON
value (which is regenerated every time the lnbits.service is invoked by a script at /usr/bin/service_scripts/pre_lnbits.sh
. It hex-encodes the value at /mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/admin.macaroon
and the value was confirmed correct by hand on the cli)
Further confirmation of the correctness of the admin.macaroon encoding was obtained by performing, from within the Docker container:
$ MACAROON_HEADER="Grpc-Metadata-macaroon: $LND_REST_MACAROON"
$ curl -X GET --cacert /app/tls.cert --header "$MACAROON_HEADER" https://172.17.0.1:10080/v1/balance/channels
{"balance":"4198", "pending_open_balance":"0", "local_balance":{"sat":"4198", "msat":"4198182"}, "remote_balance":{"sat":"1327", "msat":"1327818"}, "unsettled_local_balance":{"sat":"0", "msat":"0"}, "unsettled_remote_balance":{"sat":"0", "msat":"0"}, "pending_open_local_balance":{"sat":"0", "msat":"0"}, "pending_open_remote_balance":{"sat":"0", "msat":"0"}}
A workaround was offered on Telegram by Axel Hamburch, https://t.me/lnbits/48152 to replace the hex-encoded macaroon string with a path to the admin.macaroon file in .env
LND_REST_MACAROON="/app/admin.macaroon"
[Due to the operation of myNodeBTC and Docker, was necessary to modify the lnbits.service unit:
Comment out the call to insert the hex-encoded admin.macaroon in .env
# Use path to admin.macaroon and prevent pre_lnbits.sh from replacing it
# /mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/admin.macaroon
# ExecStartPre=/usr/bin/service_scripts/pre_lnbits.sh
And make the admin.macaroon file available in the Docker container by adding this --volume option:
--volume /mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/admin.macaroon:/app/admin.macaroon
]
This resulted in LNbits successfully connecting with the funding backend.
Unfortunately, one problem remains, the rendering of LNbits is very wrong:
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (9 by maintainers)
Whatever the problem was, it has since been fixed by the latest update for mynode…Thank you all for your help.