Lightning backups

Someone here was mentioning problems with their lightning channel restoration. I was wondering does umbrel already do automatic backups of the channels or should I set up a cron job to back it up encrypted On a cloud somewhat regularly? And if so how frequently? Hourly? Doesn’t a backup need to be made Everytime there has been a new transaction though your channels? Is there already or could one make it backup after every change in a balance?

Umbrel is making an automated SCB copy of your channels every time you open and close one in this location
/umbrel/lnd/data/chain/bitcoin/mainnet/channel.backup
Same file is also uploaded to a cloud server (encrypted with your seed). From there, Umbrel devs can retrieve it for you (in case you don’t have a copy), but only if you provide the seed (so they do not have control of that file, it cannot be restored without your seed).

But is good that you are doing yourself a manual copy of that file into a safer location (external drive, USB memory, password manager etc), every time you open and close a channel.

Is not necessary to do it every time you do a tx. For that you can setup a Watchtower (see the troubleshooting manual - section about watchtower).

Here is also a guide about how to restore your node in case of SHTF.

1 Like

No offense mate, but I do find it troubling that SCB gets perceived as “Backup of channels”, especially for new users that’s misleading nomen clature.
As an SCB is only a force close mechanic, it’s far away from being a “Backup of channels”. It’s a “get your funds back card” rather. So instead of confusing users, we should stick to something providing more clarity:

  • There is currently no easy backup mechanic for your lightning channels. You can endevour paths like raid or Postgres introduced with LND 0.14, but it requires more than just a bit of tech skill
  • The Backup functionality Umbrel provides only offers to force close all your channels in case your LND gets corrupt. It is good to keep a backup of that backup file, but it’s essentially only a backup of your funds, not your channels.
  • LND Engineering is working to achieve faster and more straight forward real backup control over your channels with version 0.15 and the adoption of PostGres via migration scripts. Currently still WIP, you can follow it’s development here.

wdyt?

1 Like

True.
Nevertheless as I explained in the guide point 6 and 7 are exactly about copying the whole database file and is not necesary to close the channels to recover the funds. It is just magically open the same channels, back from dead.
But yes, this is a procedure only for experimented users.
I did it once and worked, I restored the node in its initial state, no channels closure.

2 Likes

Completely agree with you, 6 & 7 do way more than SCB. I’m still not looking forward having to try it out, since how do you validate your channel.db and wallet.db is the latest state if no raid in place? But it would be a nice experiment, good to hear you’ve been successful with it already. How did you achieve to be able to have the latest files, but no success starting LND?

Was an experimental node, first of all.
So I played a SHTF scenario just to test it.
I shut down the node, completely, so I could still access the wallet.db and channels.db as files on disk.
I had another machine running the same node (it was just a simple linux + bitcoin + lnd).
I copied the files from old machine to the new one, in the same location and start the node.
Wait for node to catch up and done, all channels were back as it was before.

You can do this also with an Umbrel machine, but you need to know in which docker repository to dig and find those files, if you shutdown completely the machine, browsing only the offline disk.
You can do it also with node running, but disconnect from internet (to not have HTLC in flight) and make rsync copy of those files in another location. Optional, to be sure you have a good copy, you can just stop lnd so the channels.db will not be written anymore. So the docker repository to be still active.

Yes, is not easy task, that’s why I said that this is only for experimented users. But works.

The point 7 is simple if you want to test it. So let’s say you want to migrate to another machine your old node. Copying the whole umbrel folder is all you have to do.

1 Like

Can’t the backup of wallet and channels be done in the SD card?

You can. But it’s too close to home to be secure.
Generic backup guidance applies: What you want is to be secure in case of desaster in the following events

  1. SD card malfunction (no issue, just the OS on there)
  2. SSD / HDD malfunction (big issue, channel.db / wallet and SCB on there)
  3. Pi malfunction (no big issue, SD / SSD into new hardware, channels are back, some might be closed)
  4. whole node desaster fire / theft / flood / electricity (big issue, all gone)

So for 2 your mitigation works. Umbrel devs and SD card hold the SCB, but not the wallet / channel.db But you still have no full backup.
For 4, you want your seed bullet proof somewhere. Then you’ll get your funds at some point. To fully recover, channel.db and wallet.db need to be stored and secured at a remote location, in realtime. Since when you try to get online with an old channel state, you lose all your funds. Hence an encrypted, realtime rsync with a cloud storage provider would be the best way.

Humm… It’s not a heaven, but seems better than nothing.
I´m not a programmer, but I’ll try to do a script on this, for testing.

I found two code files that seems to be the backup coding:


and

I don’t know why there are two pieces of code that look alike, and when they are meant to be used, specialy the first one.
But they seem to be a good place to inject a SD card backup code.
Any ideas?

I understand Umbrel is making automated backup of my channels but I’m also trying to save a manual copy as well. Could be a dumb question here but when I download it saves as an Adobe Acrobat file. I’m assuming this is not how I want the backup, any advice?

No. It is NOT an acrobat file. it is just a file named umbrel-channels.backup.
Maybe you by mistake assigned adobe to open files with the .backup extension. That’s all. That doesn’t mean is “an acrobat file”…
Save that channels.backup file into a separate safe place (USB memory, external drive, password manager).

Makes sense, thanks for the quick reply. So I do not have to do anything further. No need to try to open file or save it in another way. Just move the file to usb memory stick?

Exactly. And also do that backup EVERY time you open or close a channel. SCB is the latest state of your channels. And have to be the last one in case of restore.
Once you do a new backup delete the old ones. Are useless and dangerous to use those because are in an old state and you could be “punished” if you want to use an old state of channels.

2 Likes