Lnd: no admin.macaroon

Created on 28 Aug 2017  路  17Comments  路  Source: lightningnetwork/lnd

The error occurs when I try to run lncli newaddress np2wkh in docker. Any clue?

root@866cf3c1e0c9:/go/src/github.com/lightningnetwork/lnd# lncli newaddress np2wkh
[lncli] open /root/.lnd/admin.macaroon: no such file or directory

root@866cf3c1e0c9:/go/src/github.com/lightningnetwork/lnd# ls /root/.lnd/
data  logs  tls.cert  tls.key

Most helpful comment

Are you using --no-macaroons when starting lnd? Try also specifying --no-macaroons to lncli

All 17 comments

Are you using --no-macaroons when starting lnd? Try also specifying --no-macaroons to lncli

Hi, @halseth, this is what I got:

root@b679fcab5c23:/go/src/github.com/lightningnetwork/lnd# lncli --no-macaroons newaddress np2wkh
[lncli] rpc error: code = Unknown desc = expected 1 macaroon, got 0

Ok, not sure exactly why the macaroon was not created when running lnd, but you should be able to work around this by starting lnd (in addition to lncli) with the --no-macaroons flag.

@aakselrod can provide more info.

If you're running lnd in a different directory than the default, the admin.macaroon file gets created there. lncli looks for it in ~/.lnd/admin.macaroon by default but you can specify a different location with --macaroonpath. If you're using --no-macaroons in lncli, you need to use it when starting lnd as well. If I remember correctly, the docker tutorial writes the .macaroon files to /data or something similar.

Thanks, @aakselrod . Could you give me some more specific instructions? Actually, I'm not familiar with go and docker. Based on your info, if I run lnd in the default directory, it should be ok? Then where's the default directory? I didn't realize it. Furthermore, I can't find where admin.macaroon generated by default is, how can I get it?

I have the same issue. I posted my issue since I didn't notice here. https://github.com/lightningnetwork/lnd/issues/295

@aakselrod Is this what you said?

# lncli --macaroonpath /data/admin.macaroon newaddress np2wkh
{
    "address": "rpEWjX76RyufdWjDAnYGFkBiZvzyv8PSQM"
}

Nice, @y-zono .

However, I fail to run "Bob" node via docker-compose up --no-recreate -d --name bob lnd_btc. @y-zono Have you also met this?

xlc@xlc-mbp:~/.../lnd/docker >>> docker-compose up --no-recreate -d --name bob lnd_btc
Builds, (re)creates, starts, and attaches to containers for a service.

Unless they are already running, this command also starts any linked services.

The `docker-compose up` command aggregates the output of each container. When
the command exits, all containers are stopped. Running `docker-compose up -d`
starts the containers in the background and leaves them running.

If there are existing containers for a service, and the service's configuration
or image was changed after the container's creation, `docker-compose up` picks
up the changes by stopping and recreating the containers (preserving mounted
volumes). To prevent Compose from picking up changes, use the `--no-recreate`
flag.

If you want to force Compose to stop and recreate all containers, use the
`--force-recreate` flag.

Usage: up [options] [--scale SERVICE=NUM...] [SERVICE...]

Options:
    -d                         Detached mode: Run containers in the background,
                               print new container names.
                               Incompatible with --abort-on-container-exit.
    --no-color                 Produce monochrome output.
    --no-deps                  Don't start linked services.
    --force-recreate           Recreate containers even if their configuration
                               and image haven't changed.
                               Incompatible with --no-recreate.
    --no-recreate              If containers already exist, don't recreate them.
                               Incompatible with --force-recreate.
    --no-build                 Don't build an image, even if it's missing.
    --build                    Build images before starting containers.
    --abort-on-container-exit  Stops all containers if any container was stopped.
                               Incompatible with -d.
    -t, --timeout TIMEOUT      Use this timeout in seconds for container shutdown
                               when attached or when containers are already
                               running. (default: 10)
    --remove-orphans           Remove containers for services not
                               defined in the Compose file
    --exit-code-from SERVICE   Return the exit code of the selected service container.
                               Implies --abort-on-container-exit.
    --scale SERVICE=NUM        Scale SERVICE to NUM instances. Overrides the `scale`
                               setting in the Compose file if present.
xlc@xlc-mbp:~/.../lnd/docker >>> docker exec -it bob bash
Error: No such container: bob

yes. I have the same issue. still I can't solve it.

$ docker-compose up --no-recreate -d --name bob lnd_btc
Builds, (re)creates, starts, and attaches to containers for a service.

Unless they are already running, this command also starts any linked services.

The `docker-compose up` command aggregates the output of each container. When
the command exits, all containers are stopped. Running `docker-compose up -d`
starts the containers in the background and leaves them running.

I think there's an error in the tutorial. Try using this instead:

docker-compose run -d --name bob lnd_btc

Thanks, @halseth . It works.

One more problem: --num_confs not defined.

In Create the Alice<->Bob channel section, Open the channel with "Bob":

root@7b5a736b1496:/go/src/github.com/lightningnetwork/lnd# lncli --macaroonpath /data/admin.macaroon openchannel --node_key=<bob_identity_pubkey> --num_confs=1 --local_amt=1000000
Incorrect Usage: flag provided but not defined: -num_confs

After I remove the --num_confs option, another error occurs:

root@7b5a736b1496:/go/src/github.com/lightningnetwork/lnd# lncli --macaroonpath /data/admin.macaroon openchannel --node_key=<bob_identity_pubkey> --local_amt=1000000
[lncli] rpc error: code = Code(102) desc = Synchronizing blockchain

The docker tutorial seemingly looks really problematic, so I didn't open up another thread:)

Yeah, I encountered the same error, fix is up here: #296

The second error seems to just be that the btcd instance is not synced. Are you running on simnet? If so, did you remember to mine the blocks specified in the tutorial?

Thanks, @halseth . I'll check it out.

hi, @halseth. I have a question:

In the end of Create lightning network cluster section, the balance of bob is 0.0001.

# Check "Bob" on-chain balance was credited with the funds he received in the
# channel:
bob$ lncli walletbalance
{
    "balance": 0.0001
}

But after I finish the tutorial literally, the balance is 10000. Is there anything I'm missing?

@liuchengxu, the tutorial is a bit out of date. Previously, we used BTC as a unit within walletbalance, now we use satoshis. 0.0001 BTC == 10000 satoshis, so there's no issue here.

Thanks, @Roasbeef.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sunnya97 picture sunnya97  路  3Comments

pm47 picture pm47  路  3Comments

qubenix picture qubenix  路  3Comments

Roasbeef picture Roasbeef  路  3Comments

anaoum picture anaoum  路  4Comments