LND not starting, Unable to open graph DB

Any suggestions on what to do here? The only thing to try I’ve found is to install chantools and run dropchannelgraph

I recently updated to the latest LND

2024-03-09T21:52:56-05:00 2024-03-10 02:52:56.087 [INF] LTND: Creating local graph and channel state DB instances
2024-03-09T21:52:56-05:00 2024-03-10 02:52:56.823 [ERR] LTND: unable to open graph DB: invalid edge key 0000000000001382 encountered
2024-03-09T21:52:56-05:00 2024-03-10 02:52:56.823 [ERR] LTND: Shutting down because error in main method: unable to open databases: unable to open graph DB: invalid edge key 0000000000001382 encountered
2024-03-09T21:52:56-05:00 2024-03-10 02:52:56.824 [INF] LTND: Shutdown complete

Can you provide more detail? This happened immediately after an update? What exact version of StartOS and LND are you on? Do you have funds on the node?

SartOS version 0.3.5~1, LND 0.17.4. I hadn’t checked on it for a bit and when I logged in I saw updates available so I installed them before checking on anything else. I was on the previously available update before that, 0.17.3? I did notice there weren’t any forwards for a 3 days which is a bit unusual, so it could be that it happened before the update but I can’t be sure.

Yes, there are funds on the node, about 18 open channels. It’s been running for close to a year without any issues.

It does look like you are on the right track with chantools likely being required. That said, this is an issue with the LND software, rather than StartOS. I can direct you as to how to get into your LND container to issue commands, but you will need to direct your support inquiry to Lightning Labs. If you are comfortable doing this on your own, that’s also fine, but we cannot support or accept any responsibility for anything done ‘under-the-hood’ on this software.

That’s fine. I have a backup I can recover from if necessary as well. Some pointers on how to access the container would be appreciated. Thanks!

That would not be advised as restoring a backup is only for disaster recovery - this will force close all your channels.

You can either first enter container running:

sudo podman exec -it lnd.embassy bash

then run your command, such as:

lncli --rpcserver lnd.embassy listchannels

or you can combine them to one command:

sudo podman exec -it lnd.embassy lncli --rpcserver lnd.embassy listchannels

If chantools needs to be run from the host, then you’ll need to install the software using the /usr/lib/startos/scripts/chroot-and-upgrade script (do NOT just use apt) and run it from outside the container.

Let us know how it goes

I imagine you were looking at a similar issue opened here. You might try chantools compact as guggero suggested.

Thanks.

When you say run it from outside the container, do you mean run chantools from outside the container or just the install? Chantools is just a binary, so just need to download it, but it looks like I need to shut down lnd before using it.

Chanttols is both installed and run from outside the LND container. Generally LND will need to be stopped when running chantools CLI commands.

What hardware are you using? Depending on the hardware you will need a different download. i.e. if you have x86_64 hardware, you would run curl -L https://github.com/lightninglabs/chantools/releases/download/v0.12.2/chantools-linux-amd64-v0.12.2.tar.gz | tar -zxv -f- --strip-components=1 -C /usr/local/bin

OK, so would I execute chantools on the channel.db file located in
/embassy-data/package-data/volumes/lnd/data/main/data/graph/mainnet ?

/embassy-data/package-data/volumes/lnd/data/main/data/graph/mainnet/channel.db is the file chantools compactdb needs based on my understanding of the chantools documentation.

But as David indicated, this seems to be an issue with LND itself, not StartOS or the StartOS LND package; that said, the LND community might be the best resource to advise here.

The compactdb did not resolve the issue, so I tried the dropchannelgraph and after nearly 24 hours of re-syncing, it is now running normally.