Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] CLN Migrations #106

Open
3 tasks
kn0wmad opened this issue Dec 18, 2023 · 4 comments
Open
3 tasks

[feat] CLN Migrations #106

kn0wmad opened this issue Dec 18, 2023 · 4 comments

Comments

@kn0wmad
Copy link
Contributor

kn0wmad commented Dec 18, 2023

https://docs.corelightning.org/docs/recovery

  • Umbrel
  • Raspiblitz
  • myNode
@dennisreimann
Copy link
Contributor

dennisreimann commented Jun 2, 2024

Here's how I migrated a CLN node from my Raspiblitz to StartOS, keeping the channels alive:

Preparation

On StartOS, set up SSH key for the root user:

# Switch to root
sudo su -
# Generate key
ssh-keygen -t ed25519 -C "root@startOS"
# Add the key to the SSH agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
# Show the public key
cat /root/.ssh/id_ed25519.pub

Copy the public key and switch to the Raspiblitz:

# Add StartOS public key to root's authorized_keys - edit the file and insert the copied key
sudo vim /root/.ssh/authorized_keys
# Stop Core Lightning on Raspiblitz
./config.scripts/cl.install.sh off

The last step, stopping Core Lightning on Raspiblitz, is very important. Ensure it is stopped using sudo systemctl status lightningd.service!

Fresh start of CLN on StartOS

Before migrating, I brought up a fresh install of CLN on StartOS, so that I knew where to copy stuff. Not sure if this is necessary, but I did it like this to ensure the directories are setup correctly and I'd advise you to do the same.

Once CLN starts up correctly, stop it on StartOS as well.

Copying the files over

  • From Raspiblitz: /mnt/hdd/app-data/.lightning/bitcoin/
  • To StartOS: /embassy-data/package-data/volumes/c-lightning/data/main/bitcoin/

On StartOS CLI:

# Switch to root
sudo su -
# Enter the CLN main directory
cd /embassy-data/package-data/volumes/c-lightning/data/main/
# Just in case, backup the original files
cp -r bitcoin bitcoin-backup-original
# copy files over
scp -r root@YOUR_RASPIBLITZ_IP:/mnt/hdd/app-data/.lightning/bitcoin/* bitcoin

You might not need to copy all the files, these are the ones you'll want at least though:

  • accounts.sqlite3
  • emergency.recover
  • gossip_store
  • hsm_secret
  • lightningd.sqlite3
  • keys.clboss (in case you've used clboss on Raspiblitz)

You might want to also adapt the config file to fit what you had before on Raspiblitz. Compare these files and adjust them, e.g. by replacing the StartOS alias with the one you had on Raspiblitz:

  • Raspiblitz: /mnt/hdd/app-data/.lightning/config
  • StartOS: /embassy-data/package-data/volumes/c-lightning/data/main/config

Bring up CLN on StartOS again

Afterwards I simply restarted CLN on StartOS and kept an eye on the Core Lightning Service Logs.

@50egtftz
Copy link

50egtftz commented Nov 3, 2024

Amazing steps! Was able to migrate following the instructions.

The only hiccup I encountered, was that my hsm_secret file was encrypted, and Start9 seems to not support that? CLN would just keep restarting in loop, and when I looked at the logs, it said the hsm_secret file was encrypted. I tried to modify the config file by adding:

# wallet
encrypted-hsm

That didn't work. As soon as CLN restarted, it would wipe that addition from the config file. In the end, I had to basically recreate my hsm_secret using the hex backup, so it was unencrypted, then it worked. The steps to do that are:
https://youtu.be/fvB1SmY-y98?si=UEUc-oXRpAty-iMU&t=499

If you don't have the hex backup, then it would be a problem.

@Dominion5254
Copy link
Collaborator

@50egtftz were you coming from a Raspiblitz as well?

If the hsm_secret is encrypted the password would need to be passed to lightningd at startup, however this is not currently possible with cln-startos as startup flags in the docker_entrypoint.sh cannot be intercepted to add the password. As you found, saving a decrypted hsm_secret is probably the best workaround at present.

@50egtftz
Copy link

Ah, good to have confirmation about the encryption thing.

I had CLN running on a standalone node on Ubuntu. It was a project for fun to learn how to install the different components (details). Then migrated to Start9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants