diff --git a/FAQ.md b/FAQ.md index 1babd3b..aa37e85 100644 --- a/FAQ.md +++ b/FAQ.md @@ -119,45 +119,45 @@ But there is one safe way to start: Store your LND wallet seed (list of words yo Recovering the coins that you have in an active channel is a bit more complicated. Because you have to be sure that you really have an up to date backup of your channel state data. The problem is: If you post an old state of your channel, to the network this looks like an atempt to cheat, and your channel partner is allowed claim all the funds in the channel. -To really have a reliable backup, such feature needs to be part of the LND software. Almost every other solution would not be perfect. Thats why RaspiBlitz is not trying to provide a backup feature at the moment. +To really have a reliable backup, such feature needs to be part of the LND software. Almost every other solution would not be perfect. Thats why RaspiBlitz is not trying to provide a backup feature at the moment. But if you feel experimental and you look for a continues backup you may want to check out the following script to integrate into your RaspiBlitz: https://github.com/vindard/lnd-backup/blob/master/do-lndbackup.sh -But you can try to backup at your own risk. All your Lightning Node data is within the `/mnt/hdd/lnd` directory. Just run a backup of that data when the lnd service is stopped -> `sudo systemctl stop lnd` Then on your laptop you go with the terminal into the directory you want to store the backup in and use the following SCP command to download: +How to backup LND data in a rescue situation see next question "How can I recover my coins from a failing RaspiBlitz?". -`scp -r bitcoin@[LOCAL-IP-OF-RASPIBLITZ]:/mnt/hdd/lnd/ ./` use your password A +## How can I recover my coins from a failing RaspiBlitz? -And if you want to put a LND backup state back. Make a fresh RaspiBlitz (new sd card image and a clean HDD), set it up until its ready (you see the status screen on LCD) and then go to terminal, stop lnd service with `sudo systemctl stop lnd` delete the content of the lnd data dir with `sudo rm -rf /mnt/hdd/lnd/*`. Then on your laptop being in terminal in the same directory you did the backup in (the backuped lnd directory is listed there) run the following SCP command: +On a RaspiBlitz you have coins in your on-chain wallet (bitcoin wallet) and also coins in lightning channels. First we will try to recover all of them and even trying to keep your channels open with "Recover LND data". This that is not possible you can fall back to the second option "Recover from Wallet Seed". -`scp -r ./lnd/* bitcoin@[LOCAL-IP-OF-RASPIBLITZ]:/mnt/hdd/lnd/` use password A +### 1) Recover LND data -No run a reboot with: `sudo shutdown -r now` ... LND may need some longer rescan after reboot, but then you should see your old channels and balances. +To recover all your LND data you must still be able to SSH into the RaspiBlitz (minimum v1.1) and the HDD should be still useable/reachable (mounted) - even it shows some errors. If this is not possible anymore you should skip to the second option "Recover from Wallet Seed". -**Be aware that if backup is some hours/days old, channels could have been closed by the other party and it may take some time until you see funds back on-chain. If backup is somewhat older also the channel counter parties may have used your offline time to cheat you with an old state. And if your backup was not the latest state and LND is closing channels it could also been happening that you are posting an old channel state (seen as cheating) and funds of that channel get lost as punishment. So again .. this backup method can be risky, use with caution.** +If you still can SSH in and HDD is readable, we can try to rescue/export your LND data (funds and channels) from a RaspiBlitz to then be able to restore it back to a fresh one. For this you can use the following procedure ... -## What is this mnemonic seed word list? +To rescue/export your Lightning data from a RaspiBlitz: -With the 24 word list given you by LND on wallet creation you can recover your private key (BIP 39). You should write it down and store it at a save place. +* SSH into your RaspiBlitz and EXIT to terminal from the menu. +* then run: `/home/admin/config.scripts/lnd.rescue.sh backup` +* follow the instructions of the script. -For more background on mnemonic seeds see this video: https://www.youtube.com/watch?v=wWCIQFNf_8g +This will create a lnd-rescue file (ends on gz.tar) that contains all the data from the LND. The script offers you a command to transfere the lnd-rescue file to your laptop. If transfere was successfull. You can now setup a fresh RaspiBlitz. Do all the setup until you have a clean new Lightning node running - just without any funding or channels. -## How does PASSWORD D effects the word seed? - -On wallet creation you get asked if you want to protect your word seed list with an additional password. If you choose so, RaspiBlitz recommends you to use your PASSWORD D at this point. - -To use a an additional password for your seed words is optional. If you choose so, you will need the password to recover your private key from your your seed words later on. Without this password your private key cannot be recovered from your seed words. So the password adds an additional layer of security, if someone finds your written down word list. +Then to restore your old LND data and to recover your funds and channels: -## How can I recover my coins from a failing RaspiBlitz? +* SSH into your new RaspiBlitz and EXIT to terminal from the menu. +* then run: `/home/admin/config.scripts/lnd.rescue.sh restore` +* follow the instructions of the script. -You might run into a situation where your hardware fails or the software starts to act buggy. So you decide to setup a fresh RaspiBlitz, like in the chapter above "Update to a new SD Card Release" - but the closing channels and cashing out is not working anymore. So whats about the funds you already have on your failing setup? +This script will offer you a way to transfere the lnd-rescue file from your laptop to the new RaspiBlitz and will restore the old data. LND gets then restarted for you and after some time it should show you the status screen again with your old funds and channels. -There is not a perfect way yet to backup/recover your coins, but you can try the following to make the best out of the situation: +**Be aware that if backup is some hours old, channels could have been closed by the other party and it may take some time until you see funds back on-chain. If backup is somewhat older then 1 day also the channel counter parties may have used your offline time to cheat you with an old state. And if your backup was not the latest state it could also been happening that you are posting an old channel state (seen as cheating) and funds of that channel get lost as punishment. So again .. this backup method can be risky, use with caution. But its recommended to try in recover and rescue situations - its not for regular backups.** -### 1) Recover from Wallet Seed +### 2) Recover from Wallet Seed Remember those 24 words you were writing down during the setup? Thats your "cipher seed" - now this words are important to recover your wallet. If you dont have them anymore: skip this chapter and read option 2. If you still have the cypher seed: good, but read the following carefully: With the cypher seed you can recover the bitcoin wallet that LND was managing for you - but it does not contain all the details about the channels you have open - its just the key to your funding wallet. If you were able to close all channels or never opened any channels, then everything is OK and you can go on. If you had open channels with funds in there, the following is to consider: -* You now rely on your channel counter parts to force close the channel at one point. If they do, the coins will be available to use in your funding wallet again at one point in the future - after force close delay. +* You now rely on your channel counter parts to force close the channel at one point. If they do, the coins will be available to use in your funding wallet again at one point in the future - after force close delay (but see also [#278](https://github.com/rootzoll/raspiblitz/issues/278) ). * If your channel counter parts never force close the channel (because they are offline too) your channel funds can be frozen forever. So going this way there is a small risk, that you will not recover your funds. But normally if your channel counter parts are still online, see that you will not come back online and they have themselves some funds on their channel side with you: They have an incentive to force close the channel to make use of their funds again. @@ -178,19 +178,17 @@ Then give LND some time to rescan the blockchain. In the end you will have resto *Important: If you see a zero balance for on-chain funds after restoring from seed ... see details discussed [here](https://github.com/rootzoll/raspiblitz/issues/278) - you might try setup fresh this time with bigger look-ahead number.* -### 2) LND Channel State Backup +## What is this mnemonic seed word list? -This second option is very very risky and can lead to complete loss of funds. And it olny can work, if you can still access the HDD content of your failing RaspiBlitz. It should only be used if you lost your cypher seed for the option above, forgot your cypher seed encryption password or your old channel counter parts are offline, too. +With the 24 word list given you by LND on wallet creation you can recover your private key (BIP 39). You should write it down and store it at a save place. -What you do is in priciple: -- Make a copy of the HDD directory `/mnt/hdd/lnd` -- Setup a fresh RaspiBlitz -- Stop LND with `sudo systemctl stop lnd` -- Replace the new `/mnt/hdd/lnd` with your backuped version -- Make sure everything in `/mnt/hdd/lnd` is owned by bitcoin:bitcoin -- Reboot the RaspiBlitz +For more background on mnemonic seeds see this video: https://www.youtube.com/watch?v=wWCIQFNf_8g -This is highly experimental. And again: If you restore the LND with an backup that is not representing the latest channel state, this will trigger the lightning "penalty" mechanism - allowing your channel counter part to grab all the funds from a channel. Its a measure of last resort. But if its working for you, let us know. +## How does PASSWORD D effects the word seed? + +On wallet creation you get asked if you want to protect your word seed list with an additional password. If you choose so, RaspiBlitz recommends you to use your PASSWORD D at this point. + +To use a an additional password for your seed words is optional. If you choose so, you will need the password to recover your private key from your your seed words later on. Without this password your private key cannot be recovered from your seed words. So the password adds an additional layer of security, if someone finds your written down word list. ## How do I change the Name/Alias of my lightning node diff --git a/home.admin/00infoBlitz.sh b/home.admin/00infoBlitz.sh index da69057..6073a20 100755 --- a/home.admin/00infoBlitz.sh +++ b/home.admin/00infoBlitz.sh @@ -289,7 +289,7 @@ ${color_yellow}${ln_publicColor}${ln_external} "-------------------------------------------" \ "load average:${load##up*, }" "${temp}" \ "${hdd}" "${sync_percentage}" -if [ "${runBehindTor}" != "on" ]; then - # one extra space line at the end if nodeaddress is not TOR - echo "" + +if [ ${#undervoltageReports} -gt 0 ] && [ "${undervoltageReports}" != "0" ]; then + echo "${undervoltageReports} undervoltage reports found in syslog" fi diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index 5f40455..59b79e2 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -134,18 +134,85 @@ waitUntilChainNetworkIsReady() echo "can take longer if device was off or first time" while : do + + # check for error on network sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 1>/dev/null 2>error.tmp clienterror=`cat error.tmp` rm error.tmp + + # check for missing blockchain data + blockchainsize=$(sudo du /mnt/hdd/bitcoin | head -n1 | awk '{print $1;}') + echo "blockchainsize(${blockchainsize})" + if [ ${#blockchainsize} -gt 0 ]; then + if [ ${blockchainsize} -lt 1000000 ]; then + echo "Mission Blockchain Data ..." + clienterror="missing blockchain" + sleep 3 + fi + fi + if [ ${#clienterror} -gt 0 ]; then # analyse LOGS for possible reindex reindex=$(sudo cat /mnt/hdd/${network}/debug.log | grep -c 'Please restart with -reindex or -reindex-chainstate to recover') - if [ ${reindex} -gt 0 ]; then - echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair script." + if [ ${reindex} -gt 0 ] || [ "${clienterror}" = "missing blockchain" ]; then + echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options." sleep 3 - sudo /home/admin/config.scripts/network.reindex.sh - exit + + dialog --backtitle "RaspiBlitz - Repair Script" --msgbox "Your blockchain data needs to be repaired. +This can be due to power problems or a failing HDD. +Please check the FAQ on RaspiBlitz Github +'My blockchain data is corrupted - what can I do?' +https://github.com/rootzoll/raspiblitz/blob/master/FAQ.md + +The RaspiBlitz will now try to help you on with the repair. +To run a BACKUP of funds & channels first is recommended. +" 13 65 + + clear + # Basic Options + OPTIONS=(TORRENT "Redownload Prepared Torrent (DEFAULT)" \ + COPY "Copy from another Computer (SKILLED)" \ + REINDEX "Resync thru ${network}d (TAKES VERY VERY LONG)" \ + BACKUP "Run Backup LND data first (optional)" + ) + + CHOICE=$(dialog --backtitle "RaspiBlitz - Repair Script" --clear --title "Repair Blockchain Data" --menu "Choose a repair/recovery option:" 11 60 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) + + clear + if [ "${CHOICE}" = "TORRENT" ]; then + echo "Starting TORRENT ..." + sudo sed -i "s/^state=.*/state=retorrent/g" /home/admin/raspiblitz.info + /home/admin/50torrentHDD.sh + /home/admin/00mainMenu.sh + exit + + elif [ "${CHOICE}" = "COPY" ]; then + echo "Starting COPY ..." + sudo sed -i "s/^state=.*/state=recopy/g" /home/admin/raspiblitz.info + /home/admin/50copyHDD.sh + /home/admin/00mainMenu.sh + exit + + elif [ "${CHOICE}" = "REINDEX" ]; then + echo "Starting REINDEX ..." + sudo /home/admin/config.scripts/network.reindex.sh + exit + + elif [ "${CHOICE}" = "BACKUP" ]; then + sudo /home/admin/config.scripts/lnd.rescue.sh backup + echo "PRESS ENTER to return to menu." + read key + /home/admin/00mainMenu.sh + exit + + else + echo "CANCEL" + exit + fi + + else + echo "${network} error: ${clienterror}" fi # normal info diff --git a/home.admin/50copyHDD.sh b/home.admin/50copyHDD.sh index 302003f..03308c6 100755 --- a/home.admin/50copyHDD.sh +++ b/home.admin/50copyHDD.sh @@ -6,11 +6,31 @@ source /home/admin/raspiblitz.info # get local ip localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') +# Basic Options +OPTIONS=(UNIX "MacOS or Linux" \ + WINDOWS "Windows" + ) + +CHOICE=$(dialog --clear --title "Which System is running on the other computer?" --menu "" 11 60 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) + +clear +case $CHOICE in + UNIX) echo "Linus";; + WINDOWS) echo "Bill";; + *) exit 1;; +esac + +if [ -d "/mnt/hdd/bitcoin" ]; then + dialog --title "Prepare Copy" --yesno "Do you want to delete the old/local blockchain data now?" 8 60 + response=$? + echo "response(${response})" + case $response in + 1) exit 1 ;; + esac +fi + # additional prep if this is used to replace corrupted blockchain if [ "${setupStep}" = "100" ]; then - # warn user - echo "!! Press ENTER to delete the old blockchain .. CTRL+C to CANCEL" - read key # make sure services are not running echo "stopping servcies ..." sudo systemctl stop lnd @@ -21,14 +41,18 @@ fi # delete all IN bitcoin directory but not itself if it exists # so that possibel link to /home/bitcoin/.bitcoin nicht beschädigt wird +# also keep debug logs for repair script +sudo mv /mnt/hdd/bitcoin/debug.log /home/admin/debug.log 2>/dev/null sudo rm -rfv /mnt/hdd/bitcoin/* 2>/dev/null +sudo mv /home/admin/debug.log /mnt/hdd/bitcoin/debug.log 2>/dev/null # make sure /mnt/hdd/bitcoin exists sudo mkdir /mnt/hdd/bitcoin 2>/dev/null -# allow all users write to it () +# allow all users write to it sudo chmod 777 /mnt/hdd/bitcoin +echo clear echo "************************************************************************************" echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from another computer" @@ -45,7 +69,11 @@ echo "blockchain data. You should see directories 'blocks', 'chainstate' & 'inde echo "Make sure the bitcoin client on that computer is stopped." echo "" echo "COPY, PASTE & EXECUTE the following command on the blockchain source computer:" -echo "sudo scp -r ./chainstate ./indexes ./testnet3 ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin" +if [ "${CHOICE}" = "WINDOWS" ]; then + echo "sudo scp -r ./chainstate ./indexes ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin" +else + echo "sudo rsync -avhW --info=progress2 ./chainstate ./indexes ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin" +fi echo "" echo "This command may ask you first about the admin password of the other computer (because sudo)." echo "Then it will ask for your SSH PASSWORD A from this RaspiBlitz." @@ -101,6 +129,7 @@ if [ ${anyDataAtAll} -eq 1 ]; then else echo "OK -> DATA LOOKS GOOD :D" + sudo rm /mnt/hdd/bitcoin/debug.log fi diff --git a/home.admin/50torrentHDD.sh b/home.admin/50torrentHDD.sh index 9e8d731..c5631ba 100755 --- a/home.admin/50torrentHDD.sh +++ b/home.admin/50torrentHDD.sh @@ -263,9 +263,10 @@ if [ "${setupStep}" = "100" ]; then sudo systemctl disable ${network}d sudo cp -f /mnt/hdd/${network}/${network}.conf /home/admin/assets/${network}.conf sudo rm -rfv /mnt/hdd/${network}/* 2>/dev/null + sudo rm /mnt/hdd/${network}/debug.log fi -# Download worked / just move, copy on USB2 >4h +# Download worked / just move, copy on USB2 would be >4h echo "" echo "*** Moving Files ***" date +%s diff --git a/home.admin/XXdebugLogs.sh b/home.admin/XXdebugLogs.sh index c494ac2..31057c1 100644 --- a/home.admin/XXdebugLogs.sh +++ b/home.admin/XXdebugLogs.sh @@ -40,7 +40,10 @@ echo "*** CHAINNETWORK SYSTEMD STATUS ***" sudo systemctl status ${network}d -n2 --no-pager echo "" -echo "*** LAST 20 CHAINNETWORK LOGS ***" +echo "*** LAST 5 ERROR LOGS ***" +sudo journalctl -u ${network}d -b --no-pager -n5 +echo "" +echo "*** LAST 20 INFO LOGS ***" pathAdd="" if [ "${chain}" = "test" ]; then pathAdd="/testnet3" @@ -52,8 +55,11 @@ echo "*** LND SYSTEMD STATUS ***" sudo systemctl status lnd -n2 --no-pager echo "" -echo "*** LAST 20 LND LOGS ***" -sudo journalctl -u lnd -b --no-pager -n20 +echo "*** LAST 5 LND ERROR LOGS ***" +sudo journalctl -u lnd -b --no-pager -n5 +echo "" +echo "*** LAST 20 LND INFO LOGS ***" +sudo tail -n 20 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log echo "" if [ "${rtlWebinterface}" = "on" ]; then diff --git a/home.admin/_background.sh b/home.admin/_background.sh index f9310a1..35204b5 100644 --- a/home.admin/_background.sh +++ b/home.admin/_background.sh @@ -60,6 +60,25 @@ do fi + #################################################### + # CHECK FOR UNDERVOLTAGE REPORTS + # every 1 hour scan for undervoltage reports + #################################################### + recheckUndervoltage=$(($counter % 3600)) + if [ ${recheckUndervoltage} -eq 1 ]; then + echo "*** RECHECK UNDERVOLTAGE ***" + countReports=$(sudo cat /var/log/syslog | grep -c "Under-voltage detected!") + echo "${countReports} undervoltage reports found in syslog" + if [ ${#undervoltageReports} -eq 0 ]; then + # write new value to info file + undervoltageReports="${countReports}" + echo "undervoltageReports=${undervoltageReports}" >> ${infoFile} + else + # update value in info file + sed -i "s/^undervoltageReports=.*/undervoltageReports=${countReports}/g" ${infoFile} + fi + fi + #################################################### # RECHECK PUBLIC IP # when public IP changes, restart LND with new IP diff --git a/home.admin/assets/RTL.service b/home.admin/assets/RTL.service index 2264870..32c72f3 100644 --- a/home.admin/assets/RTL.service +++ b/home.admin/assets/RTL.service @@ -12,6 +12,8 @@ User=root Restart=always TimeoutSec=120 RestartSec=30 +StandardOutput=null +StandardError=journal [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/home.admin/assets/bitcoind.service b/home.admin/assets/bitcoind.service index 5503649..6bbb743 100644 --- a/home.admin/assets/bitcoind.service +++ b/home.admin/assets/bitcoind.service @@ -18,6 +18,8 @@ KillMode=process Restart=always TimeoutSec=120 RestartSec=30 +StandardOutput=null +StandardError=journal [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/home.admin/assets/bootstrap.service b/home.admin/assets/bootstrap.service index 11244a5..f07a41b 100644 --- a/home.admin/assets/bootstrap.service +++ b/home.admin/assets/bootstrap.service @@ -12,6 +12,7 @@ Type=oneshot RemainAfterExit=true ExecStart=/home/admin/_bootstrap.sh StandardOutput=journal +StandardError=journal [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/home.admin/assets/lnd.service b/home.admin/assets/lnd.service index d500893..6af4d7a 100644 --- a/home.admin/assets/lnd.service +++ b/home.admin/assets/lnd.service @@ -20,6 +20,8 @@ KillMode=process TimeoutSec=180 Restart=always RestartSec=60 +StandardOutput=null +StandardError=journal [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/home.admin/config.scripts/lnd.newtlscert.sh b/home.admin/config.scripts/lnd.newtlscert.sh index 112415f..2b4b2ae 100644 --- a/home.admin/config.scripts/lnd.newtlscert.sh +++ b/home.admin/config.scripts/lnd.newtlscert.sh @@ -5,8 +5,10 @@ echo "making sure services are not running" sudo systemctl stop lnd 2>/dev/null -echo "deleting TLSCert" -sudo rm /mnt/hdd/lnd/tls.* 2>/dev/null +echo "keep old tls data as backup" +sudo mv /mnt/hdd/lnd/tls.cert /mnt/hdd/lnd/tls.cert.old +sudo mv /mnt/hdd/lnd/tls.key /mnt/hdd/lnd/tls.key.old + echo "let lnd generate new TLSCert" sudo -u bitcoin /usr/local/bin/lnd &>/dev/null & echo "wait until generated" diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh new file mode 100755 index 0000000..2adc136 --- /dev/null +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -0,0 +1,151 @@ +#!/bin/bash + +# command info +if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then + echo "small rescue script to to backup or restore" + echo "lnd.rescue.sh [backup|restore]" + exit 1 +fi + +localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') + +mode="$1" +if [ ${mode} = "backup" ]; then + + ################################ + # BACKUP + ################################ + + echo "*** LND.RESCUE --> BACKUP" + + # stop LND + echo "Stopping lnd..." + sudo systemctl stop lnd + sleep 5 + echo "OK" + echo + + # zip it + sudo tar -zcvf /home/admin/lnd-rescue.tar.gz /mnt/hdd/lnd + sudo chown admin:admin /home/admin/lnd-rescue.tar.gz + + # name with md5 checksum + md5checksum=$(md5sum /home/admin/lnd-rescue.tar.gz | head -n1 | cut -d " " -f1) + mv /home/admin/lnd-rescue.tar.gz /home/admin/lnd-rescue-${md5checksum}.tar.gz + + # offer SCP for download + echo + echo "****************************" + echo "* DOWNLOAD THE BACKUP FILE *" + echo "****************************" + echo + echo "RUN THE FOLLOWING COMMAND ON YOUR LAPTOP IN NEW TERMINAL:" + echo "scp -r admin@${localip}:/home/admin/lnd-rescue-*.tar.gz ./" + echo "" + echo "Use password A to authenticate file transfere." + echo + echo "BEWARE: Your Lightning node is now stopped. So its safe to backup the data and restore it" + echo "later on - for example on a fresh RaspiBlitz. But once this Lightning node gets started" + echo "again by 'sudo systemctl start lnd' or a reboot its not adviced to restore the backup file" + echo "anymore bacause it cointains outdated channel data and can lead to loss of channel funds." + +elif [ ${mode} = "restore" ]; then + + ################################ + # RESTORE + ################################ + + echo "*** LND.RESCUE --> RESTORE" + echo "" + + filename="" + while [ ${#filename} -eq 0 ] + do + countZips=$(sudo ls /home/admin/lnd-rescue-*.tar.gz 2>/dev/null | grep -c 'lnd-rescue') + if [ ${countZips} -lt 1 ]; then + echo "**************************" + echo "* UPLOAD THE BACKUP FILE *" + echo "**************************" + echo + echo "If you have a lnd-rescue backup file on your laptop you can now" + echo "upload it and restore the your old LND state." + echo + echo "To make upload open a new terminal on your laptop," + echo "change into the directory where your lnd-rescue file is and" + echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:" + echo "scp -r ./lnd-rescue-*.tar.gz admin@${localip}:/home/admin/" + echo "" + echo "Use password A to authenticate file transfere." + echo + echo "PRESS ENTER when upload is done. Use CTRL-C to abort." + fi + if [ ${countZips} -gt 1 ]; then + echo "!! WARNING !!" + echo "There are multiple lnd-rescue files in directory /home/admin." + echo "Make sure there is only one file to work with and start again." + echo + exit 1 + fi + if [ ${countZips} -eq 1 ]; then + + clear + echo + echo "**************************" + echo "* RESTORING BACKUP FILE *" + echo "**************************" + echo + + filename=$(sudo ls /home/admin/lnd-rescue-*.tar.gz) + echo "OK -> found file to restore: ${filename}" + + md5checksum=$(md5sum ${filename} | head -n1 | cut -d " " -f1) + isCorrect=$(echo ${filename} | grep -c ${md5checksum}) + if [ ${isCorrect} -eq 1 ]; then + echo "OK -> checksum looks good: ${md5checksum}" + else + echo "!!! FAIL -> Checksum not correct." + echo "Maybe transfere failed? Continue on your own risk!" + echo "Recommend to abort and upload again!" + fi + + echo + echo "WARNING: This will delete the actual LND state/funds of this RaspiBlitz." + echo + echo "PRESS ENTER to start restore. Use CTRL-C to abort." + fi + read key + done + + # stop LND + echo "Stopping lnd..." + sudo systemctl stop lnd + sleep 5 + echo "OK" + echo + + # clean DIR + echo "Cleaning LND data ..." + sudo rm -r /mnt/hdd/lnd/* + echo "OK" + echo + + # unpack zip + echo "Restoring LND data from ${filename} ..." + sudo tar -xf ${filename} -C / + sudo chown -R bitcoin:bitcoin /mnt/hdd/lnd + echo "OK" + echo + + # start LND + echo "Starting lnd..." + sudo systemctl start lnd + echo "OK" + echo + + echo "DONE - please check if LND starts up correctly with restored state and funds." + echo "Keep in mind that some channels got forced closed by channel partners in the meanwhile." + echo + +else + echo "unknown parameter '${mode}' - exit" +fi \ No newline at end of file diff --git a/shoppinglist_au.md b/shoppinglist_au.md index 788b742..9030c12 100644 --- a/shoppinglist_au.md +++ b/shoppinglist_au.md @@ -2,7 +2,7 @@ ## Shopping List: Amazon Australia * RaspBerry Pi 3: https://www.amazon.com/RS-Components-Raspberry-Pi-Motherboard/dp/B07BFH96M3 -* Micro SD-Card 16GB: https://www.amazon.com/SanDisk-Mobile-MicroSDHC-SDSDQM-B35A-Adapter/dp/B004ZIENBA +* Micro SD-Card 32GB: https://www.amazon.com/Samsung-Endurance-32GB-Micro-Adapter/dp/B07B98GXQT * Power: https://www.amazon.com.au/Ils-Supply-Adapter-Charger-Raspberry/dp/B07F2JLSCL/ * 1TB Hard Drive: https://www.amazon.com/Toshiba-Advance-Portable-External-HDTC910XR3AA/dp/B079H7VYY6 * Case: https://www.amazon.com/Raspberry-Model-Protective-Heatsinks-Clear/dp/B01CDVSBPO diff --git a/shoppinglist_ca.md b/shoppinglist_ca.md index 2d8594c..06272b9 100644 --- a/shoppinglist_ca.md +++ b/shoppinglist_ca.md @@ -1,7 +1,7 @@ ## Shopping List: Amazon Canada * RaspBerry Pi 3: https://amzn.to/2NDLD31 -* Micro SD-Card 16GB: https://amzn.to/2NEXWMa +* Micro SD-Card 32GB: https://www.amazon.ca/Samsung-Endurance-Micro-Adapter-MB-MJ32GA/dp/B07DTFRNRJ * Power: https://amzn.to/2NCdCju * 1TB Hard Drive: https://amzn.to/2NF0lqj * LCD-Display + Case + Pen: https://amzn.to/2GWx3D8 diff --git a/shoppinglist_cz.md b/shoppinglist_cz.md index ac9ea47..2065bb5 100644 --- a/shoppinglist_cz.md +++ b/shoppinglist_cz.md @@ -1,9 +1,9 @@ ## Shopping List: Amazon/Alza/CZC Czech - RaspBerry Pi 3: https://www.alza.cz/raspberry-pi-3-model-b-d5284636.htm?o=1 -- Micro SD-Card 16GB: https://www.alza.cz/EN/kingston-micro-sdhc-16gb-class-10-uhs-i-industrial-temp-sd-adapter?dq=4156874&o=2 +- Micro SD-Card 32GB: https://www.alza.cz/EN/samsung-microsdhc-32gb-pro-endurance-uhs-i-u1-sd-adapter-d5339757.htm - Power: https://www.alza.cz/EN/alzapower-q100-quick-charge-3-0-black-d5324257.htm?o=2 - maybe you need an micro usb cable - 1TB Hard Drive: https://www.czc.cz/toshiba-canvio-basics-1tb-cerna/235949/produkt?gclid=EAIaIQobChMIgpLF5Mac3gIVCM53Ch3D9QWpEAQYAyABEgK-ZfD_BwE - Case: https://www.alza.cz/EN/raspberry-pi-black-d3837597.htm?o=1 -- LCD-Display (delivered to Czech Republic): https://www.amazon.com/dp/B01N3JROH8/ref=cm_sw_r_cp_ep_dp_-gOuBb2Q6T0C5 +- LCD-Display (delivered to Czech Republic): https://www.amazon.com/dp/B01N3JROH8/ref=cm_sw_r_cp_ep_dp_-gOuBb2Q6T0C5 \ No newline at end of file diff --git a/shoppinglist_de.md b/shoppinglist_de.md index 313da81..dc955f3 100644 --- a/shoppinglist_de.md +++ b/shoppinglist_de.md @@ -1,7 +1,7 @@ ## Shopping List: Amazon Germany * RaspBerry Pi 3: https://www.amazon.de/dp/B07BDR5PDW -* Micro SD-Card 16GB: https://www.amazon.de/gp/product/B073K14CVB/ +* Micro SD-Card 32GB: https://www.amazon.de/Samsung-MB-MJ32GA-EU-microSDXC-Endurance * Power >=3A: https://www.amazon.de/gp/product/B01JZE38QE * 1TB Hard Drive: https://www.amazon.de/dp/B07997KKSK?th=1 * Case: https://www.amazon.de/dp/B0173GQF8Y diff --git a/shoppinglist_es.md b/shoppinglist_es.md index 224bd5e..310a569 100644 --- a/shoppinglist_es.md +++ b/shoppinglist_es.md @@ -1,7 +1,7 @@ ## Shopping List: Amazon Spain * RaspBerry Pi 3: https://www.amazon.es/gp/product/B07BDR5PDW/ -* Micro SD-Card 16GB: https://www.amazon.es/gp/product/B073K14CVB/ +* Micro SD-Card 32GB: https://www.amazon.es/Samsung-Pro-Endurance-microSDHC-Adaptador/dp/B07CY3QSST * Power: https://www.amazon.es/gp/product/B01JZE38QE * 1TB Hard Drive: https://www.amazon.es/gp/product/B07997KKSK/ * Case: https://www.amazon.es/gp/product/B07DK4CRHS/ diff --git a/shoppinglist_fr.md b/shoppinglist_fr.md index 8d9182b..e57933c 100644 --- a/shoppinglist_fr.md +++ b/shoppinglist_fr.md @@ -1,7 +1,7 @@ ## Shopping List: Amazon France * RaspBerry Pi 3: https://www.amazon.fr/dp/B07BDR5PDW -* Micro SD-Card 16GB: https://www.amazon.fr/dp/B073K14CVB/ +* Micro SD-Card 32GB: https://www.amazon.fr/SANDISK-Adaptateur-Logiciel-Récupération-RescuePRO/dp/B06XWMQ81P/ * Power: https://www.amazon.fr/dp/B01566WOAG * 1TB Hard Drive: https://www.amazon.fr/dp/B07997KKSK * Case: https://www.amazon.fr/dp/B0173GQF70/ diff --git a/shoppinglist_uk.md b/shoppinglist_uk.md index dc22f14..fd42a4d 100644 --- a/shoppinglist_uk.md +++ b/shoppinglist_uk.md @@ -1,7 +1,7 @@ ## Shopping List: Amazon UK * RaspBerry Pi 3: https://www.amazon.co.uk/Raspberry-Pi-Model-64-Bit-Processor/dp/B07BDR5PDW -* Micro SD-Card 16GB: https://www.amazon.co.uk/Kingston-SDC10G2-16GB-microSDHC-Included/dp/B0162YQEIE +* Micro SD-Card 32GB: https://www.amazon.co.uk/Samsung-Endurance-MicroSDHC-Memory-Adapter/dp/B07CY3QSST * Power: https://www.amazon.co.uk/iTrunk-Raspberry-Model-Supply-Charger/dp/B01MFFSPHE or https://www.amazon.co.uk/dp/B07MLZQXS7 * 1TB Hard Drive: https://www.amazon.co.uk/Toshiba-Canvio-Basics-Portable-External/dp/B00KWHJY7Q * Case: https://www.amazon.co.uk/SB-Components-Transparent-Case-Raspberry/dp/B0173GQF8Y diff --git a/shoppinglist_usa.md b/shoppinglist_usa.md index 623d503..1ed0fa8 100644 --- a/shoppinglist_usa.md +++ b/shoppinglist_usa.md @@ -1,7 +1,7 @@ ## Shopping List: Amazon USA * RaspBerry Pi 3: http://a.co/ahl7RIp -* Micro SD-Card 16GB: http://a.co/d/710f4oJ +* Micro SD-Card 32GB: https://www.amazon.com/Samsung-Endurance-32GB-Micro-Adapter/dp/B07B98GXQT * Power: http://a.co/d/fVVOYZZ * 1TB Hard Drive: http://a.co/eUgVfLd * Case: http://a.co/1774Hwl