Openhab install Raspberry PI 5

Hi,

I got a new raspi 5 8gb I wanted to start migrating to. I initially used the official raspberry tool which all seemed to work well, but first time I connected with putty it looked like this:

###############################################################################
###############  openhabian  ##################################################
###############################################################################
##        Ip = 192.168.0.238
##   Release = Debian GNU/Linux 12 (bookworm)
##    Kernel = Linux 6.6.51+rpt-rpi-2712
##  Platform = BCM43455 37.4MHz Raspberry Pi 3+-0190
##    Uptime = 0 day(s). 00:07:09
## CPU Usage = 8.26% avg over 4 cpu(s) ( core(s) x - socket(s))
##  CPU Load = 1m: 0.48, 5m: 0.51, 15m: 0.28
##    Memory = Free: 5.95GB (76%), Used: 2.00GB (24%), Total: 7.85GB
##      Swap = Free: 2.99GB (100%), Used: 0.00GB (0%), Total: 2.99GB
##      Root = Free: 49.16GB (89%), Used: 5.88GB (11%), Total: 58.01GB
##   Updates = 0 apt updates available.
##  Sessions = 3 session(s)
## Processes = 152 running processes of 4194304 maximum processes
###############################################################################
-bash: /home/openhabian/.bash_profile: line 34: syntax error near unexpected token `fi'
-bash: /home/openhabian/.bash_profile: line 34: `fi'

As it is a completely virgin system I tried reinstalling but without joy, still the same. To eliminate any installation bug I tried again with balena etcher, but no difference.
openhabian-config is accessible, but there are some inconsistent faults, either when updating openhab or when installing like node-red:

 There was an error or interruption during the execution of:                  │
                                     │   "20 | Optional Components"

Anyone an idea what to do?

with regard to

I would suggest have a look to the content of that file.
In case you need help upload it.

With regard to errors running openhabian-config follow the guide at openHABian | openHAB
setting the debugmode will make the output more verbose. Based on the output it should be possible to identify the root cause.

1 Like

Thanks Wolfgang.
Please see it below. I’m a bit puzzled as it is a fresh install on a new device, usually the problems only arise after I started playing around.

openhabian@openhabian:~$ vim /home/openhabian/.bash_profile
# ~/.bash_profile: executed by bash(1) for interactive shells.

source /opt/openhabian/functions/helpers.bash

if [ -f "/opt/openHABian-install-failed" ]; then
  echo -e -n "\\n\e[31;01mAttention! \e[39;49;00m"
  echo "The openHABian setup process seems to have failed on your system."
  echo "Sorry, this shouldn't happen! Please restart the installation process. Chances"
  echo -e "are high setup will succeed on the second try.\\n"
  echo "In order to find the cause of the problem, have a look at the installation log:"
  echo -e "   \e[90;01msudo cat /boot/first-boot.log\e[39;49;00m\\n"
  echo "In order to restart the installation run:"
  echo -e "   \e[90;01msudo rm -f /opt/openHABian*; sudo reboot\e[39;49;00m\\n"
  echo "If the error persists, please read the debug guide at:"
  echo -e "\e[94;04mhttps://github.com/openhab/openhabian/blob/master/docs/openhabian-DEBUG.md\e[39;49;00m\\n"
  return 0
elif [ -f "/opt/openHABian-install-inprogress" ]; then
  echo -e -n "\\n\e[36;01mAttention! \e[39;49;00m"
  echo "The openHABian setup process has not finished yet."
  if [ -f /boot/first-boot.log ]; then watch cat /boot/first-boot.log; echo -e "\\nProgress log:\\n"; cat /boot/first-boot.log; echo; fi
  echo -e "\\nPlease wait for a few more minutes, all preparation steps will be finished shortly."
  return 0
fi

if [ ! -f "/usr/bin/raspi-config" ]; then
  alias raspi-config="echo 'raspi-config is not part of openHABian, please use openhabian-config instead.'"
fi

echo
if [ -f ~/.firemotd-cache ]; then
     cat ~/.firemotd-cache
 fi
 (FireMotD --theme Gray > ~/.firemotd-cache &) &>/dev/null      # does not use cache; might get removed in the near future
fi
OHPKG="openhab"

OHVERSION="$(sed -n 's/openhab-distro\s*: //p' /var/lib/${OHPKG}/etc/version.properties)"
-- VISUAL --                                                                                                             44        1,1           Top

/edit

 fi
 (FireMotD --theme Gray > ~/.firemotd-cache &) &>/dev/null      # does not use cache; might get removed in the near future
fi

Should it look like this, having ‘fi’ twice?

Linux openhabian 6.6.51+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024                                                                                -10-08) aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Dec 16 16:33:44 2024 from 192.168.0.179

###############################################################################
###############  openhabian  ##################################################
###############################################################################
##        Ip = 192.168.0.238
##   Release = Debian GNU/Linux 12 (bookworm)
##    Kernel = Linux 6.6.51+rpt-rpi-2712
##  Platform = BCM43455 37.4MHz Raspberry Pi 3+-0190
##    Uptime = 0 day(s). 00:52:37
## CPU Usage = 0.71% avg over 4 cpu(s) ( core(s) x - socket(s))
##  CPU Load = 1m: 0.00, 5m: 0.02, 15m: 0.00
##    Memory = Free: 6.85GB (87%), Used: 1.08GB (13%), Total: 7.85GB
##      Swap = Free: 2.99GB (100%), Used: 0.00GB (0%), Total: 2.99GB
##      Root = Free: 20.73GB (77%), Used: 5.93GB (23%), Total: 28.11GB
##   Updates = 40 apt updates available.
##  Sessions = 1 session(s)
## Processes = 137 running processes of 4194304 maximum processes
###############################################################################

                          _   _     _     ____   _
  ___   ___   ___   ___  | | | |   / \   | __ ) (_)  ____   ___
 / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \ | | / _  \ / _ \
| (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )| || (_) || | | |
 \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/ |_| \__|_||_| | |
      |_|                  openHAB 4.3.0 - Release Build

Looking for a place to get started? Check out 'sudo openhabian-config' and the
documentation at https://www.openhab.org/docs/installation/openhabian.html
The openHAB dashboard can be reached at http://openhabian:8080
To interact with openHAB on the command line, execute: 'openhab-cli --help'


Removing the second ‘fi’ looks promising. Was that supposed to be there?
But I still wonder
## Platform = BCM43455 37.4MHz Raspberry Pi 3+-0190
why is that? I would expect to see a rpi5 there?

1 Like

Running Node-RED install for user openhabian at /home/openhabian on debian


This can take 20-30 minutes on the slower Pi versions - please wait.

  Stop Node-RED                       ✔
  Remove old version of Node-RED      ✔
  Node option not specified           :   --node18 or --node20
  Leave existing Node.js              :   v18.19.0   Npm 9.2.0
  Clean npm cache                     -
  Install Node-RED core               ✔   4.0.6
  Move global nodes to local          -
  Leave existing nodes                -
  Install extra Pi nodes              ✔
  Add shortcut commands               ✔
  Update systemd script               ✔


Any errors will be logged to   /var/log/nodered-install.log
All done.
You can now start Node-RED with the command  node-red-start
  or using the icon under   Menu / Programming / Node-RED
Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

Started :  Mon Dec 16 10:47:18 PM CET 2024
Finished:  Mon Dec 16 10:47:47 PM CET 2024

**********************************************************************************
 ### WARNING ###
 DO NOT EXPOSE NODE-RED TO THE OPEN INTERNET WITHOUT SECURING IT FIRST

 Even if your Node-RED doesn't have anything valuable, (automated) attacks will
 happen and could provide a foothold in your local network

 Follow the guide at https://nodered.org/docs/user-guide/runtime/securing-node-red
 to setup security.

 ### ADDITIONAL RECOMMENDATIONS ###
  - You can customise the initial settings by running:

      node-red admin init

  - After running Node-RED for the first time, change the ownership of the settings
    file to 'root' to prevent unauthorised changes:

      sudo chown root:root ~/.node-red/settings.js

**********************************************************************************

sudo: /usr/bin/node-red: command not found
chown: cannot access '/home/openhabian/.node-red/settings.js': No such file or directory
+ echo FAILED
FAILED
+ rm -f /tmp/openhabian.PKpUw
+ return 1
+ RET=1
+ '[' 1 -ne 0 ']'
+ whiptail --msgbox 'There was an error or interruption during the execution of:\n  "20 | Optional Components"\n\nPlease try again. If the error persists, please read /opt/openhabian/docs/openhabian-DEBUG.md or https://github.com/openhab/openhabian/blob/main/docs/openhabian-DEBUG.md how to proceed.' 14 80
+ return 0
+ true
+ show_main_menu
+ local choice
+ local version
+ local javaVersion
+++ get_git_revision
+++ local branch
+++ local commitDate
+++ local shorthash
++++ git -C /opt/openhabian rev-parse --abbrev-ref HEAD
+++ branch=openHAB
++++ git -C /opt/openhabian log --pretty=format:%aI -n 1
+++ commitDate=2024-12-13T12:35:05+01:00
++++ git -C /opt/openhabian log --pretty=format:%h -n 1
+++ shorthash=3419d74
+++ echo '[openHAB]{2024-12-13T12:35:05+01:00}(3419d74)'
++ whiptail --title 'openHABian Configuration Tool — [openHAB]{2024-12-13T12:35:05+01:00}(3419d74)' --menu 'Setup Options' 24 118 16 --cancel-button Exit --ok-button Execute '00 | About openHABian' 'Information about the openHABian project and this tool' '' '' '01 | Select Branch' 'Select the openHABian config tool version ("branch") to run' '02 | Upgrade System' 'Update all installed software packages (incl. openHAB) to their latest version' '03 | Install openHAB' 'Install or upgrade to latest openHAB' '04 | Import config' 'Import an openHAB configuration from file or URL' '' '' '10 | Apply Improvements' 'Apply the latest improvements to the basic openHABian setup ►' '20 | Optional Components' 'Choose from a set of optional software components ►' '30 | System Settings' 'A range of system and hardware related configuration steps ►' '40 | openHAB Related' 'Switch the installed openHAB version or apply tweaks ►' '50 | Backup/Restore' 'Manage backups and restore your system ►'
+ choice=
+ RET=1
+ '[' 1 -eq 1 ']'
+ return 255
+ system_check_default_password
+ is_pi
+ is_pifive
+ [[ '' == \p\i\5 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]17[0-9a-fA-F]$' /proc/cpuinfo
+ return 0
+ return 0
+ local algo
+ local param
+ local defaultPassword
+ local defaultUser
+ local generatedPassword
+ local introText
+ local originalPassword
+ local salt
+ local fields
+ is_pi
+ is_pifive
+ [[ '' == \p\i\5 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]17[0-9a-fA-F]$' /proc/cpuinfo
+ return 0
+ return 0
+ id -u pi
+ is_pi
+ is_pifive
+ [[ '' == \p\i\5 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]17[0-9a-fA-F]$' /proc/cpuinfo
+ return 0
+ return 0
+ defaultUser=openhabian
+ defaultPassword=openhabian
++ grep -w openhabian /etc/shadow
++ cut -d: -f2
+ originalPassword='$6$NazhKeblDNg4gtKd$V.1HxOuASXjE.4nGt3Id3OKFPb66OEyNFJd062Bhz2lTVi1ieu9lH4Cd3BJ07y8LTguzpRmPv8lSUKnf0QCt.1'
++ echo '$6$NazhKeblDNg4gtKd$V.1HxOuASXjE.4nGt3Id3OKFPb66OEyNFJd062Bhz2lTVi1ieu9lH4Cd3BJ07y8LTguzpRmPv8lSUKnf0QCt.1'
++ awk '-F$' '{print NF}'
+ fields=4
+ case $fields in
++ echo '$6$NazhKeblDNg4gtKd$V.1HxOuASXjE.4nGt3Id3OKFPb66OEyNFJd062Bhz2lTVi1ieu9lH4Cd3BJ07y8LTguzpRmPv8lSUKnf0QCt.1'
++ cut '-d$' -f2
+ algo=6
++ echo '$6$NazhKeblDNg4gtKd$V.1HxOuASXjE.4nGt3Id3OKFPb66OEyNFJd062Bhz2lTVi1ieu9lH4Cd3BJ07y8LTguzpRmPv8lSUKnf0QCt.1'
++ cut '-d$' -f3
+ salt=NazhKeblDNg4gtKd
+ export algo defaultPassword salt fields
++ perl -le 'print crypt("$ENV{defaultPassword}","\$$ENV{algo}\$$ENV{salt}\$")'
+ generatedPassword='$6$NazhKeblDNg4gtKd$V.1HxOuASXjE.4nGt3Id3OKFPb66OEyNFJd062Bhz2lTVi1ieu9lH4Cd3BJ07y8LTguzpRmPv8lSUKnf0QCt.1'
+ introText='The default password was detected on your system! That is a serious security concern. Bad guys or malicious programs in your subnet are able to gain root access!\n\nPlease set a strong password by typing the command '\''passwd openhabian'\''!'
++ timestamp
++ printf '%(%F_%T_%Z)T\n' -1
+ echo -n '2024-12-16_22:51:52_CET [openHABian] Checking for default openHABian username:password combination... '
2024-12-16_22:51:52_CET [openHABian] Checking for default openHABian username:password combination... ++ id -u openhabian
+ [[ -n 1000 ]]
+ [[ $6$NazhKeblDNg4gtKd$V.1HxOuASXjE.4nGt3Id3OKFPb66OEyNFJd062Bhz2lTVi1ieu9lH4Cd3BJ07y8LTguzpRmPv8lSUKnf0QCt.1 == \$\6\$\N\a\z\h\K\e\b\l\D\N\g\4\g\t\K\d\$\V\.\1\H\x\O\u\A\S\X\j\E\.\4\n\G\t\3\I\d\3\O\K\F\P\b\6\6\O\E\y\N\F\J\d\0\6\2\B\h\z\2\l\T\V\i\1\i\e\u\9\l\H\4\C\d\3\B\J\0\7\y\8\L\T\g\u\z\p\R\m\P\v\8\l\S\U\K\n\f\0\Q\C\t\.\1 ]]
+ [[ -n 1 ]]
+ whiptail --title 'Default password detected' --msgbox 'The default password was detected on your system! That is a serious security concern. Bad guys or malicious programs in your subnet are able to gain root access!\n\nPlease set a strong password by typing the command '\''passwd openhabian'\''!' 11 80
+ echo FAILED
FAILED
++ timestamp
++ printf '%(%F_%T_%Z)T\n' -1
+ echo -e '2024-12-16_22:51:55_CET [openHABian] We hope you got what you came for! See you again soon ;)'
2024-12-16_22:51:55_CET [openHABian] We hope you got what you came for! See you again soon ;)
+ cd /home/openhabian
openhabian@openhabian:~ $ vim  /var/log/nodered-install.log
up to date in 298ms
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for openhabian:openhab @ /home/openhabian
ln: failed to create symbolic link '/usr/bin/python': File exists
Now add launcher to top bar, add cpu temp example, make sure ping works
adduser: The user `openhabian' is already a member of `gpio'.
Replace old rpi.gpio with lgpio

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
Package 'python3-rpi.gpio' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
python3-pip is already the newest version (23.0.1+dfsg-1+rpt1).
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: rpi-lgpio in /usr/lib/python3/dist-packages (0.6)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Allow binding to low ports : n
Memory  : 10G
Started :  Mon Dec 16 10:51:28 PM CET 2024
Finished:  Mon Dec 16 10:51:45 PM CET 2024
~
~
~
~
~
-- VISUAL --                                                                                                                   50        169,43        Bot

That’s about the node-red error. Which actually seems like there is no, I can start ‘node-red-start’.
Thanks again for pointing me in the right direction

Just to be sure: You used the raspberry imager and selected openhabian in the menu?

openhabian-config is up to date ?
Running openhabian-config you can check for it’s version.
Should be correct to remove the second fi. It looks like that was a leftover of a previous version that used an if else fi statement in a one-liner which checked for openhab2 version earlier.

Yes, either the raspberry imager and rpi5, openhab 64bit
or directly Releases · openhab/openhabian · GitHub the 64bit 1.9.3 with etcher.

openHABian Configuration Tool — [openHAB]{2024-12-13T12:35:05+01:00}(3419d74)                                    │
                      │ openHAB 4.3.0 - Release Build  

Should be correct? System update is usually first thing I do when entering the config

Hey all,

It appears that there was a minor bug in the most recent image that caused this issue. It has been corrected on the main branch and will be pushed to the openHAB branch for all later today.

This wont automatically fix it, but if you use menu option 12 to reinstall the .bash_profile it should be fixed once the change is merged in.

2 Likes