lightningnetwork / lnd

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

LND v0.10.4-beta not creating extra macaroons. #4486

Closed marssystems closed 4 years ago

marssystems commented 4 years ago

Background

Describe your issue here. LND v0.10.4-beta not creating extra macaroons.

Your environment

RPi4 4Gb

admin@raspberrypi:~ $ loopd 2020-07-24 16:37:46.476 [INF] LOOPD: Version: 0.7.0-beta commit= 2020-07-24 16:37:46.480 [INF] LNDC: Creating lnd connection to localhost:10009 2020-07-24 16:37:46.481 [INF] LNDC: Connected to lnd 2020-07-24 16:37:46.590 [INF] LNDC: lnd version: v0.10.4-beta, build tags 'autopilotrpc,signrpc,walletrpc,chainrpc,invoicesrpc,watchtowerrpc' loopd exited with an error: unable to obtain macaroons: open /home/admin/.lnd/data/chain/bitcoin/mainnet/invoices.macaroon: no such file or directory admin@raspberrypi:~ $ Tell us how to reproduce this issue. Please provide stacktraces and links to code in question.

Expected behaviour

The extra macaroons required by LOOP should be created and placed in /mnt/hdd/app-data/lnd/data/chain/bitcoin/mainnet/ Tell us what should happen

Actual behaviour

No macaroons are created. Tell us what happens instead Only the 3 basic macaroons are created - admin, invoice and readonly.

wpaulino commented 4 years ago

loopd exited with an error: unable to obtain macaroons: open /home/admin/.lnd/data/chain/bitcoin/mainnet/invoices.macaroon: no such file or directory

loopd is looking for the macaroons in the default path. If you've modified that, then you need to specify the --lnd.macaroondir= flag.

marssystems commented 4 years ago

This is the default path and no macaroons required by LOOP are there, only the 3 default macaroons admin, invoice and readonly. Where does LND create/store its macaroons by default?

wpaulino commented 4 years ago

$HOME/.lnd/data/chain/bitcoin/<network> is the default on Linux. I believe raspiblitz overrides this through either the --lnddir or --datadir flags to have data in the HDD and not the SD card.

marssystems commented 4 years ago

OK - looking at the SD card -

admin@raspberrypi:~/.lnd/data/chain/bitcoin $ cd $HOME/.lnd/data/chain/bitcoin/mainnet admin@raspberrypi:~/.lnd/data/chain/bitcoin/mainnet $ ls admin.macaroon invoice.macaroon readonly.macaroon admin@raspberrypi:~/.lnd/data/chain/bitcoin/mainnet $

There are only the 3 basic macaroons .

guggero commented 4 years ago

I just looked at the RaspiBlitz script. It looks like it copies these three macaroons after installation. So in the $HOME/.lnd/data/chain/bitcoin/mainnet/ directory, only the three default ones are ever going to exist.

Do you find any macaroons with this command?

find /mnt/hdd/lnd -name "*.macaroon"

I checked and lnd 0.10.4 does create all required macaroons. It's just RaspiBlitz that sets up the paths strangely. There's /mnt/hdd/lnd where the actual lnd runs, then there's /mnt/hdd/app-data/lnd where some of the files are copied to and then there's /home/admin/.lnd/ where only the macaroons are copied to.

I think this line needs to change to include all macaroons: https://github.com/rootzoll/raspiblitz/blob/master/home.admin/config.scripts/lnd.credentials.sh#L86

marssystems commented 4 years ago

Yes I did!

admin@raspberrypi:~ $ find /mnt/hdd/lnd -name ".macaroon" find: ‘/mnt/hdd/lnd/logs’: Permission denied find: ‘/mnt/hdd/lnd/data’: Permission denied admin@raspberrypi:~ $ sudo find /mnt/hdd/lnd -name ".macaroon" /mnt/hdd/lnd/data/chain/bitcoin/mainnet/chainnotifier.macaroon /mnt/hdd/lnd/data/chain/bitcoin/mainnet/walletkit.macaroon /mnt/hdd/lnd/data/chain/bitcoin/mainnet/invoices.macaroon /mnt/hdd/lnd/data/chain/bitcoin/mainnet/invoice.macaroon /mnt/hdd/lnd/data/chain/bitcoin/mainnet/admin.macaroon /mnt/hdd/lnd/data/chain/bitcoin/mainnet/signer.macaroon /mnt/hdd/lnd/data/chain/bitcoin/mainnet/readonly.macaroon /mnt/hdd/lnd/data/chain/bitcoin/mainnet/router.macaroon admin@raspberrypi:~ $

So how do I copy all the macaroons to the hdd?

guggero commented 4 years ago

sudo cp /mnt/hdd/lnd/data/chain/bitcoin/mainnet/*.macaroon /home/admin/.lnd/data/chain/bitcoin/mainnet/

Then, depending on the flags that are set, perhaps also:

sudo chown admin:admin /home/admin/.lnd/data/chain/bitcoin/mainnet/*.macaroon

Closing the issue as this is clearly a RaspiBlitz problem, the macaroons are created.