Zigbee2mqtt: Error while starting zigbee-herdsman

Created on 10 Feb 2020  路  11Comments  路  Source: Koenkk/zigbee2mqtt

Bug Report

Hi mr @koenkk,

Every raspberry startup zigbe2mqtt process don't startup, zigbe2mqtt process need three attempts fort startup, in the third attemp starts correctly. after raspberry reboot again the same problem appears I paste the info from logs:

zigbe2mqtt log:

> info  2020-02-10 14:54:31: Logging to console and directory: '/opt/zigbee2mqtt/data/log/2020-02-10.14-54-31' filename: log.txt
> info  2020-02-10 14:54:31: Starting zigbee2mqtt version 1.10.0-dev (commit #13b996e)
> info  2020-02-10 14:54:31: Starting zigbee-herdsman...
> error 2020-02-10 14:55:21: Error while starting zigbee-herdsman
> 
> feb 10 14:53:27 raspberrypi npm[451]: zigbee2mqtt:info  2020-02-10 14:53:27: Starting zigbee2mqtt version 1.10.0-dev (commit #13b996e)
> feb 10 14:53:27 raspberrypi npm[451]: zigbee2mqtt:info  2020-02-10 14:53:27: Starting zigbee-herdsman...
> feb 10 14:54:29 raspberrypi npm[451]: zigbee2mqtt:error 2020-02-10 14:54:29: Error while starting zigbee-herdsman
> feb 10 14:54:29 raspberrypi npm[451]: zigbee2mqtt:error 2020-02-10 14:54:29: Failed to start zigbee
> feb 10 14:54:29 raspberrypi npm[451]: zigbee2mqtt:error 2020-02-10 14:54:29: Exiting...
> feb 10 14:54:29 raspberrypi npm[451]: zigbee2mqtt:error 2020-02-10 14:54:29: Error: AREQ - SYS - resetInd after 30000ms
> feb 10 14:54:29 raspberrypi npm[451]:     at Timeout.object.timer.setTimeout [as _onTimeout] (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/utils/waitress.js:44:24)
> feb 10 14:54:29 raspberrypi npm[451]:     at ontimeout (timers.js:436:11)
> feb 10 14:54:29 raspberrypi npm[451]:     at tryOnTimeout (timers.js:300:5)
> feb 10 14:54:29 raspberrypi npm[451]:     at listOnTimeout (timers.js:263:5)
> feb 10 14:54:29 raspberrypi npm[451]:     at Timer.processTimers (timers.js:223:10)
> feb 10 14:54:29 raspberrypi npm[451]: npm ERR! code ELIFECYCLE
> feb 10 14:54:29 raspberrypi npm[451]: npm ERR! errno 1
> feb 10 14:54:29 raspberrypi npm[451]: npm ERR! [email protected] start: `node index.js`
> feb 10 14:54:29 raspberrypi npm[451]: npm ERR! Exit status 1
> feb 10 14:54:29 raspberrypi npm[451]: npm ERR!
> feb 10 14:54:29 raspberrypi npm[451]: npm ERR! Failed at the [email protected] start script.
> feb 10 14:54:29 raspberrypi npm[451]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
> feb 10 14:54:29 raspberrypi npm[451]: npm ERR! A complete log of this run can be found in:
> feb 10 14:54:29 raspberrypi npm[451]: npm ERR!     /home/pi/.npm/_logs/2020-02-10T13_54_29_098Z-debug.log
> feb 10 14:54:29 raspberrypi systemd[1]: zigbee2mqtt.service: Main process exited, code=exited, status=1/FAILURE
> feb 10 14:54:29 raspberrypi systemd[1]: zigbee2mqtt.service: Failed with result 'exit-code'.
> feb 10 14:54:29 raspberrypi systemd[1]: zigbee2mqtt.service: Service RestartSec=100ms expired, scheduling restart.
> feb 10 14:54:29 raspberrypi systemd[1]: zigbee2mqtt.service: Scheduled restart job, restart counter is at 1.
> feb 10 14:54:29 raspberrypi systemd[1]: Stopped zigbee2mqtt.
> feb 10 14:54:29 raspberrypi systemd[1]: Started zigbee2mqtt.
> feb 10 14:54:30 raspberrypi npm[1137]: > [email protected] start /opt/zigbee2mqtt
> feb 10 14:54:30 raspberrypi npm[1137]: > node index.js
> feb 10 14:54:31 raspberrypi npm[1137]: zigbee2mqtt:info  2020-02-10 14:54:31: Logging to console and directory: '/opt/zigbee2mqtt/data/log/2020-02-10.14-54-31' filename: log.txt
> feb 10 14:54:31 raspberrypi npm[1137]: zigbee2mqtt:info  2020-02-10 14:54:31: Starting zigbee2mqtt version 1.10.0-dev (commit #13b996e)
> feb 10 14:54:31 raspberrypi npm[1137]: zigbee2mqtt:info  2020-02-10 14:54:31: Starting zigbee-herdsman...
> feb 10 14:55:21 raspberrypi npm[1137]: zigbee2mqtt:error 2020-02-10 14:55:21: Error while starting zigbee-herdsman
> feb 10 14:55:21 raspberrypi npm[1137]: zigbee2mqtt:error 2020-02-10 14:55:21: Failed to start zigbee
> feb 10 14:55:21 raspberrypi npm[1137]: zigbee2mqtt:error 2020-02-10 14:55:21: Exiting...
> feb 10 14:55:21 raspberrypi npm[1137]: zigbee2mqtt:error 2020-02-10 14:55:21: Error: AREQ - SYS - resetInd after 30000ms
> feb 10 14:55:21 raspberrypi npm[1137]:     at Timeout.object.timer.setTimeout [as _onTimeout] (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/utils/waitress.js:44:24)
> 


Log from .npm, folder

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/opt/zigbee2mqtt/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle [email protected]~start: CWD: /opt/zigbee2mqtt
10 silly lifecycle [email protected]~start: Args: [ '-c', 'node index.js' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `node index.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /opt/zigbee2mqtt
16 verbose Linux 4.19.97-v7l+
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v10.19.0
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `node index.js`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Log from opt-->zigbe-->data

i```
nfo 2020-02-10 14:54:31: Logging to console and directory: '/opt/zigbee2mqtt/data/log/2020-02-10.14-54-31' filename: log.txt
info 2020-02-10 14:54:31: Starting zigbee2mqtt version 1.10.0-dev (commit #13b996e)
info 2020-02-10 14:54:31: Starting zigbee-herdsman...
error 2020-02-10 14:55:21: Error while starting zigbee-herdsman

```

How i can solve this problem? thanks in advanced- best regards

What happened

After reboot raspberry Zigbee2mqtt service doesn't startup in the first attempt

What did you expect to happen

Should be start in the firtst attempt after raspberry reset

How to reproduce it (minimal and precise)

Make a reset to the raspberrypi

Debug Info

zigbee2mqtt version: version 1.10.0 Lastet dev brach
CC2531 firmware version: 20190608.zip

Most helpful comment

Got the same issue, only mine doesn't start at all. Happend after upgrading to 1.10.0

All 11 comments

Got the same issue, only mine doesn't start at all. Happend after upgrading to 1.10.0

Same here, also running zigbee2mqtt version: version 1.10.0 and happens at random times when it is running, need to stop zigbee2mqtt and unplug the usb and plug in it and start zigbee2mqtt to get it to work again.

Already tried the stuff in the FAQ?

Duplicate of #2899

Hi @Koenkk ,

I apologize for reopening a repeated issue, I was looking before opening it but I didn't find it. You were right, with the tests I was doing I put the zigbe2mqtt dongle in another usb port. Thank you very much for all the support you are giving to everyone with problems that are coming out, it is very kind. Best regards

For anyone coming here with this issue when running the IOTstack zigbee2mqtt docker image, change the docker-compose.yml to use a different port. By default the port mapping is - /dev/ttyAMA0:/dev/ttyACM0 but changing it to - /dev/ttyACM0:/dev/ttyACM0 solved this issue for me.

as described here

https://github.com/gcgarner/IOTstack/wiki/Zigbee2MQTT

Hi,

Sorry to react on a repeated issue, but I tried everything discussed before.
Keep getting error with starting zigbee-herdsman.

Started with a CC2531 USB stick and initially all ok. After updating zigbee2mqtt the issue started with the zigbee-herdman not starting up.

Since I also had an issue with the limited number of devices and the range of the CC2531 USB stick, I bought a Texas Instruments CC26X2R1. Also in the hope this would solve the issue with the zigbee-herdsman.

At first connection the new adapter worked, but after trying to connect the third device (xiaomi plug) it stopped working.

Trying to restart the zigbee2mqtt gave again the error with the zigbee-herdsman.

This is what I get when trying to start:

pi@DOMOTICZ:/opt/zigbee2mqtt $ DEBUG=zigbee-herdsman* npm start

[email protected] start /opt/zigbee2mqtt
node index.js

zigbee2mqtt:info 2020-04-08 00:49:32: Logging to console and directory: '/opt/zigbee2mqtt/data/log/2020-04-08.00-49-32' filename: log.txt
zigbee2mqtt:debug 2020-04-08 00:49:32: Loaded state from file /opt/zigbee2mqtt/data/state.json
zigbee2mqtt:info 2020-04-08 00:49:32: Starting zigbee2mqtt version 1.12.0 (commit #840b9d9)
zigbee2mqtt:info 2020-04-08 00:49:32: Starting zigbee-herdsman...
zigbee2mqtt:debug 2020-04-08 00:49:32: Using zigbee-herdsman with settings: '{"network":{"panID":6754,"extendedPanID":[221,221,221,221,221,221,221,221],"channelList":[11],"networkKey":"HIDDEN"},"databasePath":"/opt/zigbee2mqtt/data/database.db","databaseBackupPath":"/opt/zigbee2mqtt/data/database.db.backup","backupPath":"/opt/zigbee2mqtt/data/coordinator_backup.json","serialPort":{"baudRate":115200,"rtscts":true,"path":"/dev/ttyACM0"}}'
zigbee-herdsman:adapter Path '/dev/ttyACM0' is valid for 'ZStackAdapter' +0ms
zigbee-herdsman:controller:log Starting with options '{"network":{"networkKeyDistribute":false,"networkKey":[1,3,5,7,9,11,13,15,0,2,4,6,8,10,12,13],"panID":6754,"extendedPanID":[221,221,221,221,221,221,221,221],"channelList":[11]},"serialPort":{"baudRate":115200,"rtscts":true,"path":"/dev/ttyACM0"},"databasePath":"/opt/zigbee2mqtt/data/database.db","databaseBackupPath":"/opt/zigbee2mqtt/data/database.db.backup","backupPath":"/opt/zigbee2mqtt/data/coordinator_backup.json"}' +0ms
zigbee-herdsman:adapter:zStack:znp:log Opening SerialPort with /dev/ttyACM0 and {"baudRate":115200,"rtscts":true,"autoOpen":false} +0ms
zigbee2mqtt:error 2020-04-08 00:49:32: Error while starting zigbee-herdsman
zigbee2mqtt:error 2020-04-08 00:49:32: Failed to start zigbee
zigbee2mqtt:error 2020-04-08 00:49:32: Exiting...
zigbee2mqtt:error 2020-04-08 00:49:32: Error: Error while opening serialport 'Error: Error Resource temporarily unavailable Cannot lock port'
at Znp. (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:113:32)
at Generator.next ()
at /opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:8:71
at new Promise ()
at __awaiter (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:4:12)
at SerialPort. (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:111:49)
at SerialPort._error (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:198:14)
at /opt/zigbee2mqtt/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:242:12
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-04-07T22_49_32_661Z-debug.log

Really hope that this makes sense and there is support.

Thanks a lot!

Error: Error while opening serialport 'Error: Error Resource temporarily unavailable Cannot lock port' means that a different application on your pc is locking the port. You can find out which with ls -l /proc/[0-9]/fd/ | grep /dev/ttyACM0

Hi Koen,

Thanks for your very quick reply.

I'm running Domoticz on a Pi. I was not able to understand what is blocking the port.

I did find out that the zigbee-herdsman is not working, but when connecting the Pi to wired connection and not wifi, I'm able to add devices.

When connected to only wifi, connecting devices is not an option.

In both connection methods I keep getting the message that zigbee-herdsman is not working as explained above.

Hope this makes some sense to you.

For what it is worth... Changing the port to use by-id symlinks worked for me.
serial:
port: >-
/dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B000BE97D64-if0

the duebug option helped me. i found out that some optional items that I left out are the issue.
I had to add the baudrate and the rtscts to the configuration.yaml after that it started without issue.

baudrate: 115200
rtscts: false

Was this page helpful?
0 / 5 - 0 ratings