Zigbee2mqtt installation error with openhabian

  • Platform information:
    • Hardware: Raspi4 2GB / SSD
    • OS: latest version with Openhabian
    • Java Runtime Environment: as installed by openhabian
    • openHAB version:4.1
      After installing MQTT Mosquitto with openhabian option 23 i tried to install zigbee2mqtt with openhabian option 2A.
      The installtion aborts with failure:
mkdir -p /opt/zigbee2mqtt 
+ mkdir -p /opt/zigbee2mqtt
+ return 0
+ cond_redirect chown openhabian /opt/zigbee2mqtt
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ chown openhabian /opt/zigbee2mqtt \033[39;49;00m'

$ chown openhabian /opt/zigbee2mqtt 
+ chown openhabian /opt/zigbee2mqtt
chown: invalid user: openhabian
+ return 1
+ echo 'FAILED (chown /opt/zigbee2mqtt)'
FAILED (chown /opt/zigbee2mqtt)

openhabian is the user from MQTT, but i donā€™t have an user on system level with this name.
Is this an issue with openhabian or what else might be wrong?
here the a longe excerpt from the log:

+ choice2='2A | Zigbee2MQTT'
+ '[' 0 -eq 1 ']'
+ '[' 1 -eq 255 ']'
+ wait_for_apt_to_finish_update
+ local 'spin=-\|/'
+ local i
+ [[ -z 12055 ]]
++ timestamp
++ printf '%(%F_%T_%Z)T\n' -1
+ echo -n '2024-01-18_13:27:06_CET [openHABian] Updating Linux package information... '
2024-01-18_13:27:06_CET [openHABian] Updating Linux package information... + kill -0 12055
+ echo OK
OK
+ case "$choice2" in
+ zigbee2mqtt_setup install
+ local zigbee2mqttBase
+ local 'z2mInstalledText=A configuration for Zigbee2MQTT is already existing.\n\nWould you like to update Zigbee2MQTT to the latest version with this configuration?'
+ local 'introText=A MQTT-server is required for Zigbee2mqtt. If you haven'\''t installed one yet, please select <cancel> and come back after installing one (e.g. Mosquitto).\n\nZigbee2MQTT will be installed from the official repository.\n\nDuration is about 4 minutes... '
+ local 'installText=Zigbee2MQTT is installed from the official repository.\n\nPlease wait about 4 minutes... '
+ local 'uninstallText=Zigbee2MQTT is completely removed from the system.'
+ local 'adapterText=Please select your zigbee adapter:'
+ local 'mqttUserText=\nPlease enter your MQTT-User (default = openhabian):'
+ local 'mqttPWText=\nIf your MQTT-server requires a password, please enter it here:'
+ local my_adapters
+ local by_path_or_id
+ local mqttDefaultUser=openhabian
+ local mqttUser
+ local serverIP
+ local installSuccessText
+ local updateSuccessText
+ local loopSel=1
++ hostname -I
+ serverIP='xxxxxxxxxxxxxxx '
+ serverIP='xxxxxxxxxxxxxxx'
+ installSuccessText='Setup was successful. Zigbee2MQTT is now up and running.\n\nFor further Zigbee-settings open frontend (in 2 minutes): \nhttp://192.168.179.3 fd00::1:3c1e:97fa:84b7:8aea:8081.\n\nDocumentation of ZigBee2MQTT:\nhttps://www.zigbee2mqtt.io/guide/configuration'
+ updateSuccessText='Update successful. \n\nFor further Zigbee-settings open frontend (in 2 minutes): \nhttp://192.168.179.3 fd00::1:3c1e:97fa:84b7:8aea:8081.\n\nDocumentation of Zigbee2MQTT:\nhttps://www.zigbee2mqtt.io/guide/configuration'
+ [[ install == \r\e\m\o\v\e ]]
+ [[ install != \i\n\s\t\a\l\l ]]
+ [[ -e /opt/zigbee2mqtt/data/configuration.yaml ]]
+ IFS=
+ read -r line
++ ls /dev/serial/by-id
+ my_adapters=' usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230829110956-if00 1 '
+ by_path_or_id=by-id
+ loopSel=0
+ IFS=
+ read -r line
+ [[  usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230829110956-if00 1  == '' ]]
+ unset IFS
+ [[ -n 1 ]]
+ whiptail --title 'Zigbee2MQTT installation' --yes-button Continue --no-button Cancel --yesno 'A MQTT-server is required for Zigbee2mqtt. If you haven'\''t installed one yet, please select <cancel> and come back after installing one (e.g. Mosquitto).\n\nZigbee2MQTT will be installed from the official repository.\n\nDuration is about 4 minutes... ' 14 80
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Zigbee2MQTT installation                                                                                 A MQTT-server is required for Zigbee2mqtt. If you haven't installed one yet,   please select <cancel> and come back after installing one (e.g. Mosquitto).                                                                                   Zigbee2MQTT will be installed from the official repository.                                                                                                   Duration is about 4 minutes...                                                                                                                                                                                                                                                                                                                  <Continue>                   <Cancel>                                                                                                                                                                                     

++ whiptail --noitem --title 'Zigbee2MQTT installation' --radiolist 'Please select your zigbee adapter:' 14 100 4 usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230829110956-if00 1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Zigbee2MQTT installation  Please select your zigbee adapter:                                                                                                                                                                       (*) usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230829110956-if00                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         <Ok>                               <Cancel>                                                                                                                                                                                                                                     *<Ok>

+ selectedAdapter=usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230829110956-if00
++ whiptail --title 'MQTT User' --inputbox '\nPlease enter your MQTT-User (default = openhabian):' 10 80 openhabian
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       MQTT User                                                                                 Please enter your MQTT-User (default = openhabian):                                                                                                           openhabian__________________________________________________________________                                                                                                                                                                                     <Ok>                         <Cancel>                                                                                                                                                                                     <Ok>

+ mqttUser=openhabian
++ whiptail --title 'MQTT password' --passwordbox '\nIf your MQTT-server requires a password, please enter it here:' 10 80
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            MQTT password                                                                                 If your MQTT-server requires a password, please enter it here:                                                                                                ____________________________________________________________________________                                                                                                                                                                                     <Ok>                         <Cancel>                                                                                                                                                                                     ********<Ok>

+ mqttPW='xxxxxxxxxxxx'
+ whiptail --title 'Zigbee2MQTT installation' --infobox 'Zigbee2MQTT is installed from the official repository.\n\nPlease wait about 4 minutes... ' 14 80
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Zigbee2MQTT installation                                                                                 Zigbee2MQTT is installed from the official repository.                                                                                                        Please wait about 4 minutes...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

+ cond_redirect nodejs_setup
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ nodejs_setup \033[39;49;00m'

$ nodejs_setup 
+ nodejs_setup
+ node_is_installed
++ command -v npm
+ [[ -x /usr/bin/npm ]]
++ node --version
+ [[ v18.17.1 =~ v1[6-9]* ]]
+ return 0
+ is_armv6l
+ [[ '' == \a\r\m\v\6\l ]]
+ case "$(uname -m)" in
++ uname -m
+ return 1
+ return 0
+ return 0
++ timestamp
++ printf '%(%F_%T_%Z)T\n' -1
+ echo -n '2024-01-18_13:27:47_CET [openHABian] Downloading Zigbee2MQTT... '
2024-01-18_13:27:47_CET [openHABian] Downloading Zigbee2MQTT... ++ npm list
++ head -n 1
+ zigbee2mqttBase=/opt/node_modules/zigbee2mqtt
+ [[ -d /opt/node_modules/zigbee2mqtt ]]
+ cond_redirect zigbee2mqtt_download /opt
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ zigbee2mqtt_download /opt \033[39;49;00m'

$ zigbee2mqtt_download /opt 
+ zigbee2mqtt_download /opt
++ timestamp
++ printf '%(%F_%T_%Z)T\n' -1
+ echo -n '2024-01-18_13:27:49_CET [openHABian] Downloading Zigbee2MQTT... '
2024-01-18_13:27:49_CET [openHABian] Downloading Zigbee2MQTT... + cond_redirect mkdir -p /opt/zigbee2mqtt
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ mkdir -p /opt/zigbee2mqtt \033[39;49;00m'

$ mkdir -p /opt/zigbee2mqtt 
+ mkdir -p /opt/zigbee2mqtt
+ return 0
+ cond_redirect chown openhabian /opt/zigbee2mqtt
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ chown openhabian /opt/zigbee2mqtt \033[39;49;00m'

$ chown openhabian /opt/zigbee2mqtt 
+ chown openhabian /opt/zigbee2mqtt
chown: invalid user: openhabian
+ return 1
+ echo 'FAILED (chown /opt/zigbee2mqtt)'
FAILED (chown /opt/zigbee2mqtt)
+ cond_redirect chgrp openhab /opt/zigbee2mqtt
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ chgrp openhab /opt/zigbee2mqtt \033[39;49;00m'

$ chgrp openhab /opt/zigbee2mqtt 
+ chgrp openhab /opt/zigbee2mqtt
+ return 0
+ cond_redirect sudo -u habianadm git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ sudo -u habianadm git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt \033[39;49;00m'

$ sudo -u habianadm git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt 
+ sudo -u habianadm git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
Cloning into '/opt/zigbee2mqtt'...
/opt/zigbee2mqtt/.git: Permission denied
+ return 1
+ echo 'FAILED (git clone)'
FAILED (git clone)
+ return 1
+ return 1
+ echo 'FAILED (download)'
FAILED (download)
+ return 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
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                There was an error or interruption during the execution of:                      "20 | Optional Components"                                                                                                                                  Please 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.                                                                                                                                                                                                                                                                     <Ok>                                                                                                                                                                                                       

+ return 0
+ true
+ show_main_menu
+ local choice
+ local version
+++ 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=2023-12-31T13:09:51+01:00
++++ git -C /opt/openhabian log --pretty=format:%h -n 1
+++ shorthash=9ac4ddd
+++ echo '[openHAB]{2023-12-31T13:09:51+01:00}(9ac4ddd)'
++ whiptail --title 'openHABian Configuration Tool  [openHAB]{2023-12-31T13:09:51+01:00}(9ac4ddd)' --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 '

It looks like it might be a bug in openHABian. By default it used to used to create the user openhabian as the login user. However, IIRC you can now choose your own login user now. Or if you did a manual install of openHABian instead of burning the SD card image you might have created your own login user.

This script appears to still assume that there will be an openhabian user.

The installation was done by burning a SD card image , but in openhabian.conf i have set a different username. Seems to be a bug in openhabian.
Any idea about a workaround for this issues?

Maybe a related topic is the username for the MQTT Mosquitto. During the installation you get a message that username and password can be choosen, but openhabian as user is given and canā€™t be changed, only the password you can entered as parameter.

I donā€™t use openHABian so canā€™t offer any suggestions beyond manually following the steps of the script, creating such a long user, or modifying the openHABian script to use the login user.

In all cases, file an issue.

yes, my bad. I assumed that openhabian allway exists. Funny that nobody complained before as itā€™s like that for quite some time (apparently everybody kept the default user)
And node-red and frontail seem to have the same problem (wasnā€™t me;)
@mstormi : I think we have to change that in all the install routines.

1 Like

The file to change is /opt/openhabian/functions/nodejs-apps.bash

The lines are 217, 218 and 278-281 where we probably need openhab instead openhabian. But Iā€™m not sure if this works with a user without shell.
Would be great if you could try @ohash .

Thanks for your feedback.
I tried the user openhab in the lines you have listet. But the error was the same. I tired it with the user i have choosen instead of openhabian during the installation. The installation of zigbee2mqtt was successful.
But now i am facing another issue:
the zigbee2mqtt.service does start. The error message is:
zigbee2mqtt.service: Failed to determine user credentials: no such process
zigbee2mqtt.service: Failed at step User spawing /usr/bin/npm: No such process

any idea what might be the issue here?

yes, thereā€™s something else:
we have to change the services template, too. Itā€™s under
/opt/openhabian/includes/zigbee2mqtt/zigbee2mqtt.service

ok done and the service tries to start, but there is another permission issue:
With journalctl i can the the following error-message:
zigbee2mqtt@1.25.1 start
note index.js
Error: EACCES: permission denied, mkdir ā€˜/var/log/zigbee2mqtt/2401-01-18.23-06-19alā€™
at Object.mkdirSync ā€¦

I have removed /var/log/zigbee2mqtt and create new with sudo mkdir ā€¦
but the error is still there.

good point. The permissions of the log-directory have to be fixed, too.
Did you chown the zigbee2mqtt log-directory to your user. You can check what the installer is doing in line 332-336 of nodejs-apps.bash

Thanks, now the service is running. :slightly_smiling_face:
The chown command in row 334 needs my user instead of openhabian.

I assume you or mstormi will implement these change into openhabian. Or should i raise an issue?

Thanks for the great support. :+1:

Who could answer this question raist already above:
Maybe a related topic is the username for the MQTT Mosquitto. During the installation you get a message that username and password can be choosen, but openhabian as user is given and canā€™t be changed, only the password you can entered as parameter.

No. Iā€™m aware of it. Hope I find a little time this weekend.

Yes, thatā€™s mine, too. Iā€™ll have a look at it.

2 Likes

have you had a chance to look into the topic regarding MQTT user or could you provide a hint where in the scripts i could find the commands to do it manually
Thanks in advance

Yes. PR is started.
What I donā€™t understand: Why do you have problems with the default user (openhabian) in mqtt? This has nothing to do with the Linux-user. The only thing to take care is to set a password. Otherwise itā€™s not working.

Thanks for the reply.
The std-User openhabian is not a problem regarding the functionallity. Based on 40+ years experiance in IT i usually donā€˜t use std-Users and std-passwords.
Based on the messages during the installation i was in the expectation to be able to enter a username , but i was only able to enter a password.
At least the messages/questions during the installation process should be consistent.

allright. The mosquitto-installation was not my part, but I changed it.
The PR is running

1 Like

Hi there , I seem to have the same problem(s) as described here. I did the openhabian installation 1 month ago and before running into the details I was wondering if the bugs were fixed?
Thanks

yes, fixed and merged.
But you have to select ā€œlatestā€ under ā€œselect branchā€

Thanks Larsen, I could not change to ā€œlatestā€ under ā€œselect branchā€ but changed the ā€œclonebranchā€ in openhabian.config to ā€œmainā€ . That worked and Zigbee installation worked out fine

Can you tell us why? Any errors? Did you use space-bar to select?
In the end what you did does just the same which is using ā€œmainā€ as clonebranch.