Closed lhusoey closed 2 years ago
made it work by editing service.py file
file now only contain this
set -e SCRIPT_DIR=$( cd "$( dirname "$0" )" >/dev/null 2>&1 && pwd ) cd "$SCRIPT_DIR" python3 ./gateway.py "$@"
Looks like there was some error in venv instructions, it should work now better.
[] I've read the Troubleshooting Wiki, my problem is not described there and I am already using the specified minimum bluez version.
Describe the bug Gateway not starting as service under systemctl.
(venv) pi@raspberrypi:~/bt-mqtt-gateway $ sudo systemctl status bt-mqtt-gateway ● bt-mqtt-gateway.service - Bluetooth MQTT gateway Loaded: loaded (/etc/systemd/system/bt-mqtt-gateway.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sun 2022-03-06 09:09:15 GMT; 11s ago Docs: https://github.com/zewelor/bt-mqtt-gateway Process: 7496 ExecStart=/home/pi/bt-mqtt-gateway/service.sh (code=exited, status=1/FAILURE) Main PID: 7496 (code=exited, status=1/FAILURE) CPU: 288ms
Mar 06 09:09:14 raspberrypi systemd[1]: bt-mqtt-gateway.service: Scheduled restart job, restart counter is at 4. Mar 06 09:09:14 raspberrypi systemd[1]: Stopped Bluetooth MQTT gateway. Mar 06 09:09:14 raspberrypi systemd[1]: Started Bluetooth MQTT gateway. Mar 06 09:09:14 raspberrypi systemd[1]: bt-mqtt-gateway.service: Main process exited, code=exited, status=1/FAILURE Mar 06 09:09:14 raspberrypi systemd[1]: bt-mqtt-gateway.service: Failed with result 'exit-code'. Mar 06 09:09:15 raspberrypi systemd[1]: bt-mqtt-gateway.service: Scheduled restart job, restart counter is at 5. Mar 06 09:09:15 raspberrypi systemd[1]: Stopped Bluetooth MQTT gateway. Mar 06 09:09:15 raspberrypi systemd[1]: bt-mqtt-gateway.service: Start request repeated too quickly. Mar 06 09:09:15 raspberrypi systemd[1]: bt-mqtt-gateway.service: Failed with result 'exit-code'. Mar 06 09:09:15 raspberrypi systemd[1]: Failed to start Bluetooth MQTT gateway.
To Reproduce Steps to reproduce the behavior:
sudo systemctl start bt-mqtt-gateway
sudo systemctl status bt-mqtt-gateway, and error is showing as posted over.,
Running command journalctl -xef -u bt-mqtt-gateway an following error is reported. Mar 06 08:47:47 raspberrypi systemd[1]: Started Bluetooth MQTT gateway. ░░ Subject: A start job for unit bt-mqtt-gateway.service has finished successfully ░░ Defined-By: systemd ░░ Support: https://www.debian.org/support ░░ ░░ A start job for unit bt-mqtt-gateway.service has finished successfully. ░░ ░░ The job identifier is 1494. Mar 06 08:47:48 raspberrypi service.sh[950]: Traceback (most recent call last): Mar 06 08:47:48 raspberrypi service.sh[950]: File "/home/pi/bt-mqtt-gateway/./gateway.py", line 11, in
Mar 06 08:47:48 raspberrypi service.sh[950]: import logger
Mar 06 08:47:48 raspberrypi service.sh[950]: File "/home/pi/bt-mqtt-gateway/logger.py", line 3, in
Mar 06 08:47:48 raspberrypi service.sh[950]: import yaml
Mar 06 08:47:48 raspberrypi service.sh[950]: ModuleNotFoundError: No module named 'yaml'
Mar 06 08:47:48 raspberrypi systemd[1]: bt-mqtt-gateway.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ An ExecStart= process belonging to unit bt-mqtt-gateway.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
When running gateway with ./gateway.py it is working as it should.
Im guessing it has something to do with "no module named "yaml" " but i dont understad how to resolv this problem.
best regards lhusoey