diff --git a/FAQ.md b/FAQ.md index f3ca03c..aa37e85 100644 --- a/FAQ.md +++ b/FAQ.md @@ -55,23 +55,23 @@ Of course, people should modify the system, add own scripts, etc ... but if you ## How can I avoid using a prepared blockchain and validate myself? -The torrent and FTP download use a prepared blockchain to kick start the RaspiBlitz. If you want to selft validate you could do this on another more powerful computer and then transfere your own validated blockchain over to the RaspiBlitz. Check the options `Copying from another Computer` & `Cloning from a 2nd HDD` described in the [README](README.md) for more details. +The torrent download use a prepared blockchain to kick start the RaspiBlitz. If you want to selft validate you could do this on another more powerful computer and then transfere your own validated blockchain over to the RaspiBlitz. Check the options `Copying from another Computer` & `Cloning from a 2nd HDD` described in the [README](README.md) for more details. ## I have the full blockchain on another computer. How do I copy it to the RaspiBlitz? -Copying a already synced blockchain from another computer (for example your Laptop) can be a quick way to get the RaspiBlitz started or replacing a corrupted blockchain with a fresh one. Also that way you synced and verified the blockchain yourself and not trusting the RaspiBlitz FTP/Torrent downloads (dont trust, verify). +Copying a already synced blockchain from another computer (for example your Laptop) can be a quick way to get the RaspiBlitz started or replacing a corrupted blockchain with a fresh one. Also that way you synced and verified the blockchain yourself and not trusting the RaspiBlitz Torrent downloads (dont trust, verify). One requirement is that the blockchain is from another bitcoin-core client with version greater or equal to 0.17.1 with transaction index switched on (`txindex=1` in the `bitcoin.conf`). -But we dont copy the data via USB to the device, because the HDD needs to be formatted in EXT4 and that is usually not read/writeable by Windows or Mac computers. So I will explain a way to copy the data thru your local network. This should work from Windows, Mac, Linux and even from another already synced RaspiBlitz. +But we dont copy the data via USB to the device, because the HDD needs to be formatted in EXT4 and that is usually not read/writeable by Windows or Mac computers. So I will explain a way to copy the data through your local network. This should work from Windows, Mac, Linux and even from another already synced RaspiBlitz. -Both computers (your RaspberryPi and the other computer with the full blockchain on) need to be connected to the same local network. Make sure that bitcoin is stoped on the computer containing the blockchain. If your blockchain source is another RaspiBlitz run on the terminal `sudo systemctl stop bitcoind` and then go to the directory where the blochcian data is with `cd /mnt/hdd/bitcoin` - when copy/transfer is done later reboot a RaspiBlitz source with `sudo shutdown -r now`. +Both computers (your RaspberryPi and the other computer with the full blockchain on) need to be connected to the same local network. Make sure that bitcoin is stoped on the computer containing the blockchain. If your blockchain source is another RaspiBlitz run on the terminal `sudo systemctl stop bitcoind` and then go to the directory where the blockchain data is with `cd /mnt/hdd/bitcoin` - when copy/transfer is done later reboot a RaspiBlitz source with `sudo shutdown -r now`. -If everything of the above is prepared, start the setup of the new RaspiBlitz with a fresh SD card (like explained in the README) - its OK that there is no blockchain data on your HDD yet - just follow the setup. When you get to the setup-point `Getting the Blockchain` choose the COPY option. Starting from version 1.0 of the RaspiBlitz this will give you further detailed instructions how to transfere the blockchain data onto your RaspiBlitz. In short: On your computer with the blockchain data source you will execute SCP commands, that will copy the data over your Local Network to your RaspiBlitz. +If everything of the above is prepared, start the setup of the new RaspiBlitz with a fresh SD card (like explained in the README) - its OK that there is no blockchain data on your HDD yet - just follow the setup. When you get to the setup-point `Getting the Blockchain` choose the COPY option. Starting from version 1.0 of the RaspiBlitz this will give you further detailed instructions how to transfer the blockchain data onto your RaspiBlitz. In short: On your computer with the blockchain data source you will execute SCP commands, that will copy the data over your Local Network to your RaspiBlitz. -Once you finished all the transferes the Raspiblitz will make a quick-check on the data - but that will not guarantee that everything in detail was OK with the transfere. Check further FAQ answeres if you get stuck or see a final sync with a value below 90%. +Once you finished all the transferes the Raspiblitz will make a quick-check on the data - but that will not guarantee that everything in detail was OK with the transfer. Check further FAQ answeres if you get stuck or see a final sync with a value below 90%. -**If you want to replace a corrupted blockchain this way:** *Go to terminal - maybe with CTRL+c. `sudo systemctl stop bitcoind` and `sudo systemctl stop lnd` then call `/home/admin/50copyHDD.sh` use the displayed SCP commands to copy over the fresh blockchain. Press ENTER when all is copied, so that the script can quick check the data and set the correct permissions. Then make a reboot `sudo shutdown -r now`* +**If you want to replace a corrupted blockchain this way:** *Go to terminal - maybe with CTRL+c. Then call `/home/admin/50copyHDD.sh` use the displayed SCP commands to copy over the fresh blockchain. Press ENTER when all is copied, so that the script can quick check the data. Then make a reboot `sudo shutdown -r now`* ## How do I clone the Blockchain from a 2nd HDD? @@ -107,7 +107,7 @@ To connect the 2nd HDD to the RaspiBlitz, the use of a Y cable to provide extra ## Why is my "final sync" taking so long? -First of all if you see a final sync over 90% and you can see from time to time small increase - you should be OK ... this can take some looong time to catch up with the network. Only in the case that you activly choose the `SYNC` option in the `Getting the Blockchain` a final sync under 90% is OK. If you did a torrent, a FTP or a copy from another computer and seeing under 90% somthing went wrong and the setup process is ignoring your prepared Blockchain and doing a full sync - which can almost take forever on a raspberryPi. +First of all if you see a final sync over 90% and you can see from time to time small increase - you should be OK ... this can take some looong time to catch up with the network. Only in the case that you activly choose the `SYNC` option in the `Getting the Blockchain` a final sync under 90% is OK. If you did a torrent or a copy from another computer and seeing under 90% somthing went wrong and the setup process is ignoring your prepared Blockchain and doing a full sync - which can almost take forever on a raspberryPi. So if something is wrong (like mentioned above) then try again from the beginning. You need to reset your HDD for a fresh start: SSH in as admin user. Abort the final sync info with CTRL+c to get to the terminal. There run `sudo /home/admin/XXcleanHDD.sh -all` and follow the script to delete all data in HDD. When finsihed power down with `sudo shutdown now`. Then make a fresh SD card from image and this time try another option to get the blockchain. If you run into trouble the second time, please report an issue on GitHub. @@ -119,35 +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. +How to backup LND data in a rescue situation see next question "How can I recover my coins from a failing RaspiBlitz?". -## What is this mnemonic seed word list? +## How can I recover my coins from a failing 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. +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". -For more background on mnemonic seeds see this video: https://www.youtube.com/watch?v=wWCIQFNf_8g +### 1) Recover LND data -## How does PASSWORD D effects the word seed? +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". -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. +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 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. +To rescue/export your Lightning data from a RaspiBlitz: -## How can I recover my coins from a failing 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. 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. -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? +Then to restore your old LND data and to recover your 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: +* 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. -### 1) Recover from Wallet Seed +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. + +**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.** + +### 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. @@ -168,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? + +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 -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. +## How does PASSWORD D effects the word seed? -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 +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. -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. +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 @@ -313,7 +321,7 @@ Also there are first free 3D open source files in this repo in the directory `ca ## Are those "Under-Voltage detected" warnings a problem? -When your USB power adapter for the RaspiBlitz delivers too low power those messages with "Under-Voltage detected" (undervoltage) are shortly seen on the display. If you see those just one or two times that's not OK, but can be in a tolerant window. Nevertheless make sure your USB power adapter can deliver at least 3A. If you still see those warnings maybe get a second USB Power adapter just for the HDD and power the HDD through a Y-Cable - see https://en.wikipedia.org/wiki/Y-cable#USB +When your USB power adapter for the RaspiBlitz delivers too low power those messages with "Under-Voltage detected" (undervoltage) are shortly seen on the display. This can lead to data loss/corruption on the HDD. If you see those just one or two times that's not OK, but can be in a tolerant window. Nevertheless it make sure your USB power adapter can deliver at least 3A (big and stable is good). If you still see those warnings maybe get a second USB Power adapter just for the HDD and power the HDD through a Y-Cable - see https://en.wikipedia.org/wiki/Y-cable#USB or put a USB Hub with extra power between the raspberry and the HDD. ## Why do we need to download the blockchain and not syncing it? @@ -329,10 +337,14 @@ The best way would be to build the sd card yourself. You use the script `build_s To download a blockchain from a third party (torrent/ftp) is not optimal and for the future with more cheap & powerfull SingleBoardComputers we could get rid of this 'patch'. -The downloaded blockchain is pre-indexed and pre-validated. That should be practically secure enough, because if the user gets a "manipulated" blockchain it would not work after setup. The beginning of the downloaded blockchain needs to fit the genesis block (in bitcoind software) and the end of the downloaded blockchain needs not match with the rest of the bitcoin network state - hashes of new block distrubuted within the peer-2-peer network need to match the downloaded blockchain head. So if you downloaded a manipulated blockchain it would simply just don't work in practice. As long as you are not in a totally hostile environment where someone would be able to fake a whole network of peers and miners around you - this is secure enough for running a small funded full node to try out the lightning network. +The downloaded blockchain is pre-indexed and pre-validated. That should be practically secure enough, because if the user gets a "manipulated" blockchain it would not work after setup. The beginning of the downloaded blockchain needs to fit the genesis block (in bitcoind software) and the end of the downloaded blockchain needs not match with the rest of the bitcoin network state - hashes of new block distrubuted within the peer-2-peer network need to match the downloaded blockchain head. So if you downloaded a manipulated blockchain it simply wouldn't work in practice. As long as you are not in a totally hostile environment where someone would be able to fake a whole network of peers and miners around you - this is secure enough for running a small funded full node to try out the lightning network. If you dont trust the download or you want to run the RaspiBlitz in a more production like setup (on your own risk) then don't use the torrent/ftp download and choose the option to COPY the blockchain data from a more powerful computer (laptop or desktop) where you synced, verified and indexed the blockchain all by your yourself - see [README](README.md#4-copying-from-another-computer) for more details. +## Why is taking my torrent download of the blockchain so long? + +Other users reported that opening up and forwarding the following port from their router to the RaspiBlitz helped speed up and getting started the torrent download: 6881-6889, 6969, 1337 + ## What is the "Base Torrent File"? Inspired by the website getbitcoinblockchain.com we use one of their base torrent files to have a basic set of blocks - that will not change for the future. This torrent contains most of the data (the big file) and we dont need to change the torrent for a long time. This way the torrent can get establish a wide spread seeding and the torrent network can take the heavy load. @@ -464,15 +476,15 @@ Work Nodes for the process of producing a new sd card image release: * Remove `Ubuntu LIVE` USB stick and replace with `Ubuntu AIRGAP` * PowerOn Build Laptop (press F12 for boot menu) * Cut Power of RaspiBlitz, remove sd card and connect with sd card reader to build laptop -* Open `Disks` manager, select sd card and choose `Create Disk Image` (right upper corner window) -* Store image to NTFS USB stick (click to start can take a while - enter password) -* Open in File Manager the NTFS USB Stick, context menu the created IMG file `compress` -* Name it: `raspiblitz-vX.X-YEAR-MONTH-DAY.img.zip` -* Delete all IMG files from NTFS (just keep zips) +* Connect and open in Filemenager NTFS - context on white scace -> open terminal +* run `df`to check on sd card reader device name +* `sudo dd if=/dev/[sdcarddevice] | gzip > ./raspiblitz-vX.X-YEAR-MONTH-DAY.img.gz` +* Delete all IMG files from NTFS (just keep zips/gzs) * Context on white space, `Open in Terminal`, run `shasum -a 256 [NEW-ZIP] > sha256.txt` * [Do future author signing here with tools from airgap build machine] * Shutdown build computer * Connect NTFS USB stick to MacOS (its just readonly) +* Check if file can be unzipped on OSX * Run tests with new image * Upload new image to Download Server * Copy SHA256-String into GutHub README and update downloadlink @@ -481,6 +493,11 @@ Work Nodes for the process of producing a new sd card image release: There is an experimental section in this GitHub that tries to build for other SingleBoardComputers. Feel free to try it out and share your experience: [dietpi/README.md](dietpi/README.md) +## Can I flip the screen? + +For the default 3.5" LCD you need to edit the /boot/config.txt. Run `sudo nano /boot/config.txt` +look for the line `dtoverlay=tft35a:rotate=270` towards the end. To flip the screen with 180 degrees change the line to `dtoverlay=tft35a:rotate=90` and reboot with `sudo reboot`. Reference: https://github.com/goodtft/LCD-show/issues/34 + ## How to setup fresh/clean/reset and not getting into recovery mode? When you put in a sd card with a new/clean RaspiBlitz image the RaspiBlitz will get into recovery mode because it detects the old data on your HDD and assumes you just want to continue to work with this data. @@ -488,3 +505,57 @@ When you put in a sd card with a new/clean RaspiBlitz image the RaspiBlitz will But there might be cases where you want to start a totally fresh/clean RaspiBlitz from the beginning. To do so you need to delete the old data from the HDD. You can do so by formating it on another computer (for example with FAT and name it "NEW"). Or when you can run the script "/home/admin/XXcleanHD.sh -all" on the terminal. When the HDD is clean, then flash a new RaspiBlitz sd card and your setup should start fresh. + +## My blockchain data is corrupted - what can I do? + +You could try to re-index, but that can take some very long time - multiple days or even weeks. But there are other options: + +1. Copy Blockchain from another Computer + +You can delete the old blockchain and get a new one. See for details the FAQ question: [I have the full blockchain on another computer. How do I copy it to the RaspiBlitz?](FAQ.md#i-have-the-full-blockchain-on-another-computer-how-do-i-copy-it-to-the-raspiblitz). And even if you are not able to delete the data, first rename the undeletable folders and then follow the instructions. + +2. Re-Torrent download prepared Blockchain + +You can also start a new Torrent-Download and replace the old blockchain with a new download once its finished. Go to terminal and run script `/mnt/hdd/50torrentHDD.sh` + +3. Backup LND Data, make fresh Blitz, Replay LND Data + +You can backup your channel and wallet data, make a complete fresh RaspiBlitz and after that one is setup you replace the LND data with your old one. Also make sure to check again on your power supply - it needs to deliver equal or more then 3A and should deliver a stable current. If you think your HDD or SD card is degrading - maybe this is a good time to replace. See for details the FAQ question: [How can I recover my coins from a failing RaspiBlitz?](FAQ.md#how-can-i-recover-my-coins-from-a-failing-raspiblitz)* + +## Can I run the RaspiBlitz without a display/LCD? + +The display is one of the nice features of the RaspiBlitz but the raspberry can un without it. Maybe not all add-on feature could be used to the full extend, but you can get started without the LCD and even plug it on later. + +Normally with the LCD its easy to see your local IP changes and you can get started quickly. Without it needs a bit more digging thru your network - you can find a good tutorial on that on the RaspiBolt tutorial (origin of RaspiBlitz): + +https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#connecting-to-the-network + +*Please Note: Without a LCD-Hat you cannot simply use the HDMI as alternative, because screen signal is routed to the GPIO pins. On how to switch that back manually - see [waveshare documentation](https://www.waveshare.com/wiki/3.5inch_RPi_LCD_(A)).* + +## I have two RaspiBlitz in my network - can they both be public? + +Yes but you need to change at least on one RaspiBlitz the port number (for example to 9736) on one of your RaspiBlitzes - see how to change a port below. Then you can forward both ports from your home internet router to the matching RaspiBlitzes. + +## How to change the public port LND/Lightning node is running on? + +There is a experimental script you can call from the terminal that will make all changes for you ... see details here: https://github.com/rootzoll/raspiblitz/issues/100#issuecomment-466722712 + +## How to solve a "signature mismatch after caveat verification" error? + +If you get this error by LND that means that something is wrong with the macaroons being used to communicate with LND .. see: https://github.com/lightningnetwork/lnd/blob/master/docs/macaroons.md + +To fix this depends on where you get this error: + +* If you get it in a mobile wallet, then redo the connection with the RaspiBlitz to get fresh macaroons. +* If you get this from RTL or from the scripts of the SSH menus of the RaspiBlitz, then go to "EXPORT Macacroons and TLS.cert" in SSH main menu and choose the the "RESET Macaroons & TLS" option. + +Also make sure to check again on your power supply - it needs to deliver equal or more then 3A and should deliver a stable current. If you think your HDD is degrading - maybe this is a good time to replace it. See for details the FAQ question: [How can I recover my coins from a failing RaspiBlitz?](FAQ.md#how-can-i-recover-my-coins-from-a-failing-raspiblitz) + +## Why is my node not routing? + +1. You don't have inbound liquidity +2. Low uptime +3. Capital is committed to competitive destinations +4. Capital committed to destinations no one wants to send to +5. Fees are too high +6. Your inbound liquidity doesn't have good inbound liquidity itself \ No newline at end of file diff --git a/README.md b/README.md index 900dd7c..e3af382 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,8 @@ The RaspiBlitz is build from the following parts: * RaspBerryPi 3 B+ * 1TB Hard Drive * LCD-Display -* Micro SD-Card 16GB -* Powersupply >=3A (big & stable) +* Micro SD-Card (min 16GB - go for quality) +* Powersupply >=3A (choose big & stable output) * Cheap Casing **All together under 150 USD / 130 EUR (depending on country & shop)** @@ -50,6 +50,7 @@ These are the community currated shopping lists based on country: * [Germany](shoppinglist_de.md) *(reference shopping list)* * [USA](shoppinglist_usa.md) +* [Canada](shoppinglist_ca.md) * [UK](shoppinglist_uk.md) * [Switzerland](shoppinglist_ch.md) * [France](shoppinglist_fr.md) @@ -80,7 +81,12 @@ Connect the HDD to one of the USB ports. In the end your RaspiBlitz should look Your SD-card needs to contain the RaspiBlitz software. You can take the long road by [building the SD-card image yourself](#build-the-sd-card-image) or use the already prepared SD-Card image: 1. Download SD-Card image - **Version 1.0**: -(PLEASE BE PATIENT - IMAGE v1.0 IS COMING SOON) + +HTTP: http://wiki.fulmo.org/downloads/raspiblitz-v1.0-2019-02-18.img.gz + +Torrent: https://github.com/rootzoll/raspiblitz/raw/master/raspiblitz-v1.0-2019-02-18.torrent + +SHA-256: 99ca96d214657388305ca117e2343ead45f9d907f185bef36c712a9a3e75568f 2. Write the SD-Card image to your SD Card - if you need details, see here: https://www.raspberrypi.org/documentation/installation/installing-images/README.md @@ -103,7 +109,7 @@ When everything boots up correctly, you should see the local IP address of your ![LCD0](pictures/lcd0-welcome.png) -Now open up a [terminal](https://www.youtube.com/watch?v=5XgBd6rjuDQ) and connect thru SSH with the command displayed by the RaspiBlitz: +Now open up a terminal ([OSX](https://www.youtube.com/watch?v=5XgBd6rjuDQ)/[Win10](https://www.youtube.com/watch?v=xIfzZXHaCzQ)) and connect thru SSH with the command displayed by the RaspiBlitz: `ssh admin@[YOURIP]` → use password: `raspiblitz` @@ -183,26 +189,17 @@ This is the default way to download the blockchain data for the RaspiBlitz. If y ![DOWNLOAD1](pictures/download-torrent.png) -*This can take a while - normally it should be done if you keep it running over night, but some users reported that it took up to 3 days. If it takes longer than that or you cannot see any progress (downloading starting) for over an hour after you started thsi option consider to cancel the download and choose the FTP download option.* +*This can take a while - normally it should be done if you keep it running over night, but some users reported that it took up to 3 days. If it takes longer than that or you cannot see any progress (downloading starting) for over an hour after you started this option consider to cancel the download and go with the COPY option or retry fresh.* It is safe to close the terminal window (shutdown your laptop) while the RaspiBlitz is doing the torrent download. To check on progress and to continue the setup you need to ssh back in again. You can cancel the torrent download by keeping the key `x` pressed. Then the download will stop and you will be asked if you want to keep the progress so far. This makes sense if you need to shutdown the RaspiBlitz and you want to continue later or when you want to try another download option but want to keep the option to continue on torrent if the other option is slower or not working. * [How can I avoid using a prepared blockchain and validate myself?](FAQ.md#how-can-i-avoid-using-a-prepared-blockchain-and-validate-myself) -* [Why is taking my torrent download of the blockchain so long?]() - -#### 2. FTP-Download - -You should try the FTP download if the torrent option is not working for you. Please be aware that the files are hosted on a central server by us and up-time and bandwidth is not guaranteed. If you start it, you should see the following screen: +* [Why is taking my torrent download of the blockchain so long?](FAQ.md#why-is-taking-my-torrent-download-of-the-blockchain-so-long) -![DOWNLOAD1](pictures/download-ftp.png) -It is safe to close the terminal window (shutdown your laptop) while the RaspiBlitz is doing the FTP download. To check on progress and to continue the setup you need to ssh back in again. - -You can cancel the FTP download by keeping the key `x` pressed. Then the download will stop and you will be asked if you want to keep the progress so far. This makes sense if you need to shutdown the RaspiBlitz and you want to continue later or when you want to try another download option but want to keep the option to continue on FTP download if the other option is slower or not working. - -#### 4. Copying from another Computer +#### 2. Copying from another Computer If you have another computer available (laptop, desktop or another raspiblitz) that already runs a working blockchain (with txindex=1) you can use this option to copy it over to the RaspiBlitz. This will be done over the local network by SCP (SSH file transfere). Choose this option and follow the given instructions. @@ -210,11 +207,11 @@ This is also the best option if you dont like to run your RaspiBlitz with a prep More details: [I have the full blockchain on another computer. How do I copy it to the RaspiBlitz?](FAQ.md#i-have-the-full-blockchain-on-another-computer-how-do-i-copy-it-to-the-raspiblitz) -#### 5. Cloning from a 2nd HDD +#### 3. Cloning from a 2nd HDD If is a backup way to transfere a blockchain from another computer if copying over the network is not working. More details on the setup can be found [here](FAQ.md#how-do-i-clone-the-blockchain-from-a-2nd-hdd). -#### 6. Sync from Bitcoin-Network +#### 4. Sync from Bitcoin-Network This is the fallback of last resort. A RaspberryPi has a very low power CPU and syncing+validating the blockchain directly with the peer2peer network can take multiple weeks - thats why the other options above where invented. @@ -405,8 +402,6 @@ But this also comes with the following side effects: To try it out just switch on the service - you can deactivate later on if its not working for you. -The TOR integration is experimental and at the moment there is no way to switch off TOR again. - ##### RTL Webinterface The RTL Webinterface is a LND Control Dashboard you can run in your browser with a nice GUI - it offers much more control over your Lightning node than the RaspiBlitu SSH menus. Its recommended to give it a try. @@ -574,6 +569,8 @@ You have still more questions? Check the [RaspiBlitz-FAQ-Archive](FAQ.md). Everybody is welcome to join, improve and extend the RaspiBlitz - its a work in progress. [Check the issues](https://github.com/rootzoll/raspiblitz/issues) if you wanna help out or add new ideas. You find the scripts used for RaspiBlitz interactions on the device at `/home/admin` or in this git repo in the subfolder `home.admin`. +Also get inspired for a deep-dive with the original "[RaspiBolt](https://github.com/Stadicus/guides/tree/master/raspibolt)" tutorial on how to build a lightning node on the RaspberryPi which was the base work the RaspiBlitz was developed on - so much thx to Stadicus :) + Join me on twitter [@rootzoll](https://twitter.com/rootzoll), visit us at a upcomming [#lightninghackday](https://twitter.com/hashtag/LightningHackday?src=hash) or check by on of our bitcoin meetups in Berlin ... every 1st Thursday evening a month at the room77 bar - feel free to buy me a beer with lightning there :) * [How can I get further help/support?](#support) diff --git a/build_sdcard.sh b/build_sdcard.sh index ede9eeb..f1a00af 100644 --- a/build_sdcard.sh +++ b/build_sdcard.sh @@ -12,7 +12,7 @@ echo "" echo "*****************************************" -echo "* RASPIBLITZ SD CARD IMAGE SETUP v1.00 *" +echo "* RASPIBLITZ SD CARD IMAGE SETUP v1.1 *" echo "*****************************************" echo "" @@ -71,6 +71,11 @@ else echo "OK running ${baseImage}" fi +# setting static DNS server +# see https://github.com/rootzoll/raspiblitz/issues/322#issuecomment-466733550 +sudo sed -i "s/^#static domain_name_servers=192.168.0.1*/static domain_name_servers=1.1.1.1/g" /etc/dhcpcd.conf +systemctl daemon-reload + # fixing locales for build # https://github.com/rootzoll/raspiblitz/issues/138 # https://daker.me/2014/10/how-to-fix-perl-warning-setting-locale-failed-in-raspbian.html @@ -127,6 +132,8 @@ if [ "${baseImage}" = "raspbian" ]; then sudo raspi-config nonint do_boot_wait 0 # set WIFI country so boot does not block sudo raspi-config nonint do_wifi_country US + # see https://github.com/rootzoll/raspiblitz/issues/428#issuecomment-472822840 + echo "max_usb_current=1" | sudo tee -a /boot/config.txt # extra: remove some big packages not needed sudo apt-get remove -y --purge libreoffice* oracle-java* chromium-browser nuscratch scratch sonic-pi minecraft-pi python-pygame sudo apt-get clean @@ -148,6 +155,75 @@ sudo bash -c "echo '[Service]' >> /etc/systemd/system/getty@tty1.service.d/autol sudo bash -c "echo 'ExecStart=' >> /etc/systemd/system/getty@tty1.service.d/autologin.conf" sudo bash -c "echo 'ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux' >> /etc/systemd/system/getty@tty1.service.d/autologin.conf" +# change log rotates +# see https://github.com/rootzoll/raspiblitz/issues/394#issuecomment-471535483 +echo "/var/log/syslog" >> ./rsyslog +echo "{" >> ./rsyslog +echo " rotate 7" >> ./rsyslog +echo " daily" >> ./rsyslog +echo " missingok" >> ./rsyslog +echo " notifempty" >> ./rsyslog +echo " delaycompress" >> ./rsyslog +echo " compress" >> ./rsyslog +echo " postrotate" >> ./rsyslog +echo " invoke-rc.d rsyslog rotate > /dev/null" >> ./rsyslog +echo " endscript" >> ./rsyslog +echo "}" >> ./rsyslog +echo "" >> ./rsyslog +echo "/var/log/mail.info" >> ./rsyslog +echo "/var/log/mail.warn" >> ./rsyslog +echo "/var/log/mail.err" >> ./rsyslog +echo "/var/log/mail.log" >> ./rsyslog +echo "/var/log/daemon.log" >> ./rsyslog +echo "{" >> ./rsyslog +echo " rotate 4" >> ./rsyslog +echo " size=100M" >> ./rsyslog +echo " missingok" >> ./rsyslog +echo " notifempty" >> ./rsyslog +echo " compress" >> ./rsyslog +echo " delaycompress" >> ./rsyslog +echo " sharedscripts" >> ./rsyslog +echo " postrotate" >> ./rsyslog +echo " invoke-rc.d rsyslog rotate > /dev/null" >> ./rsyslog +echo " endscript" >> ./rsyslog +echo "}" >> ./rsyslog +echo "" >> ./rsyslog +echo "/var/log/kern.log" >> ./rsyslog +echo "/var/log/auth.log" >> ./rsyslog +echo "{" >> ./rsyslog +echo " rotate 4" >> ./rsyslog +echo " size=100M" >> ./rsyslog +echo " missingok" >> ./rsyslog +echo " notifempty" >> ./rsyslog +echo " compress" >> ./rsyslog +echo " delaycompress" >> ./rsyslog +echo " sharedscripts" >> ./rsyslog +echo " postrotate" >> ./rsyslog +echo " invoke-rc.d rsyslog rotate > /dev/null" >> ./rsyslog +echo " endscript" >> ./rsyslog +echo "}" >> ./rsyslog +echo "" >> ./rsyslog +echo "/var/log/user.log" >> ./rsyslog +echo "/var/log/lpr.log" >> ./rsyslog +echo "/var/log/cron.log" >> ./rsyslog +echo "/var/log/debug" >> ./rsyslog +echo "/var/log/messages" >> ./rsyslog +echo "{" >> ./rsyslog +echo " rotate 4" >> ./rsyslog +echo " weekly" >> ./rsyslog +echo " missingok" >> ./rsyslog +echo " notifempty" >> ./rsyslog +echo " compress" >> ./rsyslog +echo " delaycompress" >> ./rsyslog +echo " sharedscripts" >> ./rsyslog +echo " postrotate" >> ./rsyslog +echo " invoke-rc.d rsyslog rotate > /dev/null" >> ./rsyslog +echo " endscript" >> ./rsyslog +echo "}" >> ./rsyslog +sudo mv ./rsyslog /etc/logrotate.d/rsyslog +sudo chown root:root /etc/logrotate.d/rsyslog +sudo service rsyslog restart + echo "" echo "*** SOFTWARE UPDATE ***" # based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#software-update @@ -158,6 +234,18 @@ sudo apt-get install -y htop git curl bash-completion jq dphys-swapfile # installs bandwidth monitoring for future statistics sudo apt-get install -y vnstat +# prepare for BTRFS data drive raid +sudo apt-get install -y btrfs-tools + +# prepare for display graphics mode +# see https://github.com/rootzoll/raspiblitz/pull/334 +sudo apt-get install -y fbi + +# prepare dor display service +# see https://github.com/rootzoll/raspiblitz/issues/88#issuecomment-471342311 +sudo apt-get install -y redis-server +sudo -H pip3 install redis + echo "" echo "*** ADDING MAIN USER admin ***" # based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#adding-main-user-admin @@ -243,11 +331,14 @@ then echo "!!! FAIL !!! Download laanwj-releases.asc not success." exit 1 fi +gpg ./laanwj-releases.asc fingerprint=$(gpg ./laanwj-releases.asc 2>/dev/null | grep "${laanwjPGP}" -c) if [ ${fingerprint} -lt 1 ]; then echo "" - echo "!!! BUILD FAILED --> Bitcoin download PGP author not OK" - exit 1 + echo "!!! BUILD WARNING --> Bitcoin PGP author not as expected" + echo "Should contain laanwjPGP: ${laanwjPGP}" + echo "PRESS ENTER to TAKE THE RISK if you think all is OK" + read key fi gpg --import ./laanwj-releases.asc sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/SHA256SUMS.asc @@ -332,11 +423,14 @@ if [ "${binaryChecksum}" != "${lndSHA256}" ]; then fi # check gpg finger print +gpg ./pgp_keys.asc fingerprint=$(gpg ./pgp_keys.asc 2>/dev/null | grep "${olaoluwaPGP}" -c) if [ ${fingerprint} -lt 1 ]; then echo "" - echo "!!! BUILD FAILED --> LND download author PGP not OK" - exit 1 + echo "!!! BUILD WARNING --> Bitcoin PGP author not as expected" + echo "Should contain olaoluwaPGP: ${olaoluwaPGP}" + echo "PRESS ENTER to TAKE THE RISK if you think all is OK" + read key fi gpg --import ./pgp_keys.asc sleep 3 diff --git a/case.3dprint/standard/RaspiBlitz_Standard_Bottom.stl b/case.3dprint/standard/RaspiBlitz_Standard_Bottom.stl new file mode 100644 index 0000000..4a09243 Binary files /dev/null and b/case.3dprint/standard/RaspiBlitz_Standard_Bottom.stl differ diff --git a/case.3dprint/standard/RaspiBlitz_Standard_Top.stl b/case.3dprint/standard/RaspiBlitz_Standard_Top.stl new file mode 100644 index 0000000..41b6068 Binary files /dev/null and b/case.3dprint/standard/RaspiBlitz_Standard_Top.stl differ diff --git a/dietpi/Odroid_HC1_HC2.md b/dietpi/Odroid_HC1_HC2.md new file mode 100644 index 0000000..00617c6 --- /dev/null +++ b/dietpi/Odroid_HC1_HC2.md @@ -0,0 +1,126 @@ + +# ⚡️ RaspiBlitz-on-DietPi ⚡️ +# For the Odroid HC1 / HC2 / XU3 / XU4 + +![](pictures/DroidBlitz.jpg) + +## There are 3 options provided: +* a trusted fully prebuilt SDcard image +* building your own SDcard from an updated DietPi image. +* Build your own SDcard from the image downloaded from [Dietpi.com](dietpi.com#download) +--- +### Download the fully prebuilt RaspiBlitz-on-DietPi SDcard image +* [torrent](https://github.com/openoms/raspiblitz/blob/raspiblitz-dev/dietpi/RaspiBlitz1.0_OdroidHC1_DietPi6.21.1.torrent) +* [mega.nz link](https://mega.nz/#F!EVNAAQiB!ZyLHP2dJMRSVjZOTCQMIYA) + +sha256sum RaspiBlitz1.0_OdroidHC1_DietPi6.21.1.img: 96ee8700f52a12fb5b13fab3fffcdcf5d364c6dd16c580d969e421cef2cd7cc2 + +Steps to run: +- download the .img file, +- burn to a 16 GB SD with [Etcher](https://www.balena.io/etcher/) +- extend the rootFS partition with a partition manager (disks, Gparted, etc.) +- boot the Odroid with the SDcard +- login with `ssh admin@at.your.raspiblitz.ip` +password: `raspiblitz` + +Using this image you can skip the rest of this guide as it is mostly about how this image was built. + +The setup continues with the [RaspiBlitz Setup Process](https://github.com/rootzoll/raspiblitz/blob/master/README.md#setup-process-detailed-documentation) + +--- +### Download the updated DietPi image + +For the Odroid HC1 / HC2 / XU3 / XU4 a v6.20.6 DietPi image with fail2ban installed is uploaded [here]( +https://mega.nz/#!AcdVBAbR!O-W3jP5LUgw7lMY8S9XcBWcKX3IhRNAAFmaYzDXIUC0). +sha256sum DietPi_v6.20.6_OdroidXU4-ARMv7-Stretch.img: +1459b91f66b9db98f3437c31231e44497b7b7dcd9146d2cc41a3da653f9a9215 + +* Burn the image to the SDCard with [Etcher](https://www.balena.io/etcher/) and extend the rootfs partition to the size of your card with a partition manager (disks, Gparted, etc). + +* Insert the SDcard into the Odroid. + +* Power up and continue with [running the RaspiBlitz build_sdcard.sh script](#Run-the-RaspiBlitz-build_sdcard.sh-script) + +--- + +### Build your own DietPi image: + +Watch out this is an ardous process. +Updating from a v6.14 DietPi image is causing a bootloop under some circumstances. Will be sorted once the current, >6.2 version is uploaded for the Odroids. + +* For the Odroid HC1 / HC2 / XU3 / XU4 the start is this image: +https://dietpi.com/downloads/images/DietPi_OdroidXU4-ARMv7-Stretch.7z +* Burn it to the SD with [Etcher](https://www.balena.io/etcher/) + + +* In the desktop terminal on Linux / MacOS or Putty on Windows: +`ssh root@[IP-OF-DIETPI]` +password: `dietpi` +Getting started with DietPi: https://dietpi.com/phpbb/viewtopic.php?f=8&t=9#p9 + +* Ok > Cancel > Cancel +automatic apt update & apt upgrade and asks to reboot +![](pictures/dietpi_1st_reboot.png) + +* Log back in: +`ssh root@[IP-OF-DIETPI]` +password: `dietpi` +* after the update the ssh keys might change: +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +run (can be copied from the terminal output): +`ssh-keygen -f "/home/[your-linux-username]/.ssh/known_hosts" -R "dietpi.IP"` +`ssh root@[IP-OF-DIETPI]` +yes > +password: `dietpi` + +* At this point if the DietPi OS was not updated from 6.14 it does not manage to save settings going forward. +Exit the software installer (press Tab to jump to Exit) +![](pictures/dietpi-software_exit.png) + +* in the bash prompt run: +`dietpi-update` +Ok > Cancel the recovery point +update > Opt out of survey > Ok +Reboots + +* Log back in: +`ssh root@[IP-OF-DIETPI]` +password: `dietpi` +* In the DietPi software menu install fail2ban and make OpenSSH server the default SSH server. +Ok > Cancel > Cancel +Search `fail2ban` > Space to select > Enter +SSH server > switch from Dropbear to the OpenSSH-server +Install > Ok +Opt out of survey > Ok +Reboots again + +* Log back in: +`ssh root@[IP-OF-DIETPI]` +password: `dietpi` +Changing the SSH server will change the SSH keys again. To clear: +`ssh-keygen -f "/home/[your-linux-username]/.ssh/known_hosts" -R "dietpi.IP"` + + +### Run the RaspiBlitz build_sdcard.sh script + +* Format of the command to build the SDcard: +`wget https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build_sdcard.sh && sudo bash build_sdcard.sh [BRANCH] [GITHUB-USERNAME]` +If you are working from a forked repo be aware of that the fork needs to be called `raspiblitz` for the git downloads to work. + +* Run the forked version of @openoms: +`wget https://raw.githubusercontent.com/openoms/raspiblitz/raspiblitz-dev/build_sdcard.sh && sudo bash build_sdcard.sh raspiblitz-dev openoms` +This will take a couple minutes depending on your internet ceonnection and the processing power of the SBC. + +* Restart when done and log back in now as `admin`: +`ssh admin@[IP-OF-DROIDBLITZ]` +password: `raspiblitz` + +* From here he setup continues with the [RaspiBlitz Setup Process](https://github.com/rootzoll/raspiblitz/blob/master/README.md#setup-process-detailed-documentation) + +--- +### Examples of copying the blockchain data from a HDD using a powered USB to SATA adapter + +![example setup](pictures/HDD_copy_example.jpg) +![](pictures/adapterHDD_HC1.jpg) diff --git a/dietpi/README.md b/dietpi/README.md index 5fda129..c495462 100644 --- a/dietpi/README.md +++ b/dietpi/README.md @@ -1,4 +1,4 @@ -# ⚡️ RaspiBlitz on DietPi ⚡️ +# ⚡️ RaspiBlitz-on-DietPi ⚡️ # A hardware agnostic platform @@ -9,128 +9,67 @@ This guide was tested on: * Raspberry Pi 3 B Plus - no LCD support so far * hoping to extend this list with more compatible boards especially the ROCK64 -See the hardware specs: [hardware specs](hw_comparison.md). - - -![](pictures/DroidBlitz.jpg) - -## Download the fully prebuilt RaspiBlitz on DietPi SDcard image - -for the Odroid HC1 / HC2 / XU3 / XU4 from this [torrent](https://github.com/openoms/raspiblitz/blob/raspiblitz-dev/dietpi/RaspiBlitz1.0_OdroidHC1_DietPi6.21.1.torrent) or from [mega.nz](https://mega.nz/#F!EVNAAQiB!ZyLHP2dJMRSVjZOTCQMIYA). -(sha256sum RaspiBlitz1.0_OdroidHC1_DietPi6.21.1.img: -96ee8700f52a12fb5b13fab3fffcdcf5d364c6dd16c580d969e421cef2cd7cc2) - -Steps to run: -- download the .img file, -- burn to a 16 GB SD with [Etcher](https://www.balena.io/etcher/) -- extend the rootFS partition with a partition manager (disks, Gparted, etc.) -- boot the Odroid with the SDcard and login with ssh admin@at.your.raspiblitz.ip, password: raspiblitz - -Using this image you can skip the rest of this guide as it is mostly about how this image was built. - -The setup continues with the [RaspiBlitz Setup Process](https://github.com/rootzoll/raspiblitz/blob/master/README.md#setup-process-detailed-documentation) +See the [hardware comparison](hw_comparison.md). --- -## Setting up the DietPi OS -### Download the updated DietPi image -For the Odroid HC1 / HC2 / XU3 / XU4 a v6.20.6 DietPi image with fail2ban installed is uploaded [here]( -https://mega.nz/#!AcdVBAbR!O-W3jP5LUgw7lMY8S9XcBWcKX3IhRNAAFmaYzDXIUC0). (sha256sum DietPi_v6.20.6_OdroidXU4-ARMv7-Stretch.img: -1459b91f66b9db98f3437c31231e44497b7b7dcd9146d2cc41a3da653f9a9215) - -Burn to the SDCard with [Etcher](https://www.balena.io/etcher/) and extend the rootfs partition to the size of your card with a partition manager. - -Insert the SDcard into the Odroid. +### Downloads and walkthrough for the [Odroid HC1 / HC2 / XU3 / XU4](Odroid_HC1_HC2.md) +--- +## General guide for the RaspiBlitz-on-DietPi -Power up and continue with: [Run the DietPi optimized Raspiblitz SDcard build script](#Run-the-RaspiBlitz-build_sdcard.sh-script) +### Setting up the DietPi OS -### Build your own DietPi image: +Getting started with DietPi: https://dietpi.com/phpbb/viewtopic.php?f=8&t=9#p9 -Watch out this an ardous process. -Updating from a v6.14 DietPi image is causing a bootloop under some circumstances. Will be sorted once the current, >6.2 version is uploaded for the Odroids. +* Start with an ARM based Single Board Computer listed on DietPi.com. +At least 1GB RAM is recommended. +Look for the SD card image for the specific SBC in the [download section](https://dietpi.com/#download). -For the Odroid HC1 / HC2 / XU3 / XU4 the start is this image: -https://dietpi.com/downloads/images/DietPi_OdroidXU4-ARMv7-Stretch.7z -Burn it to the SD with [Etcher](https://www.balena.io/etcher/) +* Burn the image to the SDCard with [Etcher](https://www.balena.io/etcher/) and extend the rootfs partition to the size of your card with a partition manager. -Getting started with DietPi: https://dietpi.com/phpbb/viewtopic.php?f=8&t=9#p9 +* Insert the SDcard into your SBC. -In the desktop terminal on Linux / MacOS or Putty on Windows: +* Connect the HDD with a powered suitably powered adapter. +A USB 2.0 port will not be able to power an HDD so you will need extra cable +If you are connecting the HDD to a USB 3.0 port and have an at least 2A power supply, you might be able to run without an extra cable. +* Power up and log in with the desktop terminal on Linux / MacOS or Putty on Windows: `ssh root@[IP-OF-DIETPI]` password: `dietpi` -Ok > Cancel > Cancel -automatic apt update & apt upgrade and asks to reboot -![](pictures/dietpi_1st_reboot.png) -`ssh root@[IP-OF-DIETPI]` -after the previous update the ssh keys might change: - -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - -run (can be copied from the terminal output): -`ssh-keygen -f "/home/[your-linux-username]/.ssh/known_hosts" -R "dietpi.IP"` - -`ssh root@[IP-OF-DIETPI]` -yes > -password: `dietpi` - -At this point if the DietPi was not updated from 6.14 it does not manage to save settings going forward. -Exit the sotware installer (press Tab to jump to Exit) -![](pictures/dietpi-software_exit.png) - -in the bash prompt run: -`dietpi-update` ->Ok > Cancel the recovery point -update > >Opt out of survey > Ok -Reboots - -`ssh root@[IP-OF-DIETPI]` -password: `dietpi` - ->Ok > Cancel > Cancel -Search `fail2ban` > Space to select > Enter -SSH server > switch from Dropbear to the OpenSSH-server -> Install > Ok ->Opt out of survey > Ok -Reboots again +* You might be asked about updating DietPi. This is not a straightforward process if starting from a version <6.20. Try to update, it is best to build on the latest version. +* In the DietPi software menu install `fail2ban` and make `OpenSSH server` the default SSH server. Changing the SSH server will change the SSH keys again. To clear: `ssh-keygen -f "/home/[your-linux-username]/.ssh/known_hosts" -R "dietpi.IP"` - -## Run the RaspiBlitz build_sdcard.sh script - -In the desktop terminal in Linux / MacOS or Putty in Windows: - +* After every reboot log back in: `ssh root@[IP-OF-DIETPI]` -password: `dietpi` -Should end up here on version v6.20.6 or higher: +password: `dietpi` + +* Should end up here on version v6.20.6 or higher: ![](pictures/bash_prompt.png) -run the build_sdcard.sh script in this format: -`wget https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build_sdcard.sh && sudo bash build_sdcard.sh [BRANCH] [GITHUB-USERNAME]` -Be aware of that the fork needs to be called `raspiblitz` for the git download to work. -if you intend to use @openoms`s forked version: +### Run the RaspiBlitz build_sdcard.sh script -`wget https://raw.githubusercontent.com/openoms/raspiblitz/raspiblitz-dev/build_sdcard.sh && sudo bash build_sdcard.sh raspiblitz-dev openoms` +* Use this format to build the SDcard with the Raspiblitz script: +`wget https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build_sdcard.sh && sudo bash build_sdcard.sh [BRANCH] [GITHUB-USERNAME]` +If you are working from a forked repo be aware of that the fork needs to be called `raspiblitz` for the git downloads to work. +* Run the forked version of @openoms: +`wget https://raw.githubusercontent.com/openoms/raspiblitz/raspiblitz-dev/build_sdcard.sh && sudo bash build_sdcard.sh raspiblitz-dev openoms` +This will take a couple minutes depending on your internet connection and the processing power of the SBC. +* Restart when done and log back in now as `admin`: `ssh admin@[IP-OF-DROIDBLITZ]` -password: raspiblitz +password: `raspiblitz` -The setup continues with the [RaspiBlitz Setup Process](https://github.com/rootzoll/raspiblitz/blob/master/README.md#setup-process-detailed-documentation) +* From here he setup continues with the [RaspiBlitz Setup Process](https://github.com/rootzoll/raspiblitz/blob/master/README.md#setup-process-detailed-documentation) ---- -### Examples of copying the blockchain data from a HDD using a powered USB to SATA adapter -![example setup](pictures/HDD_copy_example.jpg) -![](pictures/adapterHDD_HC1.jpg) --- ### Useful commands for debugging: @@ -144,7 +83,7 @@ To test a new configuration run XXcleanHDD.sh and strictly restart `sudo tail -n100 /mnt/hdd/bitcoin/debug.log` - shows the last 100 lines `sudo systemctl status lnd` `sudo journalctl -f -u lnd` -`./home/admin/XXdebugLogs.sh` - debug log collection on the raspiblitz +`./home/admin/XXdebugLogs.sh` - debug log collection on the RaspiBlitz --- diff --git a/home.admin/00infoBlitz.sh b/home.admin/00infoBlitz.sh index da69057..75df46d 100755 --- a/home.admin/00infoBlitz.sh +++ b/home.admin/00infoBlitz.sh @@ -215,6 +215,10 @@ ln_channelInfo="\n" ln_external="\n" ln_alias="${hostname}" ln_publicColor="" +ln_port=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep "^listen=*" | cut -f2 -d':') +if [ ${#ln_port} -eq 0 ]; then + ln_port="9735" +fi wallet_unlocked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2> /dev/null | grep -c unlock) if [ "$wallet_unlocked" -gt 0 ] ; then @@ -227,7 +231,7 @@ else if [ ${ln_tor} -eq 1 ]; then ln_publicColor="${color_green}" else - public_check=$(nc -z -w6 ${public_ip} 9735 2>/dev/null; echo $?) + public_check=$(nc -z -w6 ${public_ip} ${ln_port} 2>/dev/null; echo $?) if [ $public_check = "0" ]; then # only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure ln_publicColor="${color_yellow}" @@ -282,14 +286,14 @@ ${color_yellow} /,' ${color_gray} ${color_yellow} /' ${color_gray}LND ${color_green}${ln_version} ${ln_baseInfo} ${color_yellow} ${color_gray}${ln_channelInfo} ${ln_peersInfo} ${color_yellow} -${color_yellow}${ln_publicColor}${ln_external} +${color_yellow}${ln_publicColor}${ln_external}${color_red} " \ "RaspiBlitz v${codeVersion}" \ "-------------------------------------------" \ "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 - maybe upgrade power supply" fi diff --git a/home.admin/00infoLCD.sh b/home.admin/00infoLCD.sh index fe36ef4..e3aaed1 100755 --- a/home.admin/00infoLCD.sh +++ b/home.admin/00infoLCD.sh @@ -160,6 +160,36 @@ while : # DISPLAY AFTER SETUP ########################### + if [ "${state}" = "repair" ]; then + l1="Repair Mode\n" + l2="ssh admin@${localip}\n" + l3="Use password: PasswordA\n" + boxwidth=$((${#localip} + 28)) + dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth} + sleep 3 + continue + fi + + if [ "${state}" = "retorrent" ]; then + l1="Repair Mode- TORRENT\n" + l2="ssh admin@${localip}\n" + l3="Use password: PasswordA\n" + boxwidth=$((${#localip} + 28)) + dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth} + sleep 3 + continue + fi + + if [ "${state}" = "recopy" ]; then + l1="Repair Mode - COPY\n" + l2="ssh admin@${localip}\n" + l3="Use password: PasswordA\n" + boxwidth=$((${#localip} + 28)) + dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth} + sleep 3 + continue + fi + # check if bitcoin is ready sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 1>/dev/null 2>error.tmp clienterror=`cat error.tmp` @@ -198,7 +228,7 @@ while : l2="ssh admin@${localip}\n" l3="Waiting for AUTO-UNLOCK" fi - boxwidth=$((${#localip} + 24)) + boxwidth=$((${#localip} + 26)) dialog --backtitle "RaspiBlitz ${codeVersion} (${localip}) - ${hostname}" --infobox "$l1$l2$l3$l4" ${h} ${boxwidth} sleep 5 continue diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index 5f40455..a7e99da 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -65,6 +65,15 @@ if [ "${state}" = "reindex" ]; then exit 1 fi +# singal that torrent is in re-download +if [ "${state}" = "retorrent" ]; then + echo "Re-Index in progress ... start monitoring:" + /home/admin/50torrentHDD.sh + sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info + /home/admin/00mainMenu.sh + exit +fi + # if pre-sync is running - stop it - before continue if [ "${state}" = "presync" ]; then # stopping the pre-sync @@ -134,18 +143,92 @@ 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 + minSize=250000000000 + if [ "${network}" = "litecoin" ]; then + minSize=20000000000 + fi + blockchainsize=$(sudo du -shbc /mnt/hdd/${network} | head -n1 | awk '{print $1;}') + echo "blockchainsize(${blockchainsize})" + if [ ${#blockchainsize} -gt 0 ]; then + if [ ${blockchainsize} -lt ${minSize} ]; then + echo "Missing Blockchain Data (<${minSize}) ..." + 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." + sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info 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 + sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info + /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 + sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info + /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/00settingsMenuServices.sh b/home.admin/00settingsMenuServices.sh index 0f2cfd4..51f592d 100644 --- a/home.admin/00settingsMenuServices.sh +++ b/home.admin/00settingsMenuServices.sh @@ -170,14 +170,23 @@ choice="off"; check=$(echo "${CHOICES}" | grep -c "5") if [ ${check} -eq 1 ]; then choice="on"; fi if [ "${rtlWebinterface}" != "${choice}" ]; then echo "RTL Webinterface Setting changed .." + anychange=1 sudo /home/admin/config.scripts/bonus.rtl.sh ${choice} + errorOnInstall=$? if [ "${choice}" = "on" ]; then - localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') - l1="RTL web servcie will be ready AFTER NEXT REBOOT:" - l2="Try to open the following URL in your local webrowser" - l3="and login with your PASSWORD B." - l4="---> http://${localip}:3000" - dialog --title 'OK' --msgbox "${l1}\n${l2}\n${l3}\n${l4}" 11 65 + if [ ${errorOnInstall} -eq 0 ]; then + localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') + l1="RTL web servcie will be ready AFTER NEXT REBOOT:" + l2="Try to open the following URL in your local webrowser" + l3="and login with your PASSWORD B." + l4="---> http://${localip}:3000" + dialog --title 'OK' --msgbox "${l1}\n${l2}\n${l3}\n${l4}" 11 65 + else + l1="!!! FAIL on RTL install !!!" + l2="Try manual install on terminal after rebootwith:" + l3="sudo /home/admin/config.scripts/bonus.rtl.sh on" + dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 10 65 + fi fi needsReboot=1 else diff --git a/home.admin/10setupBlitz.sh b/home.admin/10setupBlitz.sh index 6eb5ad1..d17206f 100755 --- a/home.admin/10setupBlitz.sh +++ b/home.admin/10setupBlitz.sh @@ -188,7 +188,6 @@ if [ ${mountOK} -eq 1 ]; then menuitem=$(dialog --clear --beep --backtitle "RaspiBlitz" --title "Getting the Blockchain" \ --menu "You need a copy of the Bitcoin Blockchain - you have 5 options:" 13 75 5 \ T "TORRENT --> MAINNET + TESTNET thru Torrent (DEFAULT)" \ - D "DOWNLOAD --> MAINNET + TESTNET per FTP (FALLBACK)" \ C "COPY --> BLOCKCHAINDATA from another node with SCP" \ N "CLONE --> BLOCKCHAINDATA from 2nd HDD (extra cable)"\ S "SYNC --> MAINNET thru Bitcoin Network (ULTRA SLOW)" 2>&1 >/dev/tty) @@ -199,7 +198,6 @@ if [ ${mountOK} -eq 1 ]; then menuitem=$(dialog --clear --beep --backtitle "RaspiBlitz" --title "Getting the Blockchain" \ --menu "You need a copy of the Litecoin Blockchain - you have 3 options:" 13 75 4 \ T "TORRENT --> MAINNET thru Torrent (DEFAULT)" \ - D "DOWNLOAD --> MAINNET per FTP (FALLBACK)" \ S "SYNC --> MAINNET thru Litecoin Network (FALLBACK+SLOW)" 2>&1 >/dev/tty) # error @@ -225,9 +223,6 @@ if [ ${mountOK} -eq 1 ]; then S) /home/admin/50syncHDD.sh ;; - D) - /home/admin/50downloadHDD.sh - ;; esac exit 1 diff --git a/home.admin/40addHDD.sh b/home.admin/40addHDD.sh index 41c418b..864e92a 100755 --- a/home.admin/40addHDD.sh +++ b/home.admin/40addHDD.sh @@ -25,7 +25,8 @@ if [ ${existsHDD} -gt 0 ]; then uuid=$1 fstabOK=$(cat /etc/fstab | grep -c ${uuid}) if [ ${fstabOK} -eq 0 ]; then - fstabAdd="UUID=${uuid} /mnt/hdd ext4 noexec,defaults 0 0" + # see https://github.com/rootzoll/raspiblitz/issues/360#issuecomment-467567572 + fstabAdd="UUID=${uuid} /mnt/hdd ext4 noexec,defaults 0 2" echo "Adding line to /etc/fstab ..." echo ${fstabAdd} # adding the new line after line 3 to the /etc/fstab @@ -46,6 +47,10 @@ if [ ${existsHDD} -gt 0 ]; then echo "OK - HDD is mounted" echo "" + # setting fsk check intervall to 1 + # see https://github.com/rootzoll/raspiblitz/issues/360#issuecomment-467567572 + sudo tune2fs -c 1 /dev/sda1 + # init the RASPIBLITZ Config configFile="/mnt/hdd/raspiblitz.conf" configExists=$(sudo ls ${configFile} | grep -c 'raspiblitz.conf') @@ -64,6 +69,19 @@ if [ ${existsHDD} -gt 0 ]; then # try to determine publicIP and if not possible use localIP as placeholder # https://github.com/rootzoll/raspiblitz/issues/312#issuecomment-462675101 freshPublicIP=$(curl -s http://v4.ipv6-test.com/api/myip.php) + + # sanity check on IP data + # see https://github.com/rootzoll/raspiblitz/issues/371#issuecomment-472416349 + echo "-> sanity check of IP data: ${freshPublicIP}" + if [[ $freshPublicIP =~ ^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$ ]]; then + echo "OK IPv6" + elif [[ $freshPublicIP =~ ^([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$ ]]; then + echo "OK IPv4" + else + echo "FAIL - not an IPv4 or IPv6 address" + freshPublicIP="" + fi + if [ ${#freshPublicIP} -eq 0 ]; then localIP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') echo "WARNING: No publicIP information at all yet - working with placeholder : ${localIP}" diff --git a/home.admin/50copyHDD.sh b/home.admin/50copyHDD.sh index 5e57e69..1616238 100755 --- a/home.admin/50copyHDD.sh +++ b/home.admin/50copyHDD.sh @@ -6,40 +6,52 @@ 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 - sudo systemctl stop bitcoind + sudo systemctl stop bitcoind + sudo cp -f /mnt/hdd/bitcoin/bitcoin.conf /home/admin/assets/bitcoin.conf 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 -# create bitcoin base directory and link with bitcoin user -echo "delete and create new blockchain directory ..." -sudo rm -rf /mnt/hdd/bitcoin 2>/dev/null -sudo rm -rf /home/bitcoin/.bitcoin 2>/dev/null -sudo mkdir /mnt/hdd/bitcoin -sudo chown bitcoin:bitcoin /mnt/hdd/bitcoin -sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin - -# check setup -echo "checking setup ..." -sudo touch /home/bitcoin/.bitcoin/test.txt -createdCorerct=$(sudo ls /mnt/hdd/bitcoin/test.txt | grep -c 'test.txt') -sudo rm /home/bitcoin/.bitcoin/test.txt -if [ ${createdCorerct} -eq 0 ]; then - sudo rm -rf /mnt/hdd/bitcoin - sudo rm -rf /home/bitcoin/.bitcoin - echo "FAILED: sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin" - echo "Press ENTER to get back to menu ..." - read key - exit 1 -fi +# make sure /mnt/hdd/bitcoin exists +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" @@ -56,7 +68,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}:/home/bitcoin/.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." @@ -66,9 +82,6 @@ echo "PRESS ENTER if transfers is done OR if you want to choose another another sleep 2 read key -# unlink bitcoin user (will created later in setup again) -sudo unlink /home/bitcoin/.bitcoin - # make quick check if data is there anyDataAtAll=0 quickCheckOK=1 @@ -100,42 +113,66 @@ if [ ${count} -lt 1500 ]; then quickCheckOK=0 fi +echo "*********************************************" +echo "QUICK CHECK RESULT" +echo "*********************************************" + # just if any data transferred .. if [ ${anyDataAtAll} -eq 1 ]; then # data was invalid - ask user to keep? if [ ${quickCheckOK} -eq 0 ]; then - echo "*********************************************" - echo "There seems to be an invalid transfer." - echo "Wait 5 secs ..." - sleep 5 - dialog --title " INVALID TRANSFER - DELETE DATA?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. This can lead further RaspiBlitz setup to get stuck in error state.\nDo you want to reset/delete data data?" 8 60 - response=$? - echo "response(${response})" - case $response in - 1) quickCheckOK=1 ;; - esac - fi - if [ ${quickCheckOK} -eq 0 ]; then - echo "Deleting invalid Data ..." - sudo rm -rf /mnt/hdd/bitcoin - sudo rm -rf /home/bitcoin/.bitcoin - sleep 2 + echo "FAIL -> DATA seems incomplete." + + else + + echo "OK -> DATA LOOKS GOOD :D" + sudo rm /mnt/hdd/bitcoin/debug.log + fi else + + echo "CANCEL -> NO DATA was copied." + quickCheckOK=0 + +fi +echo "*********************************************" + +# if started after intial setup - quit here +if [ "${setupStep}" = "100" ]; then + sudo cp /home/admin/assets/bitcoin.conf /mnt/hdd/bitcoin/bitcoin.conf + sudo chown bitcoin:bitcoin /mnt/hdd/bitcoin/bitcoin.conf + sudo systemctl enable bitcoind + echo "DONE - reboot is needed: sudo shutdown -r now" + exit 0 +fi + +# REACT ON QUICK CHECK DURING INITAL SETUP + + +if [ ${quickCheckOK} -eq 0 ]; then + + echo "*********************************************" + echo "There seems to be an invalid transfer." + + echo "Wait 5 secs ..." + sleep 5 + dialog --title " INVALID TRANSFER - DELETE DATA?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. This can lead further RaspiBlitz setup to get stuck in error state.\nDo you want to reset/delete data data?" 8 60 + response=$? + echo "response(${response})" + case $response in + 1) quickCheckOK=1 ;; + esac - echo "back to menu ..." - # when no data transferred - just delete bitcoin base dir again +fi + +if [ ${quickCheckOK} -eq 0 ]; then + echo "Deleting invalid Data ... " sudo rm -rf /mnt/hdd/bitcoin sleep 2 - fi -if [ ${setupStep} -lt 100 ]; then - # setup script will decide the next logical step - /home/admin/10setupBlitz.sh -else - "DONE - reboot is needed: sudo shutdown -r now" -fi \ No newline at end of file +# setup script will decide the next logical step +/home/admin/10setupBlitz.sh diff --git a/home.admin/50torrentHDD.sh b/home.admin/50torrentHDD.sh index d95dbf4..6702e39 100755 --- a/home.admin/50torrentHDD.sh +++ b/home.admin/50torrentHDD.sh @@ -7,6 +7,14 @@ echo "" ## get basic info source /home/admin/raspiblitz.info + +# if setup was done - remove old data +if [ "${setupStep}" = "100" ]; then + echo "stopping servcies ..." + sudo systemctl stop lnd + sudo systemctl stop ${network}d +fi + # make sure rtorrent is available sudo apt-get install rtorrent -y echo "" @@ -245,7 +253,7 @@ if [ ${torrentError} -gt 0 ]; then # User Cancel --> Torrent incomplete sleep 3 echo -ne '\007' - dialog --title " WARNING (${torrentError})" --yesno "The Torrent download failed or is not complete - maybe try FTP download next time. Do you want keep already downloaded torrent data?" 8 57 + dialog --title " WARNING (${torrentError})" --yesno "The Torrent download failed or is not complete - maybe try COPY option. Do you want keep already downloaded torrent data?" 8 57 response=$? case $response in 1) sudo rm -rf ${targetDir}; sudo rm -rf ${sessionDir} ;; @@ -255,12 +263,22 @@ if [ ${torrentError} -gt 0 ]; then fi -# Download worked / just move, copy on USB2 >4h +# if setup was done - remove old data +if [ "${setupStep}" = "100" ]; then + echo "stopping servcies ..." + sudo systemctl stop lnd + sudo systemctl stop ${network}d + 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 would be >4h echo "" echo "*** Moving Files ***" date +%s -echo "can take some minutes... please wait" - +echo "can take 10-60 minutes... please wait" sudo mkdir /mnt/hdd/${network} 2>/dev/null sudo mv ${targetPath1}/* /mnt/hdd/${network}/ sudo cp -r ${targetPath2}/* /mnt/hdd/${network}/ @@ -268,7 +286,12 @@ sudo rm -r ${targetDir} echo "OK" date +%s -if [ ${setupStep} -lt 100 ]; then +if [ "${setupStep}" = "100" ]; then + sudo cp /home/admin/assets/${network}.conf /mnt/hdd/${network}/${network}.conf + sudo chown -R bitcoin:bitcoin /mnt/hdd/${network}/ + sudo systemctl enable ${network}d + echo "DONE - reboot needed: sudo shutdown -r now" +else # set SetupState sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info # continue setup diff --git a/home.admin/97addMobileWalletShango.sh b/home.admin/97addMobileWalletShango.sh index 3070efb..2d85f70 100644 --- a/home.admin/97addMobileWalletShango.sh +++ b/home.admin/97addMobileWalletShango.sh @@ -42,7 +42,8 @@ read key clear echo "*** STEP 2 : SCAN MACAROON (make whole QR code fill camera) ***" -echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && cat ./.lnd/tls.cert >>qr.txt && qrencode -t ANSI256 < qr.txt +#echo -e "${myip}:10009,\n$(xxd -p -c2000 ~/.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && qrencode -t ANSIUTF8 < qr.txt +echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && qrencode -t ANSI256 < qr.txt echo "(To shrink QR code: OSX->CMD- / LINUX-> CTRL-) Press ENTER when finished." read key shred qr.txt diff --git a/home.admin/97addMobileWalletZap.sh b/home.admin/97addMobileWalletZap.sh index 116db47..5d2dd0a 100755 --- a/home.admin/97addMobileWalletZap.sh +++ b/home.admin/97addMobileWalletZap.sh @@ -15,11 +15,13 @@ if [ ${#GOPATH} -eq 0 ]; then fi # make sure go is installed +goVersion="1.11" +echo "### Check Framework: GO ###" goInstalled=$(go version 2>/dev/null | grep -c 'go') if [ ${goInstalled} -eq 0 ];then - echo "### Installing GO ###" - wget https://storage.googleapis.com/golang/go1.11.linux-armv6l.tar.gz - sudo tar -C /usr/local -xzf go1.11.linux-armv6l.tar.gz + echo "---> Installing GO" + wget https://storage.googleapis.com/golang/go${goVersion}.linux-armv6l.tar.gz + sudo tar -C /usr/local -xzf go${goVersion}.linux-armv6l.tar.gz sudo rm *.gz sudo mkdir /usr/local/gocode sudo chmod 777 /usr/local/gocode @@ -27,16 +29,24 @@ if [ ${goInstalled} -eq 0 ];then fi if [ ${goInstalled} -eq 0 ];then echo "FAIL: Was not able to install GO (needed to run LndConnect)" + sleep 4 exit 1 fi +clear +correctGoVersion=$(go version | grep -c "go${goVersion}") +if [ ${correctGoVersion} -eq 0 ]; then + echo "WARNING: You work with a untested version of GO - should be ${goVersion} .. trying to continue" + go version + sleep 6 + echo "" +fi # make sure qrcode-encoder in installed -clear echo "*** Setup ***" echo "" -echo "Installing zapconnect. Please wait..." +echo "Installing zapconnect." echo "" -echo "Getting github.com/LN-Zap/lndconnect (please wait) ..." +echo "Getting github.com/LN-Zap/lndconnect (please wait - can take several minutes) ..." go get -d github.com/LN-Zap/lndconnect cd $GOPATH/src/github.com/LN-Zap/lndconnect echo "" @@ -52,10 +62,10 @@ echo "******************************" echo "" echo "GETTING THE APP" echo "At the moment this app is in closed beta testing and the source code has not been published yet." -echo "Go to http://www.zap-ios.jackmallers.com sign up with your email (confirmation can take time)" -echo "iOS: Read https://developer.apple.com/testflight/testers/" +echo "1. Install the app 'TestFlight' from Apple Appstore. Open it and agree to all terms of services." +echo "2. Open on your iOS device https://github.com/LN-Zap/zap-iOS and follow 'Download the Alpha'" echo "" -echo "*** STEP 1 ***" +echo "*** PAIRING STEP 1 ***" if [ ${#dynDomain} -eq 0 ]; then echo "Once you have the app is running make sure you are on the same local network (WLAN same as LAN)." fi @@ -67,7 +77,7 @@ echo "Then PRESS ENTER here in the terminal to generare the QR code and scan it read key clear -echo "*** STEP 2 : Click on Scan (make whole QR code fill camera) ***" +echo "*** PAIRING STEP 2 : Click on Scan (make whole QR code fill camera) ***" if [ ${#dynDomain} -eq 0 ]; then # If you drop the -i parameter, lndconnect will use the external IP. 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 21d2153..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 @@ -80,6 +99,18 @@ do echo "freshPublicIP(${freshPublicIP})" echo "publicIP(${publicIP})" + # sanity check on IP data + # see https://github.com/rootzoll/raspiblitz/issues/371#issuecomment-472416349 + echo "-> sanity check of IP data: ${freshPublicIP}" + if [[ $freshPublicIP =~ ^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$ ]]; then + echo "OK IPv6" + elif [[ $freshPublicIP =~ ^([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$ ]]; then + echo "OK IPv4" + else + echo "FAIL - not an IPv4 or IPv6 address" + freshPublicIP="" + fi + if [ ${#freshPublicIP} -eq 0 ]; then echo "freshPublicIP is ZERO - ignoring" diff --git a/home.admin/_bootstrap.provision.sh b/home.admin/_bootstrap.provision.sh index cd31025..77a344e 100644 --- a/home.admin/_bootstrap.provision.sh +++ b/home.admin/_bootstrap.provision.sh @@ -156,5 +156,23 @@ else echo "Provisioning TOR - keep default" >> ${logFile} fi +# CUSTOM PORT +echo "Provisioning LND Port" >> ${logFile} +lndPort=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep "^listen=*" | cut -f2 -d':') +if [ ${#lndPort} -gt 0 ]; then + if [ "${lndPort}" != "9735" ]; then + echo "User is running custom LND port: ${lndPort}" >> ${logFile} + sudo /home/admin/config.scripts/lnd.setport.sh ${lndPort} >> ${logFile} 2>&1 + else + echo "User is running standard LND port: ${lndPort}" >> ${logFile} + fi +else + echo "Was not able to get LND port from config." >> ${logFile} +fi + sudo sed -i "s/^message=.*/message='Setup Done'/g" ${infoFile} + +echo "DONE - Give raspi some cool off time after hard building .... 20 secs sleep" >> ${logFile} +sleep 20 + echo "END Provisioning" >> ${logFile} \ No newline at end of file diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index 814219c..456b5eb 100644 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -38,6 +38,12 @@ echo "Running RaspiBlitz Bootstrap ${codeVersion}" >> $logFile date >> $logFile echo "***********************************************" >> $logFile +# display 3 secs logo - try to kickstart LCD +# see https://github.com/rootzoll/raspiblitz/issues/195#issuecomment-469918692 +sudo fbi -a -T 1 -d /dev/fb1 --noverbose /home/admin/raspiblitz/pictures/logoraspiblitz.png +sleep 5 +sudo killall -3 fbi + # set default values for raspiblitz.info network="" chain="" @@ -58,6 +64,22 @@ if [ "${setupStep}" != "100" ]; then fi sudo chmod 777 ${infoFile} +# Emergency cleaning logs when over 1GB (to prevent SD card filling up) +# see https://github.com/rootzoll/raspiblitz/issues/418#issuecomment-472180944 +echo "*** Checking Log Size ***" +logsMegaByte=$(sudo du -c -m /var/log | grep "total" | awk '{print $1;}') +if [ ${logsMegaByte} -gt 1000 ]; then + echo "WARN !! Logs /var/log in are bigger then 1GB" + echo "ACTION --> DELETED ALL LOGS" + sudo rm -r /var/log/* + sleep 3 + echo "WARN !! Logs in /var/log in were bigger then 1GB and got emergency delete to prevent fillup." + echo "If you see this in the logs please report to the GitHub issues, so LOG config needs to hbe optimized." +else + echo "OK - logs are at ${logsMegaByte} MB - within safety limit" +fi +echo "" + ################################ # GENERATE UNIQUE SSH PUB KEYS # on first boot up @@ -288,6 +310,19 @@ if [ ${configExists} -eq 1 ]; then # wait otherwise looking for publicIP fails sleep 5 freshPublicIP=$(curl -s http://v4.ipv6-test.com/api/myip.php) + + # sanity check on IP data + # see https://github.com/rootzoll/raspiblitz/issues/371#issuecomment-472416349 + echo "-> sanity check of IP data: ${freshPublicIP}" + if [[ $freshPublicIP =~ ^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$ ]]; then + echo "OK IPv6" + elif [[ $freshPublicIP =~ ^([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$ ]]; then + echo "OK IPv4" + else + echo "FAIL - not an IPv4 or IPv6 address" + freshPublicIP="" + fi + if [ ${#freshPublicIP} -eq 0 ]; then # prevent having no publicIP set at all and LND getting stuck # https://github.com/rootzoll/raspiblitz/issues/312#issuecomment-462675101 diff --git a/home.admin/_version.info b/home.admin/_version.info index 4b034a1..ba1762e 100644 --- a/home.admin/_version.info +++ b/home.admin/_version.info @@ -1,2 +1,2 @@ # RaspiBlitz Version - always [main].[sub] -codeVersion="1.0" \ No newline at end of file +codeVersion="1.1" \ No newline at end of file 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.bitcoin.conf b/home.admin/assets/lnd.bitcoin.conf index 05537ec..a6db19e 100755 --- a/home.admin/assets/lnd.bitcoin.conf +++ b/home.admin/assets/lnd.bitcoin.conf @@ -1,7 +1,7 @@ # lnd configuration [Application Options] -debuglevel=debug +debuglevel=info maxpendingchannels=5 alias=raspiblitz color=#68F442 diff --git a/home.admin/assets/lnd.litecoin.conf b/home.admin/assets/lnd.litecoin.conf index bf9bdc1..4f50520 100755 --- a/home.admin/assets/lnd.litecoin.conf +++ b/home.admin/assets/lnd.litecoin.conf @@ -1,7 +1,7 @@ # lnd configuration [Application Options] -debuglevel=debug +debuglevel=info maxpendingchannels=5 alias=raspiblitz color=#68F442 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/bonus.rtl.sh b/home.admin/config.scripts/bonus.rtl.sh index 204cb56..5e2b77d 100755 --- a/home.admin/config.scripts/bonus.rtl.sh +++ b/home.admin/config.scripts/bonus.rtl.sh @@ -29,9 +29,6 @@ sudo systemctl stop RTL 2>/dev/null if [ "$1" = "1" ] || [ "$1" = "on" ]; then echo "*** INSTALL RTL ***" - # setting value in raspi blitz config - sudo sed -i "s/^rtlWebinterface=.*/rtlWebinterface=on/g" /mnt/hdd/raspiblitz.conf - isInstalled=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service') if [ ${isInstalled} -eq 0 ]; then @@ -42,18 +39,42 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then sudo apt-get install -y nodejs echo "" + # check if nodeJS was installed + nodeJSInstalled=$(node -v | grep -c "v11.") + if [ nodeJSInstalled -eq 0 ]; then + echo "FAIL - Was not able to install nodeJS 11" + echo "ABORT - RTL install" + exit 1 + fi + # download source code and set to tag release echo "*** Get the RTL Source Code ***" git clone https://github.com/ShahanaFarooqui/RTL.git cd RTL - #git reset --hard v0.1.13-alpha - git reset --hard v0.1.14-alpha + git reset --hard v0.2.15 + # check if node_modles exists now + if [ -d "/home/admin/RTL" ]; then + echo "OK - RTL code copy looks good" + else + echo "FAIL - code copy did not run correctly" + echo "ABORT - RTL install" + exit 1 + fi + echo "" # install echo "*** Run: npm install ***" npm install cd .. + # check if node_modles exists now + if [ -d "/home/admin/RTL/node_modules" ]; then + echo "OK - RTL install looks good" + else + echo "FAIL - npm install did not run correctly" + echo "ABORT - RTL install" + exit 1 + fi echo "" # prepare RTL.conf file @@ -77,10 +98,14 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then sudo sed -i "s|chain/bitcoin/mainnet|chain/${network}/${chain}net|" /etc/systemd/system/RTL.service sudo systemctl enable RTL echo "OK - RTL is now ACTIVE" + else echo "RTL already installed." fi + # setting value in raspi blitz config + sudo sed -i "s/^rtlWebinterface=.*/rtlWebinterface=on/g" /mnt/hdd/raspiblitz.conf + echo "needs reboot to activate new setting" exit 0 fi diff --git a/home.admin/config.scripts/internet.dyndomain.sh b/home.admin/config.scripts/internet.dyndomain.sh index 67f29e3..83cdd30 100755 --- a/home.admin/config.scripts/internet.dyndomain.sh +++ b/home.admin/config.scripts/internet.dyndomain.sh @@ -11,15 +11,25 @@ fi turn="off" if [ "$1" = "1" ] || [ "$1" = "on" ]; then turn="on"; fi +echo "number of args($#)" + # 2. parameter [?domainName] -dynDomain=$2 +if [ $# > 1 ]; then + dynDomain=$2 +fi # 3. parameter [?domainName] -updateDynDomain=$3 +if [ $# > 2 ]; then + dynUpdateUrl=$3 +fi # run interactive if 'turn on' && no further parameters if [ "${turn}" = "on" ] && [ ${#dynDomain} -eq 0 ]; then + # make sure dialog file is writeable + sudp touch ./.tmp + sudo chmod 777 ./.tmp + dialog --backtitle "DynamicDNS" --inputbox "ENTER the Dynamic Domain Name: For more details see chapter in GitHub README @@ -81,7 +91,15 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then # setting value in raspi blitz config sudo sed -i "s/^dynDomain=.*/dynDomain='${dynDomain}'/g" /mnt/hdd/raspiblitz.conf - sudo sed -i "s/^dynUpdateUrl=.*/dynUpdateUrl='${dynUpdateUrl}'/g" /mnt/hdd/raspiblitz.conf + + # setting dynUpdateUrl is a bit cpmplicated because value can contain chars that break sed replacement + # so first remove dynUpdateUrl from config and then add fresh as new line at the end + grep -v "dynUpdateUrl" /mnt/hdd/raspiblitz.conf > ./raspiblitz.conf.new + echo "dynUpdateUrl='${dynUpdateUrl}'" >> ./raspiblitz.conf.new + sudo rm /mnt/hdd/raspiblitz.conf + sudo mv ./raspiblitz.conf.new /mnt/hdd/raspiblitz.conf + sudo chmod 777 /mnt/hdd/raspiblitz.conf + #sudo sed -i "s/^dynUpdateUrl=.*/dynUpdateUrl='${dynUpdateUrl}'/g" /mnt/hdd/raspiblitz.conf echo "changing lnd.conf" diff --git a/home.admin/config.scripts/lnd.autounlock.sh b/home.admin/config.scripts/lnd.autounlock.sh index 92b290c..d08056f 100755 --- a/home.admin/config.scripts/lnd.autounlock.sh +++ b/home.admin/config.scripts/lnd.autounlock.sh @@ -1,5 +1,8 @@ #!/bin/bash +# requests missing in dietpi +sudo pip install requests + # command info if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then echo "small config script to autounlock lnd after restart" 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/home.admin/config.scripts/lnd.setport.sh b/home.admin/config.scripts/lnd.setport.sh new file mode 100644 index 0000000..e880f82 --- /dev/null +++ b/home.admin/config.scripts/lnd.setport.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# based on: https://github.com/rootzoll/raspiblitz/issues/100#issuecomment-465997126 + +if [ $# -eq 0 ]; then + echo "small config script set the port LND is running on" + echo "lnd.setport.sh [portnumber]" + exit 1 +fi + +portnumber=$1 + +# check port numer is a integer +if ! [ "$portnumber" -eq "$portnumber" ] 2> /dev/null +then + echo "FAIL - portnumber(${portnumber}) not a number" + exit 1 +fi + +# check port number is bigger then zero +if [ ${portnumber} -lt 1 ]; then + echo "FAIL - portnumber(${portnumber}) not above 0" + exit 1 +fi + +# check port number is smaller than max +if [ ${portnumber} -gt 65535 ]; then + echo "FAIL - portnumber(${portnumber}) not below 65535" + exit 1 +fi + +# check if TOR is on +source /mnt/hdd/raspiblitz.conf +if [ "${runBehindTor}" = "on" ]; then + echo "FAIL - portnumber cannot be changed if TOR is ON (not implemented)" + exit 1 +fi + +# check lnd.conf exits +lndConfExists=$(sudo ls /mnt/hdd/lnd/lnd.conf | grep -c 'lnd.conf') +if [ ${lndConfExists} -eq 0 ]; then + echo "FAIL - /mnt/hdd/lnd/lnd.conf not found" + exit 1 +fi + +# check if "listen=" exists in lnd config +valueExists=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c 'listen=') +if [ ${valueExists} -lt 3 ]; then + echo "Adding listen config defaults to /mnt/hdd/lnd/lnd.conf" + sudo sed -i "9i listen=0.0.0.0:9735" /mnt/hdd/lnd/lnd.conf +fi + +# stop services +echo "making sure LND is not running" +sudo systemctl stop lnd 2>/dev/null + +# disable services +echo "making sure LND is disabled" +sudo systemctl disable lnd + +# change port in lnd config +echo "change port in lnd config" +sudo sed -i "s/^listen=.*/listen=0.0.0.0:${portnumber}/g" /mnt/hdd/lnd/lnd.conf + +# editing service file +echo "editing /etc/systemd/system/lnd.service" +sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:${portnumber}/g" /etc/systemd/system/lnd.service + +# enable service again +echo "enable service again" +sudo systemctl enable lnd + +# make sure port is open on firewall +sudo ufw allow ${portnumber} comment 'LND Port' +sudo ufw --force enable + +echo "needs reboot to activate new setting -> sudo shutdown -r now" \ No newline at end of file diff --git a/home.admin/config.scripts/network.reindex.sh b/home.admin/config.scripts/network.reindex.sh index 881e753..e1c3950 100755 --- a/home.admin/config.scripts/network.reindex.sh +++ b/home.admin/config.scripts/network.reindex.sh @@ -50,7 +50,9 @@ while [ ${finished} -eq 0 ] echo "REINDEXING BLOCKCHAIN" echo "*************************" date - echo "THIS CAN TAKE SOME LONG TIME" + echo "THIS CAN TAKE SOME VERY LONG TIME" + echo "See Raspiblitz FAQ: https://github.com/rootzoll/raspiblitz" + echo "On question: My blockchain data is corrupted - what can I do?" echo "If you dont see any progress after 24h keep X pressed to stop." # get blockchain sync progress diff --git a/pictures/logoraspiblitz.png b/pictures/logoraspiblitz.png new file mode 100644 index 0000000..b139cfb Binary files /dev/null and b/pictures/logoraspiblitz.png differ diff --git a/raspiblitz-v1.0-2019-02-18.torrent b/raspiblitz-v1.0-2019-02-18.torrent new file mode 100755 index 0000000..a196986 Binary files /dev/null and b/raspiblitz-v1.0-2019-02-18.torrent differ 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 new file mode 100644 index 0000000..06272b9 --- /dev/null +++ b/shoppinglist_ca.md @@ -0,0 +1,7 @@ +## Shopping List: Amazon Canada + +* RaspBerry Pi 3: https://amzn.to/2NDLD31 +* 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 new file mode 100644 index 0000000..310a569 --- /dev/null +++ b/shoppinglist_es.md @@ -0,0 +1,8 @@ +## Shopping List: Amazon Spain + +* RaspBerry Pi 3: https://www.amazon.es/gp/product/B07BDR5PDW/ +* 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/ +* LCD-Display: https://www.amazon.es/gp/product/B01MZZ1VY1/ 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 89f9ea0..fd42a4d 100644 --- a/shoppinglist_uk.md +++ b/shoppinglist_uk.md @@ -1,8 +1,8 @@ ## 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 -* Power: https://www.amazon.co.uk/iTrunk-Raspberry-Model-Supply-Charger/dp/B01MFFSPHE +* 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 * LCD-Display: https://www.amazon.co.uk/ELEGOO-480x320-Raspberry-Monitor-Interface/dp/B01MRQTMTD \ No newline at end of file diff --git a/shoppinglist_usa.md b/shoppinglist_usa.md index 7bc953d..1ed0fa8 100644 --- a/shoppinglist_usa.md +++ b/shoppinglist_usa.md @@ -1,8 +1,8 @@ ## 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 -* LCD-Display: http://a.co/65p2wu6 \ No newline at end of file +* LCD-Display: http://a.co/65p2wu6 or https://www.amazon.com/gp/product/B01CNJVG8K/ or https://www.amazon.com/dp/B06X191RX7 or https://www.sparkfun.com/products/14776 \ No newline at end of file