diff --git a/FAQ.md b/FAQ.md index 9ddf2d6..1babd3b 100644 --- a/FAQ.md +++ b/FAQ.md @@ -55,11 +55,11 @@ 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`). @@ -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. @@ -343,6 +343,10 @@ The downloaded blockchain is pre-indexed and pre-validated. That should be pract 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. @@ -545,4 +549,15 @@ If you get this error by LND that means that something is wrong with the macaroo 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. \ No newline at end of file +* 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 bc91136..159d060 100644 --- a/README.md +++ b/README.md @@ -189,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?]() +* [Why is taking my torrent download of the blockchain so long?](FAQ.md#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: - -![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. @@ -216,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. diff --git a/build_sdcard.sh b/build_sdcard.sh index 6983887..b303dc4 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,27 @@ 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 +sudo head -n 18 /etc/logrotate.d/rsyslog > ./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 +sudo tail -n +19 /etc/logrotate.d/rsyslog >> ./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 +186,15 @@ 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 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 diff --git a/home.admin/00settingsMenuServices.sh b/home.admin/00settingsMenuServices.sh index 843f77b..51f592d 100644 --- a/home.admin/00settingsMenuServices.sh +++ b/home.admin/00settingsMenuServices.sh @@ -172,13 +172,21 @@ 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/50torrentHDD.sh b/home.admin/50torrentHDD.sh index bc44b5b..9e8d731 100755 --- a/home.admin/50torrentHDD.sh +++ b/home.admin/50torrentHDD.sh @@ -245,7 +245,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} ;; diff --git a/home.admin/97addMobileWalletZap.sh b/home.admin/97addMobileWalletZap.sh index 116db47..666cc14 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,11 +29,19 @@ 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..." @@ -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/_background.sh b/home.admin/_background.sh index 21d2153..f9310a1 100644 --- a/home.admin/_background.sh +++ b/home.admin/_background.sh @@ -80,6 +80,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.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/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/config.scripts/bonus.rtl.sh b/home.admin/config.scripts/bonus.rtl.sh index 26781e5..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.2.1 - #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/pictures/logoraspiblitz.png b/pictures/logoraspiblitz.png new file mode 100644 index 0000000..b139cfb Binary files /dev/null and b/pictures/logoraspiblitz.png differ