I installed it from here with minor changes.
https://www.zigbee2mqtt.io/guide/installation/01_linux.html
When I give him this:
cd /opt/zigbee2mqtt
npm start
everything works.
If I try to service it, it starts restarting every two minutes or so.
This is what it looks like after launch:
If I do it as a service it gives me this:
My zigbee2mqtt.service file is like this:
:[Unit]
Description=zigbee2mqtt
After=network.target
[Service]
Environment=NODE_ENV=production
Type=notify
ExecStart=/usr/local/bin/node index.js
WorkingDirectory=/opt/zigbee2mqtt
StandardOutput=null
#StandardOutput=inherit
# Or use StandardOutput=null if you don't want Zigbee2MQTT messages filling syslog, for more options see systemd.exec(5)
StandardError=inherit
WatchdogSec=10s
Restart=always
RestartSec=10s
User=root
[Install]
WantedBy=multi-user.target
@MichaIng Please help me.
Did you checked service log? Usually this should give some information on the restart.
I’m not that good at it, how do I do it?
Joulinar:
service log
Dec 25 22:55:24 DietPi systemd[1]: zigbee2mqtt.service: Failed with result 'timeout'.
Dec 25 22:55:24 DietPi systemd[1]: Failed to start zigbee2mqtt.service - zigbee2mqtt.
Dec 25 22:55:24 DietPi systemd[1]: zigbee2mqtt.service: Consumed 8.488s CPU time.
Dec 25 22:55:27 DietPi dropbear[3518]: [3518] Dec 25 22:55:27 Exit before auth from <218.92.0.222:37560>: Timeout before auth
Dec 25 22:55:34 DietPi systemd[1]: zigbee2mqtt.service: Scheduled restart job, restart counter is at 64.
Dec 25 22:55:34 DietPi systemd[1]: Stopped zigbee2mqtt.service - zigbee2mqtt.
Dec 25 22:55:34 DietPi systemd[1]: zigbee2mqtt.service: Consumed 8.488s CPU time.
Dec 25 22:55:34 DietPi systemd[1]: Starting zigbee2mqtt.service - zigbee2mqtt...
Dec 25 22:55:34 DietPi node[3626]: Starting Zigbee2MQTT without watchdog.
Dec 25 22:55:38 DietPi node[3626]: [2024-12-25 22:55:38] info: z2m: Logging to console, file (filename: log.log)
Dec 25 22:55:38 DietPi node[3626]: [2024-12-25 22:55:38] info: z2m: Starting Zigbee2MQTT version 1.42.0 (commit #bc6eccf)
Dec 25 22:55:38 DietPi node[3626]: [2024-12-25 22:55:38] info: z2m: Starting zigbee-herdsman (2.1.9)
Dec 25 22:55:39 DietPi node[3626]: [2024-12-25 22:55:39] info: zh:zstack:znp: Opening SerialPort with {"path":"/dev/ttyACM0","baudRate":115200,"rtscts":false,"autoOpen":false}
Dec 25 22:55:39 DietPi node[3626]: [2024-12-25 22:55:39] info: zh:zstack:znp: Serialport opened
Dec 25 22:55:39 DietPi node[3626]: [2024-12-25 22:55:39] info: z2m: zigbee-herdsman started (resumed)
Dec 25 22:55:39 DietPi node[3626]: [2024-12-25 22:55:39] info: z2m: Coordinator firmware version: '{"meta":{"maintrel":3,"majorrel":2,"minorrel":6,"product":0,"revision":20180507,"transportrev":2},"type":"zStack12"}'
Dec 25 22:55:39 DietPi node[3626]: [2024-12-25 22:55:39] info: z2m: knob (0xa4c13820ccb1f7c8): ZG-101ZL - Loginovo Smart button (EndDevice)
Dec 25 22:55:39 DietPi node[3626]: [2024-12-25 22:55:39] info: z2m: Currently 1 devices are joined.
Dec 25 22:55:39 DietPi node[3626]: [2024-12-25 22:55:39] info: z2m: Zigbee: disabling joining new devices.
Dec 25 22:55:39 DietPi node[3626]: [2024-12-25 22:55:39] info: z2m: Connecting to MQTT server at mqtt://localhost
Dec 25 22:55:39 DietPi mosquitto[450]: 1735160139: New connection from ::1:55602 on port 1883.
Dec 25 22:55:39 DietPi mosquitto[450]: 1735160139: New client connected from ::1:55602 as mqttjs_5bc6e96f (p2, c1, k60).
Dec 25 22:55:39 DietPi node[3626]: [2024-12-25 22:55:39] info: z2m: Connected to MQTT server
Dec 25 22:55:39 DietPi node[3626]: [2024-12-25 22:55:39] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"online"}'
Dec 25 22:55:39 DietPi node-red[451]: 25 Dec 22:55:39 - [warn] [zigbee2mqtt-server:5481ef573df09640] Bridge online
Dec 25 22:55:40 DietPi node[3626]: [2024-12-25 22:55:40] info: z2m: Started frontend on port 8080
Dec 25 22:55:40 DietPi node[3626]: [2024-12-25 22:55:40] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/knob', payload '{"battery":100,"operation_mode":"event","voltage":2800}'
Dec 25 22:55:40 DietPi node[3626]: [2024-12-25 22:55:40] info: z2m: Zigbee2MQTT started!
root@DietPi:~#
What is the name of the systemd service you created?
/etc/systemd/system/zigbee2mqtt.service
here is the guide:
I also raised the topic in the Node red forum.
https://discourse.nodered.org/t/zigbee2mqtt-restarts-continuously/94164
You can do following to get whole service log
journalctl -u zigbee2mqtt.service
root@DietPi:~# journalctl -u zigbee2mqtt.service
Dec 26 00:04:42 DietPi systemd[1]: Starting zigbee2mqtt.service - zigbee2mqtt...
Dec 26 00:04:44 DietPi node[452]: Starting Zigbee2MQTT without watchdog.
Dec 26 00:04:50 DietPi node[452]: [2024-12-26 00:04:50] info: z2m: Logging to console, file (filename: log.log)
Dec 26 00:04:51 DietPi node[452]: [2024-12-26 00:04:51] info: z2m: Starting Zigbee2MQTT version 1.42.0 (commit #bc6eccf)
Dec 26 00:04:51 DietPi node[452]: [2024-12-26 00:04:51] info: z2m: Starting zigbee-herdsman (2.1.9)
Dec 26 00:04:51 DietPi node[452]: [2024-12-26 00:04:51] info: zh:zstack:znp: Opening SerialPort with {"path":"/dev/ttyACM0","baudRate":115200,"rtscts":false,"autoOpen":false}
Dec 26 00:04:52 DietPi node[452]: [2024-12-26 00:04:52] info: zh:zstack:znp: Serialport opened
Dec 26 00:04:52 DietPi node[452]: [2024-12-26 00:04:52] info: zh:zstack:znp: Writing CC2530/CC2531 skip bootloader payload
Dec 26 00:04:53 DietPi node[452]: [2024-12-26 00:04:53] info: zh:zstack:znp: Skip bootloader for CC2652/CC1352
Dec 26 00:04:53 DietPi node[452]: [2024-12-26 00:04:53] error: z2m: Error while starting zigbee-herdsman
Dec 26 00:04:53 DietPi node[452]: [2024-12-26 00:04:53] error: z2m: Failed to start zigbee
Dec 26 00:04:53 DietPi node[452]: [2024-12-26 00:04:53] error: z2m: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Dec 26 00:04:53 DietPi node[452]: [2024-12-26 00:04:53] error: z2m: Exiting...
Dec 26 00:04:53 DietPi node[452]: [2024-12-26 00:04:53] error: z2m: Error: Error: Broken pipe, cannot set
Dec 26 00:04:53 DietPi systemd[1]: zigbee2mqtt.service: Main process exited, code=exited, status=1/FAILURE
Dec 26 00:04:53 DietPi systemd[1]: zigbee2mqtt.service: Failed with result 'exit-code'.
Dec 26 00:04:53 DietPi systemd[1]: Failed to start zigbee2mqtt.service - zigbee2mqtt.
Dec 26 00:04:53 DietPi systemd[1]: zigbee2mqtt.service: Consumed 7.897s CPU time.
Dec 26 00:05:04 DietPi systemd[1]: zigbee2mqtt.service: Scheduled restart job, restart counter is at 1.
Dec 26 00:05:04 DietPi systemd[1]: Stopped zigbee2mqtt.service - zigbee2mqtt.
Dec 26 00:05:04 DietPi systemd[1]: zigbee2mqtt.service: Consumed 7.897s CPU time.
Dec 26 00:05:04 DietPi systemd[1]: Starting zigbee2mqtt.service - zigbee2mqtt...
Dec 26 00:05:04 DietPi node[564]: Starting Zigbee2MQTT without watchdog.
Dec 26 00:05:08 DietPi node[564]: [2024-12-26 00:05:08] info: z2m: Logging to console, file (filename: log.log)
Dec 26 00:05:08 DietPi node[564]: [2024-12-26 00:05:08] info: z2m: Starting Zigbee2MQTT version 1.42.0 (commit #bc6eccf)
Dec 26 00:05:08 DietPi node[564]: [2024-12-26 00:05:08] info: z2m: Starting zigbee-herdsman (2.1.9)
Dec 26 00:05:09 DietPi node[564]: [2024-12-26 00:05:09] info: zh:zstack:znp: Opening SerialPort with {"path":"/dev/ttyACM0","baudRate":115200,"rtscts":false,"autoOpen":false}
Dec 26 00:05:09 DietPi node[564]: [2024-12-26 00:05:09] info: zh:zstack:znp: Serialport opened
Dec 26 00:05:10 DietPi node[564]: [2024-12-26 00:05:10] info: z2m: zigbee-herdsman started (resumed)
Dec 26 00:05:10 DietPi node[564]: [2024-12-26 00:05:10] info: z2m: Coordinator firmware version: '{"meta":{"maintrel":3,"majorrel":2,"minorrel":6,"product":0,"revision":20180507,"transportrev":2},"type":"zStack12"}'
Dec 26 00:05:10 DietPi node[564]: [2024-12-26 00:05:10] info: z2m: knob (0xa4c13820ccb1f7c8): ZG-101ZL - Loginovo Smart button (EndDevice)
Dec 26 00:05:10 DietPi node[564]: [2024-12-26 00:05:10] info: z2m: Currently 1 devices are joined.
Dec 26 00:05:10 DietPi node[564]: [2024-12-26 00:05:10] info: z2m: Zigbee: disabling joining new devices.
Dec 26 00:05:10 DietPi node[564]: [2024-12-26 00:05:10] info: z2m: Connecting to MQTT server at mqtt://localhost
Dec 26 00:05:10 DietPi node[564]: [2024-12-26 00:05:10] info: z2m: Connected to MQTT server
Dec 26 00:05:10 DietPi node[564]: [2024-12-26 00:05:10] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"online"}'
Dec 26 00:05:10 DietPi node[564]: [2024-12-26 00:05:10] info: z2m: Started frontend on port 8080
Dec 26 00:05:10 DietPi node[564]: [2024-12-26 00:05:10] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/knob', payload '{"battery":100,"operation_mode":"event","voltage":2800}'
Dec 26 00:05:10 DietPi node[564]: [2024-12-26 00:05:10] info: z2m: Zigbee2MQTT started!
root@DietPi:~#
Some components don’t seem to start properly at first, but look good on the second attempt. Probably better to stay with the guys on the node forum as they might have more experience on this.