If this is not the right place to post a this question, please say.
I’m running zigbee2mqtt (Zigbee broker) on a USB dongle device (CC2531 with antenna, forgot the antenna model) and a Linux machine (KDE neon User Edition 5.19, based on Ubuntu 18.04). Sometimes zigbee2mqtt stops working and I have to change the ownership of the device (with chown) to successfully run it again. So I put it in one script:
~/my_services/zigbee2mqtt_service $ cat z2m.sh
sudo chown gal /dev/ttyACM0
cd /opt/zigbee2mqtt
npm start
and created a service in systemd to run the script:
~/my_services/zigbee2mqtt_service $ systemctl cat zigbee2mqtt.service
# /etc/systemd/system/zigbee2mqtt.service
[Unit]
Description=zigbee2mqtt
After=network.target
[Service]
# ExecStart=/usr/local/bin/npm start
# WorkingDirectory=/opt/zigbee2mqtt
ExecStart=/home/gal/my_services/zigbee2mqtt_service/z2m.sh
StandardOutput=inherit
StandardError=inherit
Restart=always
User=gal
[Install]
WantedBy=multi-user.target
This used to work, but for some reason, now the service won't start. I’m tried enabling it, starting manually, and to reload daemon. If I run the z2m.sh script manually it works well, but I’m working from a remote machine so I have to disconnect, which stops zigbee2mqtt.
It’d be great if you can point me to what to fix, or to a different way to recover from the ‘revoked ownership’.
Edit: This is what I get when checking the service status:
~ $ systemctl status zigbee2mqtt.service
● zigbee2mqtt.service - zigbee2mqtt
Loaded: loaded (/etc/systemd/system/zigbee2mqtt.service; enabled; vendor pres
Active: failed (Result: exit-code) since Mon 2020-07-20 11:00:57 IDT; 2 days
Process: 4059 ExecStart=/home/gal/my_services/zigbee2mqtt_service/z2m.sh (code
Main PID: 4059 (code=exited, status=203/EXEC)
Jul 20 11:00:57 phoenix systemd[1]: zigbee2mqtt.service: Service hold-off time o
Jul 20 11:00:57 phoenix systemd[1]: zigbee2mqtt.service: Scheduled restart job,
Jul 20 11:00:57 phoenix systemd[1]: Stopped zigbee2mqtt.
Jul 20 11:00:57 phoenix systemd[1]: zigbee2mqtt.service: Start request repeated
Jul 20 11:00:57 phoenix systemd[1]: zigbee2mqtt.service: Failed with result 'exi
Jul 20 11:00:57 phoenix systemd[1]: Failed to start zigbee2mqtt.
lines 1-12/12 (END)