Error while starting zigbee-herdsman Failed to start zigbee

I have it running perfectly with this config:

data_path: /config/zigbee2mqtt
socat:
  enabled: false
  master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
  slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
  options: "-d -d"
  log: false
mqtt: {}
serial:
  port: /dev/ttyUSB0

However, I can’t remember the exact things I changed, so I guess this is as far as I can help.
But if you have a similar setup as me, you can try it out.

Hi guys have issue with configuration of zigbee2mqtt with skyconnect dongle
still getting this message

[19:58:58] INFO: Preparing to start…
[19:58:59] INFO: Socat not enabled
[19:59:00] INFO: Zigbee Herdsman debug logging enabled
[19:59:02] INFO: Starting Zigbee2MQTT…
Zigbee2MQTT:debug 2023-06-18 19:59:08: Loaded state from file /config/zigbee2mqtt/state.json
Zigbee2MQTT:info 2023-06-18 19:59:08: Logging to console and directory: ‘/config/zigbee2mqtt/log/2023-06-18.19-59-08’ filename: log.txt
Zigbee2MQTT:debug 2023-06-18 19:59:08: Removing old log directory ‘/config/zigbee2mqtt/log/2023-06-18.19-47-12’
Zigbee2MQTT:info 2023-06-18 19:59:08: Starting Zigbee2MQTT version 1.31.2 (commit #unknown)
Zigbee2MQTT:info 2023-06-18 19:59:09: Starting zigbee-herdsman (0.14.117)
Zigbee2MQTT:debug 2023-06-18 19:59:09: Using zigbee-herdsman with settings: ‘{“adapter”:{“concurrent”:null,“delay”:null,“disableLED”:false},“backupPath”:"/config/zigbee2mqtt/coordinator_backup.json",“databaseBackupPath”:"/config/zigbee2mqtt/database.db.backup",“databasePath”:"/config/zigbee2mqtt/database.db",“network”:{“channelList”:[11],“extendedPanID”:[221,221,221,221,221,221,221,221],“networkKey”:“HIDDEN”,“panID”:6754},“serialPort”:{“path”:"/dev/ttyUSB0"}}’
2023-06-18T17:59:09.437Z zigbee-herdsman:adapter Failed to validate path: ‘Error: spawn udevadm ENOENT’
2023-06-18T17:59:09.441Z 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”:{“path”:"/dev/ttyUSB0"},“databasePath”:"/config/zigbee2mqtt/database.db",“databaseBackupPath”:"/config/zigbee2mqtt/database.db.backup",“backupPath”:"/config/zigbee2mqtt/coordinator_backup.json",“adapter”:{“disableLED”:false,“concurrent”:null,“delay”:null}}’
2023-06-18T17:59:09.444Z zigbee-herdsman:adapter:zStack:znp:log Opening SerialPort with {“path”:"/dev/ttyUSB0",“baudRate”:115200,“rtscts”:false,“autoOpen”:false}
Zigbee2MQTT:error 2023-06-18 19:59:09: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2023-06-18 19:59:09: Failed to start zigbee
Zigbee2MQTT:error 2023-06-18 19:59:09: Check Zigbee2MQTT fails to start | Zigbee2MQTT for possible solutions
Zigbee2MQTT:error 2023-06-18 19:59:09: Exiting…
Zigbee2MQTT:error 2023-06-18 19:59:09: Error: Error while opening serialport ‘Error: Error Resource temporarily unavailable Cannot lock port’
at SerialPort. (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:146:28)
at SerialPort._error (/app/node_modules/@serialport/stream/dist/index.js:75:22)
at /app/node_modules/@serialport/stream/dist/index.js:111:18

configuration as follows

data_path: /config/zigbee2mqtt
socat:
enabled: false
master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
options: “-d -d”
log: false
mqtt: {}
serial:
port: /dev/ttyUSB0
zigbee_herdsman_debug: true

Just had to set it up with the same problem.
localhost didn’t work, so had to put in device ip (I’m running a RasPi4).
your_user and your_password is for the HA user set up for MQTT.

This made it work:

data_path: /config/zigbee2mqtt
socat:
  enabled: false
  master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
  slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
  options: "-d -d"
  log: false
mqtt:
  server: mqtt://your_ip:1883
  user: your_user
  password: your_password
serial:
  port: >-
    /dev/serial/by-id/usb-Nabu_Casa_SkyConnect_v1.0_0262de24c214ed118c21bc8be054580b-if00-port0
  adapter: ezsp
1 Like

So cool, this fixed it for me!!! THANK YOU!!!

1 Like

Dear all, I have read all the post carefully but still can’t solve my issue.

I can’t maintain my mqtt2zigbee installation up. I always get same error:

Zigbee2MQTT:error 2023-08-19 20:41:52: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2023-08-19 20:41:52: Failed to start zigbee
Zigbee2MQTT:error 2023-08-19 20:41:52: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2023-08-19 20:41:52: Exiting...
Zigbee2MQTT:error 2023-08-19 20:41:52: Error: Error while opening serialport 'Error: Error: No such file or directory, cannot open /dev/ttyUSB0'
    at SerialPort.<anonymous> (/app/node_modules/zigbee-herdsman/src/adapter/deconz/driver/driver.ts:200:28)
    at SerialPort._error (/app/node_modules/@serialport/stream/dist/index.js:75:22)
    at /app/node_modules/@serialport/stream/dist/index.js:111:18

I think the origin of the error could be here:

Error while opening serialport 'Error: Error: No such file or directory, cannot open /dev/ttyUSB0'
    at SerialPort.<anonymous> (/app/node_modules/zigbee-herdsman/src/adapter/deconz/driver/driver.ts:200:28)
    at SerialPort._error (/app/node_modules/@serialport/stream/dist/index.js:75:22)
    at /app/node_modules/@serialport/stream/dist/index.js:111:18

I get that error even after following the steps on this feed and can see properly the ttyUSB0 device when listing under dev$ directory.

Let me tell you that I’m running mosquito-mqtt docker with no issues under Synology NAS and that issue is after installing docker of zigbee2mqtt and try to start up the docker service.

Can someone help me to find the solution to my issue?

From the link in your post:

" Error: Resource temporarily unavailable Cannot lock port

This error occurs when another program is already using (and thus locking) the adapter. You can find out which via the following command: ls -l /proc/[0-9]/fd/ |grep /dev/ttyACM0 (replace /dev/ttyACM0 with your adapter port)."

Have you verified that you do not have something else accessing the port? ZHA for example?

serial:
port: >-
/dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230525094313-if00
adapter: ezsp

worked for me finally

4 Likes

I have been struggling with the problem of inability to start for two weeks. I had over 30 devices configured over Z2M and, perfected the backup and restoration process of Z2M database (the only solution that worked was to delete the configuration files and reinstall Z2M addon). Today I noticed HA while booting said “starting ZHA” :smiley:
I removed ZHA and Z2M started up like nothing happened, so if your Zigbee2MQTT fails to start without reason, check your integrations pane and delete ZHA :sunny:

2 Likes

Here I am - with a similar problem, desperate for any help available.
I’ve installed Z2M but it fails to start something called “zigbee-herdsman” according to the log:

debug 2023-10-31 22:03:55: Can't load state from file /app/data/state.json (doesn't exist)
info  2023-10-31 22:03:55: Logging to console and directory: '/app/data/log/2023-10-31.22-03-55' filename: log.txt
info  2023-10-31 22:03:55: Starting Zigbee2MQTT version 1.33.1 (commit #7e63039)
info  2023-10-31 22:03:55: Starting zigbee-herdsman (0.19.0)
debug 2023-10-31 22:03:55: Using zigbee-herdsman with settings: '{"adapter":{"concurrent":null,"delay":null,"disableLED":false},"backupPath":"/app/data/coordinator_backup.json","databaseBackupPath":"/app/data/database.db.backup","databasePath":"/app/data/database.db","network":{"channelList":[11],"extendedPanID":[221,221,221,221,221,221,221,221],"networkKey":"HIDDEN","panID":6754},"serialPort":{"path":"tcp://192.168.117:8888"}}'
error 2023-10-31 22:06:06: Error while starting zigbee-herdsman
error 2023-10-31 22:06:06: Failed to start zigbee
error 2023-10-31 22:06:06: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
error 2023-10-31 22:06:06: Exiting...
error 2023-10-31 22:06:06: Error: Error while opening socket
    at Socket.<anonymous> (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:198:24)
    at Socket.emit (node:events:526:35)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)

I’ve installed Z2M on a QNAP NAS in a docker container. Here’s my compose yaml:

version: '3'
services:
  zigbee2mqtt:
    image: koenkk/zigbee2mqtt:latest
    restart: "no"
    ports:
      - 9080:8080
    environment:
      TZ: Europe/Oslo
    volumes:
      - /share/Public/Z2M:/app/data
      - /share/Public/Z2M/run/udev:/run/udev:ro
 

My ZigBee device is the Sonoff ZbBridge flashed with Tasmota 13.2.0 and the ncp-uart-nsw_6.7.9_115200 firmware. I’m using Blackadders ZHA Template and the Bridge runs just fine and the WebUI console shows all activities. Here’s my Z2M configuation.yaml file:

homeassistant: true
mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://192.168.1.8:1883
serial:
  port: tcp://192.168.117:8888
frontend: true
advanced:
  log_level: debug
  network_key: GENERATE

My MQTT server is Mosquitto 2.0.4 and it has been running for a long time and works well.
Any help to resolve my issue is much apreciated.

You need

serial:
  port: tcp://192.168.117:8888
  adapter: ezsp

Yes, thank you - and in addition I had a typo in my IP :grinning_face_with_smiling_eyes:

New to Home Assistant here and I am struggling with similar issues, I cannot get Z2M to start no matter what I do.

Here is my log, I am using a Sonoff Dongle-E.

[16:58:48] INFO: Preparing to start...
[16:58:48] INFO: Socat not enabled
[16:58:48] INFO: Zigbee Herdsman debug logging enabled
[16:58:49] INFO: Starting Zigbee2MQTT...
Zigbee2MQTT:debug 2023-11-08 16:58:50: Can't load state from file /config/zigbee2mqtt/state.json (doesn't exist)
Zigbee2MQTT:info  2023-11-08 16:58:50: Logging to console and directory: '/config/zigbee2mqtt/log/2023-11-08.16-58-50' filename: log.txt
Zigbee2MQTT:debug 2023-11-08 16:58:50: Removing old log directory '/config/zigbee2mqtt/log/2023-11-08.16-30-08'
Zigbee2MQTT:info  2023-11-08 16:58:50: Starting Zigbee2MQTT version 1.33.2 (commit #unknown)
Zigbee2MQTT:info  2023-11-08 16:58:50: Starting zigbee-herdsman (0.21.0)
Zigbee2MQTT:debug 2023-11-08 16:58:50: Using zigbee-herdsman with settings: '{"adapter":{"concurrent":null,"delay":null,"disableLED":false},"backupPath":"/config/zigbee2mqtt/coordinator_backup.json","databaseBackupPath":"/config/zigbee2mqtt/database.db.backup","databasePath":"/config/zigbee2mqtt/database.db","network":{"channelList":[11],"extendedPanID":[188,76,123,253,218,55,93,218],"networkKey":"HIDDEN","panID":40568},"serialPort":{"path":"/dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230221110315-if00 adapter: ezsp"}}'
2023-11-08T23:58:50.567Z zigbee-herdsman:adapter:zStack:znp:error Failed to determine if path is valid: 'Error: ENOENT: no such file or directory, lstat '/dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230221110315-if00 adapter: ezsp''
2023-11-08T23:58:50.573Z zigbee-herdsman:adapter Failed to validate path: 'Error: spawn udevadm ENOENT'
2023-11-08T23:58:50.574Z zigbee-herdsman:controller:log Starting with options '{"network":{"networkKeyDistribute":false,"networkKey":[231,19,138,27,52,17,224,148,235,174,112,128,251,25,118,239],"panID":40568,"extendedPanID":[188,76,123,253,218,55,93,218],"channelList":[11]},"serialPort":{"path":"/dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230221110315-if00 adapter: ezsp"},"databasePath":"/config/zigbee2mqtt/database.db","databaseBackupPath":"/config/zigbee2mqtt/database.db.backup","backupPath":"/config/zigbee2mqtt/coordinator_backup.json","adapter":{"disableLED":false,"concurrent":null,"delay":null}}'
2023-11-08T23:58:50.574Z zigbee-herdsman:adapter:zStack:znp:log Opening SerialPort with {"path":"/dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230221110315-if00 adapter: ezsp","baudRate":115200,"rtscts":false,"autoOpen":false}
Zigbee2MQTT:error 2023-11-08 16:58:50: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2023-11-08 16:58:50: Failed to start zigbee
Zigbee2MQTT:error 2023-11-08 16:58:50: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2023-11-08 16:58:50: Exiting...
Zigbee2MQTT:error 2023-11-08 16:58:50: Error: Error while opening serialport 'Error: Error: No such file or directory, cannot open /dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230221110315-if00 adapter: ezsp'
    at SerialPort.<anonymous> (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:146:28)
    at SerialPort._error (/app/node_modules/@serialport/stream/dist/index.js:82:22)
    at /app/node_modules/@serialport/stream/dist/index.js:118:18

Here is my configuration…

data_path: /config/zigbee2mqtt
socat:
  enabled: false
  master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
  slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
  options: "-d -d"
  log: false
mqtt:
  server: mqtt://core-mosquitto:1883
  user: mqtt-user
  password: my password
serial:
  port: >-
    /dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230221110315-if00
    adapter: ezsp
zigbee_herdsman_debug: true

I would very much appreciate any help anyone could provide. :smiley:

indentation`` → adapter needs to be on same level as port

data_path: /config/zigbee2mqtt
socat:
  enabled: false
  master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
  slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
  options: "-d -d"
  log: false
mqtt:
  server: mqtt://core-mosquitto:1883
  user: mqtt-user
  password: my password
serial:
  port: >-
    /dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230221110315-if00
  adapter: ezsp
zigbee_herdsman_debug: true
1 Like

:man_facepalming: Of course it was that simple. You wouldn’t believe how much time I spent trying to figure this out. Thank you!

Thats it charlie brown

Continuing the discussion from Error while starting zigbee-herdsman Failed to start zigbee:

Hi guys.
I’m very new to homeassistant and I face the same problem. Working on this for hours and hours - could not get through. Maybe someone has a good idea.

The failure message:
[15:26:46] INFO: Starting Zigbee2MQTT…
Zigbee2MQTT:info 2023-11-12 15:26:52: Logging to console and directory: ‘/config/zigbee2mqtt/log/2023-11-12.15-26-52’ filename: log.txt
Zigbee2MQTT:info 2023-11-12 15:26:52: Starting Zigbee2MQTT version 1.33.2 (commit #unknown)
Zigbee2MQTT:info 2023-11-12 15:26:52: Starting zigbee-herdsman (0.21.0)
Zigbee2MQTT:error 2023-11-12 15:26:52: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2023-11-12 15:26:52: Failed to start zigbee

Here’s my configuration:
data_path: /config/zigbee2mqtt
socat:
enabled: false
master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
options: “-d -d”
log: false
mqtt:
server: mqtt://core-mosquitto:1883
user: mqtt-user
serial:
adapter: ezsp
Port: >-
/dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230509080021-if00
zigbee_herdsman_debug: true

Best regards from Switzerland
Armin

This is my config for comparison, make sure you set up the config in /zigbee2mqtt/configuration.yaml (not the regular configuration.yaml for HA)

Config in addon-GUI

In configuration.yaml:

devices:
  - devices.yaml
groups:
  - groups.yaml
homeassistant: true
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  user: addons
  password: 
  server: mqtt://core-mosquitto:1883
serial:
  port: tcp://192.168.0.109:6638
  baudrate: 115200
  disable_led: false
advanced:
  transmit_power: 20
  log_level: warn
  pan_id: 6753
  channel: 20

Well, you guys can add me to the list of people who can’t get this z2m to even start. Here’s pics of my current settings, I just read through most all of this post and tried several of the suggestions for it to still not work.

I tried the mattress server at the ip, nothing. I tried the adapter port on the same line, click save and it moves it back to the next. I tried changing the “DECONZ” in the adapter field to lowercase, nothing…
It has done this EXACT SAME THING on 2 systems I’ve tried to setup, a VM on my Unraid, and this VM on a Proxmox. The same conbee2 being used on both systems (migrating from one to the other).

Look at my post over yours. You set your config in the configuration.yaml file under the zigbee2mqtt directory, not in the GUI.

Where/How do I find that, is that the one in the three dots in the top right of the config page, or is that something else too? Sorry, I’m relying on YouTube videos to try and set this up.

Do I have to copy what you have there (changing fir adapter where necessary), or do I just need certain lines?