beep-projects / SystaPi

Adding WiFi and a REST API to Paradigma SystaComfort units
GNU General Public License v3.0
16 stars 3 forks source link

Installation failed => Solutions! #10

Closed fhroland closed 1 year ago

fhroland commented 2 years ago

Installation with the current Raspian fails. Problems: (1) The password in the project's firstrun.sh is obviously wrong or is then processed incorrectly. Solution: Just configure a user and a password with Raspberry Pi Imager and take both from the generated firstrun.sh of the Raspian distribution to initialize the environment variables in the firstrun.sh of the project. (2) However, firstrun.sh of the project is apparently incompatible with the installation scripts of the Raspian distribution from line 72 onwards, which causes the system to boot but you cannot log in with SSH. Solution: In the firstrun.sh of the Beep project, simply replace the part after "End configuration" up to the initiation of the secondrun.sh (lines 72-149) with the firstrun.sh of the Raspian distribution generated by the imager. After that the initial installation ran correctly again and the SSH user is created correctly again. You can then log in with SSH. (3) There are problems with the installation, if you use another user name e.g. the user pi instead of beep. Then some application files will be copied into the directory /home/beep instead to the user directory /home/pi. Solution: Don't use your own user, use the predefined user "beep" (4) The service expects the application files in the directory /home/beep/SystaRESTserver, but copies the directories bin, lib,... and some files into the user home directory. Solution: Just copy the whole directory /boot/SystaRESTserver into the directory /home/beep/SystaRESTserver, then the server can be started without problems.

beep-projects commented 2 years ago

@fhroland thanks for doing the debugging work! I will use it and update the project files

beep-projects commented 2 years ago

Hey @fhroland, I have updated some files. The errors that I have found were in the handling of changing username and hostname and I think all other problems that you experienced were side effects of these, or of your tries to fix it.

I also update the scripts to use the latest Raspberry Pi OS and Zulu JDK.

To test it with a Raspberry Pi 4, I've configured everything with the following commands on bash:

git clone https://github.com/beep-projects/SystaPi
cd SystaPi
HOSTNAME=testpi && sed -i "s/^HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" SystaPi_files/firstrun.sh
USERNAME=tester && sed -i "s/^USERNAME=.*/USERNAME=${USERNAME}/" SystaPi_files/firstrun.sh
mkpasswd test --method=SHA-256 -S beepprojects | (read PASSWORD && PASSWORD=$(printf '%s\n' "$PASSWORD" | sed 's/[[\.*^$/]/\\&/g') && sed -i "s/^PASSWD=.*/PASSWD='${PASSWORD}'/" SystaPi_files/firstrun.sh)
SSID=MY_SSID && sed -i "s/^SSID=.*/SSID=${SSID}/" SystaPi_files/firstrun.sh
SSID=MY_SSID && wpa_passphrase $SSID | grep "\spsk" | cut -d '=' -f 2 | (read PASSWORD && PASSWORD=$(printf '%s\n' "$PASSWORD" | sed 's/[[\.*^$/]/\\&/g') && sed -i "s/^WPA_PASSPHRASE=.*/WPA_PASSPHRASE=${PASSWORD}/" SystaPi_files/firstrun.sh)
ENABLE_ENC28J60=false && sed -i "s/^ENABLE_ENC28J60=.*/ENABLE_ENC28J60=${ENABLE_ENC28J60}/" SystaPi_files/firstrun.sh
IP_PREFIX="192.168.11" && sed -i "s/^IP_PREFIX=.*/IP_PREFIX=\"${IP_PREFIX}\"/" SystaPi_files/firstrun.sh

USE_LATEST_RASPI_OS=true && sed -i "s/^USE_LATEST_RASPI_OS=.*/USE_LATEST_RASPI_OS=${USE_LATEST_RASPI_OS}/" ./install_systapi.sh

./install_systapi.sh

With that, user is tester, password is test and the name of the pi is testpi. To reproduce it, do not forget to replace MY_SSID with the SSID of your network in the two occurences. Can you give it a try if it now also works for you?