From 17b9fe2dc69964dc19c2106099f7bae9de4e0549 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 15 Mar 2019 14:43:35 +0100 Subject: [PATCH 01/31] #324 backup tls instead of delete --- home.admin/config.scripts/lnd.newtlscert.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/home.admin/config.scripts/lnd.newtlscert.sh b/home.admin/config.scripts/lnd.newtlscert.sh index 112415f61..2b4b2ae7d 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" From 1db3f008eff7c92077c7b76449997822f79e5073 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 15 Mar 2019 15:03:59 +0100 Subject: [PATCH 02/31] #424 just error logging on sd card --- home.admin/assets/RTL.service | 2 ++ home.admin/assets/bitcoind.service | 2 ++ home.admin/assets/bootstrap.service | 1 + home.admin/assets/lnd.service | 2 ++ 4 files changed, 7 insertions(+) diff --git a/home.admin/assets/RTL.service b/home.admin/assets/RTL.service index 226487007..32c72f326 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 550364914..6bbb743bc 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 11244a582..f07a41bf0 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 d500893cf..6af4d7a5c 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 From 602be668ac12efe5e12c0339ca79cd56be3b0102 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 15 Mar 2019 15:07:47 +0100 Subject: [PATCH 03/31] use log files directly --- home.admin/XXdebugLogs.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/home.admin/XXdebugLogs.sh b/home.admin/XXdebugLogs.sh index c494ac26e..732e3f0cf 100644 --- a/home.admin/XXdebugLogs.sh +++ b/home.admin/XXdebugLogs.sh @@ -45,6 +45,7 @@ pathAdd="" if [ "${chain}" = "test" ]; then pathAdd="/testnet3" fi +sudo journalctl -u ${network}d -b --no-pager -n5 sudo tail -n 20 /mnt/hdd/${network}${pathAdd}/debug.log echo "" @@ -53,7 +54,8 @@ sudo systemctl status lnd -n2 --no-pager echo "" echo "*** LAST 20 LND LOGS ***" -sudo journalctl -u lnd -b --no-pager -n20 +sudo journalctl -u lnd -b --no-pager -n5 +sudo tail -n 20 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log echo "" if [ "${rtlWebinterface}" = "on" ]; then From c9cfeaa7d6bb7b8eda359893003a19a762a01036 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 15 Mar 2019 15:10:23 +0100 Subject: [PATCH 04/31] error and info logs --- home.admin/XXdebugLogs.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/home.admin/XXdebugLogs.sh b/home.admin/XXdebugLogs.sh index 732e3f0cf..d35ba7e89 100644 --- a/home.admin/XXdebugLogs.sh +++ b/home.admin/XXdebugLogs.sh @@ -40,12 +40,13 @@ 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 "*** LAST 20 INFO LOGS ***" pathAdd="" if [ "${chain}" = "test" ]; then pathAdd="/testnet3" fi -sudo journalctl -u ${network}d -b --no-pager -n5 sudo tail -n 20 /mnt/hdd/${network}${pathAdd}/debug.log echo "" @@ -53,8 +54,9 @@ echo "*** LND SYSTEMD STATUS ***" sudo systemctl status lnd -n2 --no-pager echo "" -echo "*** LAST 20 LND LOGS ***" +echo "*** LAST 5 LND ERROR LOGS ***" sudo journalctl -u lnd -b --no-pager -n5 +echo "*** LAST 20 LND INFO LOGS ***" sudo tail -n 20 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log echo "" From 88a26f881c5d00c3af34b134a6f02ca9d5e93b32 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 15 Mar 2019 15:11:28 +0100 Subject: [PATCH 05/31] formatting logs --- home.admin/XXdebugLogs.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/home.admin/XXdebugLogs.sh b/home.admin/XXdebugLogs.sh index d35ba7e89..31057c1c4 100644 --- a/home.admin/XXdebugLogs.sh +++ b/home.admin/XXdebugLogs.sh @@ -42,6 +42,7 @@ echo "" 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 @@ -56,6 +57,7 @@ echo "" 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 "" From 215deda60d6e1e5bb450bf8b157af742ada69f12 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 15 Mar 2019 15:43:16 +0100 Subject: [PATCH 06/31] #428 count under-voltage reports --- home.admin/00infoBlitz.sh | 6 +++--- home.admin/_background.sh | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/home.admin/00infoBlitz.sh b/home.admin/00infoBlitz.sh index da69057ad..66da094a4 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 ]; then + echo "${countReports} undervoltage reports found in syslog" fi diff --git a/home.admin/_background.sh b/home.admin/_background.sh index f9310a1cc..35204b5d8 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 From e37e01ec056c0778d659bb29b1755f8154713c77 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 15 Mar 2019 15:54:47 +0100 Subject: [PATCH 07/31] undervoltage warnings --- home.admin/00infoBlitz.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home.admin/00infoBlitz.sh b/home.admin/00infoBlitz.sh index 66da094a4..6073a20a4 100755 --- a/home.admin/00infoBlitz.sh +++ b/home.admin/00infoBlitz.sh @@ -290,6 +290,6 @@ ${color_yellow}${ln_publicColor}${ln_external} "load average:${load##up*, }" "${temp}" \ "${hdd}" "${sync_percentage}" -if [ ${#undervoltageReports} -gt 0 ]; then - echo "${countReports} undervoltage reports found in syslog" +if [ ${#undervoltageReports} -gt 0 ] && [ "${undervoltageReports}" != "0" ]; then + echo "${undervoltageReports} undervoltage reports found in syslog" fi From 3e8c6bb615aa7867fabb0cc750da651f54b8831e Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 15 Mar 2019 17:56:06 +0100 Subject: [PATCH 08/31] #397 rsync for MacOS and Linux --- home.admin/50copyHDD.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/home.admin/50copyHDD.sh b/home.admin/50copyHDD.sh index 302003fb7..9828312c0 100755 --- a/home.admin/50copyHDD.sh +++ b/home.admin/50copyHDD.sh @@ -19,6 +19,21 @@ if [ "${setupStep}" = "100" ]; then sudo cp -f /mnt/hdd/bitcoin/bitcoin.conf /home/admin/assets/bitcoin.conf fi +# Basic Options +OPTIONS=(UNIX "MacOS or Linux" \ + WINDOWS "Windows" \ + BLITZ "RaspiBlitz" \ + ) + +CHOICE=$(dialog --clear --title "Which System is running on the other computer?" --menu "" 11 40 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) + +clear +case $CHOICE in + CLOSE) + exit 1; + ;; +esac + # delete all IN bitcoin directory but not itself if it exists # so that possibel link to /home/bitcoin/.bitcoin nicht beschädigt wird sudo rm -rfv /mnt/hdd/bitcoin/* 2>/dev/null @@ -26,7 +41,7 @@ sudo rm -rfv /mnt/hdd/bitcoin/* 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 clear @@ -45,7 +60,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 --progress ./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." From 0450d40db47cd18d0da40e42c9844b0d9bf72db1 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 15 Mar 2019 18:12:22 +0100 Subject: [PATCH 09/31] dialog fixes --- home.admin/50copyHDD.sh | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/home.admin/50copyHDD.sh b/home.admin/50copyHDD.sh index 9828312c0..9a17c64de 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 @@ -19,21 +39,6 @@ if [ "${setupStep}" = "100" ]; then sudo cp -f /mnt/hdd/bitcoin/bitcoin.conf /home/admin/assets/bitcoin.conf fi -# Basic Options -OPTIONS=(UNIX "MacOS or Linux" \ - WINDOWS "Windows" \ - BLITZ "RaspiBlitz" \ - ) - -CHOICE=$(dialog --clear --title "Which System is running on the other computer?" --menu "" 11 40 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) - -clear -case $CHOICE in - CLOSE) - exit 1; - ;; -esac - # delete all IN bitcoin directory but not itself if it exists # so that possibel link to /home/bitcoin/.bitcoin nicht beschädigt wird sudo rm -rfv /mnt/hdd/bitcoin/* 2>/dev/null From 090ac43b22e349337565b44d2dc5b92f6d9a2363 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 15 Mar 2019 18:20:16 +0100 Subject: [PATCH 10/31] #397 rsync total progress --- home.admin/50copyHDD.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home.admin/50copyHDD.sh b/home.admin/50copyHDD.sh index 9a17c64de..3a8520780 100755 --- a/home.admin/50copyHDD.sh +++ b/home.admin/50copyHDD.sh @@ -68,8 +68,8 @@ echo "COPY, PASTE & EXECUTE the following command on the blockchain source compu if [ "${CHOICE}" = "WINDOWS" ]; then echo "sudo scp -r ./chainstate ./indexes ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin" else - echo "sudo rsync -avhW --progress ./chainstate ./indexes ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin" -fi + 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." From 39704568d819e6eb4891af3bad62a54b6b3edb1f Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 15 Mar 2019 18:34:59 +0100 Subject: [PATCH 11/31] #424 update sd card to endurance version --- shoppinglist_au.md | 2 +- shoppinglist_ca.md | 2 +- shoppinglist_cz.md | 4 ++-- shoppinglist_de.md | 2 +- shoppinglist_es.md | 2 +- shoppinglist_fr.md | 2 +- shoppinglist_uk.md | 2 +- shoppinglist_usa.md | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/shoppinglist_au.md b/shoppinglist_au.md index 788b742d7..9030c126e 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 2d8594c3d..06272b964 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 ac9ea478f..2065bb589 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 313da81e4..dc955f316 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 224bd5eaa..310a5691a 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 8d9182bee..e57933cf4 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 dc22f146d..fd42a4d4c 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 623d5032c..1ed0fa89b 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 From 6d603f88a76c1dd4d9b4c7f57a2ef513b3d763d6 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sat, 16 Mar 2019 23:47:22 +0100 Subject: [PATCH 12/31] #427 lnd rescue script --- home.admin/config.scripts/lnd.rescue.sh | 143 ++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100755 home.admin/config.scripts/lnd.rescue.sh diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh new file mode 100755 index 000000000..caf3005b9 --- /dev/null +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -0,0 +1,143 @@ +#!/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) + mv /home/admin/lnd-rescue.tar.gz /home/admin/lnd-rescue-${md5checksum}.tar.gz + + # start LND + echo "Starting lnd..." + sudo systemctl start lnd + echo "OK" + echo + + # offer SCP for download + 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 + +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 | 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 admin@${localip}:/home/admin/lnd-rescue-*.tar.gz ./" + 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 to workd with and start again." + exit 1 + fi + if [ ${countZips} -eq 1 ]; then + + 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..." + 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 ..." + sudo tar -xfv ${filename} -C / + 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 From 88ba165d27aa55db5aadd0f8f80ee4ccef0ad297 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 00:19:31 +0100 Subject: [PATCH 13/31] fix checksum naming --- home.admin/config.scripts/lnd.rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh index caf3005b9..1f9ba4a3c 100755 --- a/home.admin/config.scripts/lnd.rescue.sh +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -30,7 +30,7 @@ if [ ${mode} = "backup" ]; then sudo chown admin:admin /home/admin/lnd-rescue.tar.gz # name with md5 checksum - md5checksum=$(md5sum /home/admin/lnd-rescue.tar.gz) + 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 # start LND From cd612ae55584cc8ad761aad6041c1405c20da278 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 00:24:06 +0100 Subject: [PATCH 14/31] remove error output --- home.admin/config.scripts/lnd.rescue.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh index 1f9ba4a3c..5b625ac0b 100755 --- a/home.admin/config.scripts/lnd.rescue.sh +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -62,7 +62,7 @@ elif [ ${mode} = "restore" ]; then filename="" while [ ${#filename} -eq 0 ] do - countZips=$(sudo ls /home/admin/lnd-rescue-*.tar.gz | grep -c 'lnd-rescue') + 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 *" @@ -83,7 +83,8 @@ elif [ ${mode} = "restore" ]; then 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 to workd with and start again." + echo "Make sure there is only one file to work with and start again." + echo exit 1 fi if [ ${countZips} -eq 1 ]; then From cfd6b5d3597063781f975b00e3aa4ea243111200 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 00:26:09 +0100 Subject: [PATCH 15/31] scp upload command --- home.admin/config.scripts/lnd.rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh index 5b625ac0b..91ca9803b 100755 --- a/home.admin/config.scripts/lnd.rescue.sh +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -74,7 +74,7 @@ elif [ ${mode} = "restore" ]; then 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 admin@${localip}:/home/admin/lnd-rescue-*.tar.gz ./" + echo "scp -r ./lnd-rescue-*.tar.gz admin@${localip}:/home/admin/" echo "" echo "Use password A to authenticate file transfere." echo From eb6fc653817d48b5cab9b81404bcec1bcafbedff Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 00:28:14 +0100 Subject: [PATCH 16/31] added sudo to stop lnd --- home.admin/config.scripts/lnd.rescue.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh index 91ca9803b..a1c0c6514 100755 --- a/home.admin/config.scripts/lnd.rescue.sh +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -89,6 +89,7 @@ elif [ ${mode} = "restore" ]; then fi if [ ${countZips} -eq 1 ]; then + clear filename=$(sudo ls /home/admin/lnd-rescue-*.tar.gz) echo "OK -> found file to restore: ${filename}" @@ -112,7 +113,7 @@ elif [ ${mode} = "restore" ]; then # stop LND echo "Stopping lnd..." - systemctl stop lnd + sudo systemctl stop lnd sleep 5 echo "OK" echo From 75eb88873b2c8bfc8dd8ee742ba49bb32d144eba Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 00:29:58 +0100 Subject: [PATCH 17/31] restore info --- home.admin/config.scripts/lnd.rescue.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh index a1c0c6514..4403fd1ea 100755 --- a/home.admin/config.scripts/lnd.rescue.sh +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -90,6 +90,12 @@ elif [ ${mode} = "restore" ]; then 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}" From 87c1e1f1f7a7e98ee4f3e4cca2ad5bf02414782c Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 00:31:20 +0100 Subject: [PATCH 18/31] debug output --- home.admin/config.scripts/lnd.rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh index 4403fd1ea..f2fa165a1 100755 --- a/home.admin/config.scripts/lnd.rescue.sh +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -95,7 +95,7 @@ elif [ ${mode} = "restore" ]; then echo "* RESTORING BACKUP FILE *" echo "**************************" echo - + filename=$(sudo ls /home/admin/lnd-rescue-*.tar.gz) echo "OK -> found file to restore: ${filename}" @@ -131,7 +131,7 @@ elif [ ${mode} = "restore" ]; then echo # unpack zip - echo "Restoring LND data ..." + echo "Restoring LND data from ${filename} ..." sudo tar -xfv ${filename} -C / echo "OK" echo From e273923457ab8870dcadc13857bedea4d98e2f11 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 00:32:03 +0100 Subject: [PATCH 19/31] fix tar restore --- home.admin/config.scripts/lnd.rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh index f2fa165a1..71ae9bb6d 100755 --- a/home.admin/config.scripts/lnd.rescue.sh +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -132,7 +132,7 @@ elif [ ${mode} = "restore" ]; then # unpack zip echo "Restoring LND data from ${filename} ..." - sudo tar -xfv ${filename} -C / + sudo tar -xf ${filename} -C / echo "OK" echo From 73a52244d85a5e6315295c3232ac1616a70bc5d2 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 00:34:25 +0100 Subject: [PATCH 20/31] set ownership after lnd data restore --- home.admin/config.scripts/lnd.rescue.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh index 71ae9bb6d..92e51bb18 100755 --- a/home.admin/config.scripts/lnd.rescue.sh +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -133,6 +133,7 @@ elif [ ${mode} = "restore" ]; then # unpack zip echo "Restoring LND data from ${filename} ..." sudo tar -xf ${filename} -C / + sudo chown -R bitcoin:bitcoin /mnt/hdd/lnd echo "OK" echo From 5ab800b5154d8d156d8cf07bd51a8bdb37b8eefa Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 00:56:42 +0100 Subject: [PATCH 21/31] dont restart LND on backup --- FAQ.md | 17 ++++++++++++++++- home.admin/config.scripts/lnd.rescue.sh | 10 ++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/FAQ.md b/FAQ.md index 1babd3b64..0cb524741 100644 --- a/FAQ.md +++ b/FAQ.md @@ -119,7 +119,22 @@ 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 + +How to backup LND data in a rescue situation see next question. + +## How to rescue/move LND data between two RaspiBlitzes? + +In some situations you may just want 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 ... + +To rescue/export your Lightning data from a RaspiBlitz: + +* 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. + +This will create a lnd-rescue file (ends on gz.tar) that contains all the data from the LND. + 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: diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh index 92e51bb18..f8ff7a4b6 100755 --- a/home.admin/config.scripts/lnd.rescue.sh +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -33,12 +33,6 @@ if [ ${mode} = "backup" ]; then 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 - # start LND - echo "Starting lnd..." - sudo systemctl start lnd - echo "OK" - echo - # offer SCP for download echo "****************************" echo "* DOWNLOAD THE BACKUP FILE *" @@ -49,6 +43,10 @@ if [ ${mode} = "backup" ]; then 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 From 13254b476a9678c6049b76e383db7049972e4ff8 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 01:06:05 +0100 Subject: [PATCH 22/31] Added v1.1 lnd rescue info --- FAQ.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/FAQ.md b/FAQ.md index 0cb524741..e4404b09d 100644 --- a/FAQ.md +++ b/FAQ.md @@ -133,20 +133,17 @@ To rescue/export your Lightning data from a RaspiBlitz: * then run: `/home/admin/config.scripts/lnd.rescue.sh backup` * follow the instructions of the script. -This will create a lnd-rescue file (ends on gz.tar) that contains all the data from the LND. +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. +Then to restore your old LND data and to recover your funds and channels: -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: +* 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. -`scp -r bitcoin@[LOCAL-IP-OF-RASPIBLITZ]:/mnt/hdd/lnd/ ./` use your password A +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. -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: - -`scp -r ./lnd/* bitcoin@[LOCAL-IP-OF-RASPIBLITZ]:/mnt/hdd/lnd/` use password A - -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. - -**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.** +**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.** ## What is this mnemonic seed word list? From 4a283a21565694ce4ccc1cd0efd3a7d271d4d220 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 01:21:53 +0100 Subject: [PATCH 23/31] updated failing Blitz info --- FAQ.md | 52 +++++++++++++++++++--------------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/FAQ.md b/FAQ.md index e4404b09d..aa37e85da 100644 --- a/FAQ.md +++ b/FAQ.md @@ -121,11 +121,17 @@ Recovering the coins that you have in an active channel is a bit more complicate 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 -How to backup LND data in a rescue situation see next question. +How to backup LND data in a rescue situation see next question "How can I recover my coins from a failing RaspiBlitz?". -## How to rescue/move LND data between two RaspiBlitzes? +## How can I recover my coins from a failing RaspiBlitz? -In some situations you may just want 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 ... +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". + +### 1) Recover LND data + +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". + +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 ... To rescue/export your Lightning data from a RaspiBlitz: @@ -145,31 +151,13 @@ This script will offer you a way to transfere the lnd-rescue file from your lapt **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.** -## What is this mnemonic seed word list? - -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. - -For more background on mnemonic seeds see this video: https://www.youtube.com/watch?v=wWCIQFNf_8g - -## 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 can I recover my coins from a failing RaspiBlitz? - -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? - -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: - -### 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. @@ -190,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 From e614aada0253bdd6990cb3bbdc0066e186854547 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 03:00:59 +0100 Subject: [PATCH 24/31] #141 more options on repair --- home.admin/00mainMenu.sh | 45 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index 5f4045598..f8edbfd2a 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -142,10 +142,49 @@ waitUntilChainNetworkIsReady() # 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." + echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options." sleep 3 - sudo /home/admin/config.scripts/network.reindex.sh - exit + + clear + # Basic Options + OPTIONS=(TORRENT "Redownload Prepared Torrent (DEFAULT)" \ + COPY "Copy Blockchain from another Computer (SKILLED)" \ + REINDEX "Resync thru ${${network}}d (TAKES VERY VERY LONG)" \ + BACKUP "Run Backup LND data first (optional)" \ + ) + + CHOICE=$(dialog --clear --title "Who to repair blockchain?" --menu "" 11 60 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) + + clear + if [ "${CHOICE}" = "TORRENT" ]; then + echo "Starting TORRENT ..." + /home/admin/50torrentHDD.sh + raspiblitz + exit + + elif [ "${CHOICE}" = "COPY" ]; then + echo "Starting COPY ..." + /home/admin/50copyHDD.sh + raspiblitz + 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 + raspiblitz + exit + + else + echo "CANCEL" + exit + fi + fi # normal info From 4212ee1f5ca71abecb41e6c958e9524d754c479f Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 03:07:46 +0100 Subject: [PATCH 25/31] state info --- home.admin/00mainMenu.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index f8edbfd2a..d857c8698 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -158,12 +158,14 @@ waitUntilChainNetworkIsReady() clear if [ "${CHOICE}" = "TORRENT" ]; then echo "Starting TORRENT ..." + sudo sed -i "s/^state=.*/state=retorrent/g" /home/admin/raspiblitz.info /home/admin/50torrentHDD.sh raspiblitz exit elif [ "${CHOICE}" = "COPY" ]; then echo "Starting COPY ..." + sudo sed -i "s/^state=.*/state=recopy/g" /home/admin/raspiblitz.info /home/admin/50copyHDD.sh raspiblitz exit @@ -185,6 +187,8 @@ waitUntilChainNetworkIsReady() exit fi + else + echo "${network} error: ${clienterror}" fi # normal info From 2041ba1f87787e37103c95464c3c56f0762838dc Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 03:17:53 +0100 Subject: [PATCH 26/31] #141 more info --- home.admin/00mainMenu.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index d857c8698..65e1daa70 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -145,15 +145,25 @@ waitUntilChainNetworkIsReady() echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options." sleep 3 + dialog --backtitle "RaspiBlitz - Repair Script" --msgbox "Your blockchain data needs to be repaired. +This can be due to a power problems or a failing HDD. +Please check the FAQ on Raspi9Blitz 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. +Maybe use BACKUP option first to secure your funds & channels. +" 13 52 + clear # Basic Options OPTIONS=(TORRENT "Redownload Prepared Torrent (DEFAULT)" \ COPY "Copy Blockchain from another Computer (SKILLED)" \ - REINDEX "Resync thru ${${network}}d (TAKES VERY VERY LONG)" \ - BACKUP "Run Backup LND data first (optional)" \ + REINDEX "Resync thru ${network}d (TAKES VERY VERY LONG)" \ + BACKUP "Run Backup LND data first (optional)" ) - CHOICE=$(dialog --clear --title "Who to repair blockchain?" --menu "" 11 60 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) + CHOICE=$(dialog --backtitle "RaspiBlitz - Repair Script" --clear --title "Who to repair blockchain?" --menu "test" 11 60 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) clear if [ "${CHOICE}" = "TORRENT" ]; then From 3a9943fe819c8bdcadb8123b4d1b8eb54cd0ce47 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 03:33:42 +0100 Subject: [PATCH 27/31] updated dialogs --- home.admin/00mainMenu.sh | 12 ++++++------ home.admin/config.scripts/lnd.rescue.sh | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index 65e1daa70..b4a431c41 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -153,31 +153,31 @@ https://github.com/rootzoll/raspiblitz/blob/master/FAQ.md The RaspiBlitz will now try to help you on with the repair. Maybe use BACKUP option first to secure your funds & channels. -" 13 52 +" 13 65 clear # Basic Options OPTIONS=(TORRENT "Redownload Prepared Torrent (DEFAULT)" \ - COPY "Copy Blockchain from another Computer (SKILLED)" \ + 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 "Who to repair blockchain?" --menu "test" 11 60 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) + 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 - raspiblitz + /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 - raspiblitz + /home/admin/00mainMenu.sh exit elif [ "${CHOICE}" = "REINDEX" ]; then @@ -189,7 +189,7 @@ Maybe use BACKUP option first to secure your funds & channels. sudo /home/admin/config.scripts/lnd.rescue.sh backup echo "PRESS ENTER to return to menu." read key - raspiblitz + /home/admin/00mainMenu.sh exit else diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh index f8ff7a4b6..2adc136cd 100755 --- a/home.admin/config.scripts/lnd.rescue.sh +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -34,6 +34,7 @@ if [ ${mode} = "backup" ]; then 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 "****************************" From f9552344087389656c66c999fad4f1fe893397e7 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 03:41:32 +0100 Subject: [PATCH 28/31] debug delete at the end --- home.admin/00mainMenu.sh | 6 +++--- home.admin/50copyHDD.sh | 1 + home.admin/50torrentHDD.sh | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index b4a431c41..3fc1cba8f 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -146,13 +146,13 @@ waitUntilChainNetworkIsReady() sleep 3 dialog --backtitle "RaspiBlitz - Repair Script" --msgbox "Your blockchain data needs to be repaired. -This can be due to a power problems or a failing HDD. -Please check the FAQ on Raspi9Blitz Github +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. -Maybe use BACKUP option first to secure your funds & channels. +To run a BACKUP of funds & channels first is recommended. " 13 65 clear diff --git a/home.admin/50copyHDD.sh b/home.admin/50copyHDD.sh index 3a8520780..5fbe9c2ee 100755 --- a/home.admin/50copyHDD.sh +++ b/home.admin/50copyHDD.sh @@ -125,6 +125,7 @@ if [ ${anyDataAtAll} -eq 1 ]; then else echo "OK -> DATA LOOKS GOOD :D" + sudo rm /mnt/hdd/${network}/debug.log fi diff --git a/home.admin/50torrentHDD.sh b/home.admin/50torrentHDD.sh index 9e8d73128..c5631ba01 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 From b91b148ea88e7a4ffcac4415dc72aa917d0e1eaa Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 03:58:53 +0100 Subject: [PATCH 29/31] detect missing blockchain data --- home.admin/00mainMenu.sh | 15 ++++++++++++++- home.admin/50copyHDD.sh | 6 +++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index 3fc1cba8f..f55b4b372 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -134,14 +134,27 @@ 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=$(du /mnt/hdd/bitcoin | head -n1 | awk '{print $1;}') + if [ ${#blockchainsize} -gt 0 ]; then + if [ ${blockchainsize} -lt 1000000 ]; then + echo "Mission Bloclchain 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 + if [ ${reindex} -gt 0 ] || [ "${clienterror}" = "missing blockchain" ]; then echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options." sleep 3 diff --git a/home.admin/50copyHDD.sh b/home.admin/50copyHDD.sh index 5fbe9c2ee..03308c660 100755 --- a/home.admin/50copyHDD.sh +++ b/home.admin/50copyHDD.sh @@ -41,7 +41,10 @@ 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 @@ -49,6 +52,7 @@ sudo mkdir /mnt/hdd/bitcoin 2>/dev/null # 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" @@ -125,7 +129,7 @@ if [ ${anyDataAtAll} -eq 1 ]; then else echo "OK -> DATA LOOKS GOOD :D" - sudo rm /mnt/hdd/${network}/debug.log + sudo rm /mnt/hdd/bitcoin/debug.log fi From 24f15aa89585065c7d5eda23a2682806691b45dd Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 04:00:44 +0100 Subject: [PATCH 30/31] debug --- home.admin/00mainMenu.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index f55b4b372..34859f987 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -142,6 +142,7 @@ waitUntilChainNetworkIsReady() # check for missing blockchain data blockchainsize=$(du /mnt/hdd/bitcoin | head -n1 | awk '{print $1;}') + echo "blockchainsize(${blockchainsize})" if [ ${#blockchainsize} -gt 0 ]; then if [ ${blockchainsize} -lt 1000000 ]; then echo "Mission Bloclchain Data ..." @@ -149,6 +150,7 @@ waitUntilChainNetworkIsReady() sleep 3 fi fi + sleep 5 if [ ${#clienterror} -gt 0 ]; then From 52d97c8e8ec1d02302ef7927c267158447f57bf3 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 17 Mar 2019 05:02:37 +0100 Subject: [PATCH 31/31] remove debug lines --- home.admin/00mainMenu.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index 34859f987..59b79e234 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -141,16 +141,15 @@ waitUntilChainNetworkIsReady() rm error.tmp # check for missing blockchain data - blockchainsize=$(du /mnt/hdd/bitcoin | head -n1 | awk '{print $1;}') + 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 Bloclchain Data ..." + echo "Mission Blockchain Data ..." clienterror="missing blockchain" sleep 3 fi fi - sleep 5 if [ ${#clienterror} -gt 0 ]; then