How to Migrate LND From myNode or Umbrel to RaspiBolt

A step-by-step list of commands to level your node up

Red
5 min readFeb 19, 2022

These are the commands I used to migrate my Bitcoin Lightning node Cold Sats from a pi4 running myNode to a new bare metal machine. I’ve included commands for Umbrel as well.

I built the new machine and installed Ubuntu Server, then followed the RaspiBolt guide to setup the file structure, users, install Bitcoin / LND, etc. Then I copied the LND directory from the pi4 to the new machine.

Ensure you have your seed and channel.backup and an understanding of how to recover from them before migrating. Either a second machine already synced and ready or Blixt Wallet are good solutions for recovery.

NEVER run the same node on two different machines at the same time. Once you start LND on the new node, NEVER start LND on your old node again.

High Level Process

Preparation

- Follow RaspiBolt guide until LND wallet creation, but don’t create a wallet
- Set up a password.txt and new LND config in a temp directory
- Backup channel.backup and export channels in RTL (just for reference)

Migration

On old machine:
-
Stop forwards and wait until there are no pending HTLCs

On both machines:
-
Stop LND

On new machine:
-
Move LND directory to a temp directory (or delete it)
- Copy LND directory from old machine to new machine

On old machine:
-
Rename channel.db / LND config then turn machine off

On new machine:
-
Check / update permissions for LND directory
- Remove tls.cert, tls.key, macaroons and macaroons.db
- Move password.txt and LND config from temp to LND directory
- Start LND to ensure it works, then stop
- Finish RaspiBolt step of “Allow user “admin” to work with LND”
- Enable the LND service

Migration Commands

Old node (logged in as admin)

I did not do this, but it would be wise to stop forwards and wait until there are no pending HTLCs. Or at least ensure that none will expire soon.

Stop forwards:
bos limit-forwarding --disable-forwards

New node (logged in as admin)

Start LND to ensure it works, then stop:
lnd
ctrl+c

Ensure LND is stopped in systemd:
systemctl status lnd
or check logs to see it is stopped:
sudo journalctl -f -u lnd

If not stopped stop with:
systemctl disable lnd

Instead of deleting files I move them to a temp directory just in case I need. Create a temp directory and move current LND directory there:
mkdir /temp
mv /data/lnd lnd-old
mv /data/lnd-old /temp

Add a password.txt file and LND config file:
nano /temp/password.txt
nano /temp/lnd.conf
Add your LND password and planned LND config to those files.

LND password can be found in:
myNode: sudo nano /mnt/hdd/mynode/settings/.lndpw
Umbrel: your GUI password (or may be default: moneyprintergobrrr)

Old node (logged in as admin)

Check that LND version is the same as new node (v0.14.2-beta for me).
Take snapshot of current channels with RTL (just for reference).
Save channel.backup with bos TG bot.

Open a second SSH session as admin and tail LND logs to ensure it stops:
myNode: sudo tail -f /home/bitcoin/.lnd/logs/bitcoin/mainnet/lnd.log
Umbrel: tail -f ~/umbrel/lnd/logs/bitcoin/mainnet/lnd.log

Stop LND in first session:
myNode: sudo mynode-stop-services
Umbrel: sudo ./umbrel/scripts/stop

Check LND is stopped in the second SSH session.

Give admin rights to LND directory so you can copy it from new node:
myNode: sudo chmod -R 755 /mnt/hdd/mynode/lnd
Umbrel: sudo chmod -R 755 /mnt/data/umbrel/lnd

New node (logged in as admin)

Copy LND from old node to new node (insert your old node IP):
myNode: sudo rsync -rhvP --append-verify admin@<ip>:/mnt/hdd/mynode/lnd /data/lnd
Umbrel: sudo rsync -rhvP --append-verify umbrel@<ip>:/mnt/data/umbrel/lnd /data/lnd

Wait for copying to finish.

Old node (logged in as admin)

Destroy the heart of old node (rename channel.db / lnd.conf):
myNode: sudo -u bitcoin mv /mnt/hdd/mynode/lnd/data/graph/mainnet/channel.db /mnt/hdd/mynode/lnd/data/graph/mainnet/channel.bak
sudo -u bitcoin mv /mnt/hdd/mynode/lnd/lnd.conf /mnt/hdd/mynode/lnd/lnd.bak
Umbrel: sudo -u bitcoin mv /mnt/data/umbrel/lnd/data/graph/mainnet/channel.db /mnt/data/umbrel/lnd/data/graph/mainnet/channel.bak
sudo -u bitcoin mv /mnt/data/umbrel/lnd/lnd.conf /mnt/data/umbrel/lnd/lnd.bak

Say a final farewell and unplug old node.

NEW NODE (logged in as admin)

Check that everything is owned by LND (except “..”):
ls -la /data/lnd
If the directory is owned by root (it was for me), make LND the owner:
sudo chown -R lnd:lnd /data/lnd

Remove TOR v3 certificate:
sudo mv /data/lnd/v3_onion_private_key /temp

Remove myNode config files (only on myNode):
sudo mv /data/lnd/lnd.conf /temp
sudo mv /data/lnd/lnd.conf.save /temp
sudo mv /data/lnd/lnd.conf.save.1 /temp

Remove tls.cert and tls.key:
sudo mv /data/lnd/tls.key /temp
sudo mv /data/lnd/tls.cert /temp

Remove macaroons + macaroons.db:
sudo mv /data/lnd/data/chain/bitcoin/mainnet/macaroons.db /temp
sudo mv /data/lnd/data/chain/bitcoin/mainnet/admin.macaroon /temp
sudo mv /data/lnd/data/chain/bitcoin/mainnet/chainnotifier.macaroon /temp
sudo mv /data/lnd/data/chain/bitcoin/mainnet/charge-lnd.macaroon /temp
sudo mv /data/lnd/data/chain/bitcoin/mainnet/invoice.macaroon /temp
sudo mv /data/lnd/data/chain/bitcoin/mainnet/invoices.macaroon /temp
sudo mv /data/lnd/data/chain/bitcoin/mainnet/readonly.macaroon /temp
sudo mv /data/lnd/data/chain/bitcoin/mainnet/router.macaroon /temp
sudo mv /data/lnd/data/chain/bitcoin/mainnet/signer.macaroon /temp
sudo mv /data/lnd/data/chain/bitcoin/mainnet/walletkit.macaroon /temp

Move password.txt & lnd.conf from temp to LND directory:
sudo mv /temp/lnd.conf /data/lnd && mv /temp/password.txt /data/lnd

Log into LND user and give password LND rights:
sudo su lnd
chmod 600 /data/lnd/password.txt

Double check everything is correctly removed and LND directory looks good.

MOMENT OF TRUTH

Start LND:
lnd

🚨 NEVER START LND ON OLD NODE AGAIN 🚨

Monitor that it works. You may see errors like I did (I had wrong password, then an issue in tor config). Read the error and try to figure out the issue. Reach out to node friends on Plebnet, myNode or other TG channels.

If your wallet unlocks and LND starts up then you have successfully migrated.

Exit LND:
ctrl + c

Exit LND user session (i.e. go back to admin user):
exit

Remove the temp directory:
rm -rf /temp

Allow admin user to work with LND:
ln -s /data/lnd /home/admin/.lnd
sudo chmod -R g+X /data/lnd/data/
sudo chmod g+r /data/lnd/data/chain/bitcoin/mainnet/admin.macaroon

Check that lncli works:
lncli getinfo

Start LND in systemd:
sudo systemctl enable lnd
sudo systemctl start lnd
systemctl status lnd

Congrats! You have leveled up.

--

--