From b740372d888157b9f3105644a39511f2b66eb796 Mon Sep 17 00:00:00 2001 From: Fredrik Wahlberg Date: Sat, 27 Dec 2025 14:14:51 +0100 Subject: [PATCH] Fix systemd service: Add Bluetooth permissions troubleshooting The service needs setcap on the Python binary to access Bluetooth. Added verification steps to troubleshooting section. --- systemd/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/systemd/README.md b/systemd/README.md index f80f01a..e548373 100644 --- a/systemd/README.md +++ b/systemd/README.md @@ -139,7 +139,26 @@ systemctl --user restart sensorpajen ``` ### Troubleshooting +### Permission Denied Errors +If you see `PermissionError: [Errno 1] Operation not permitted` in the logs: + +```bash +# Verify Bluetooth capabilities are set on Python binary +getcap ~/.local/share/virtualenvs/*/bin/python3.* + +# If not set, apply capabilities (adjust path to your venv): +sudo setcap 'cap_net_raw,cap_net_admin+eip' $(readlink -f ~/sensorpajen/.venv/bin/python3) + +# Verify it was set: +getcap $(readlink -f ~/sensorpajen/.venv/bin/python3) +# Should show: cap_net_admin,cap_net_raw+eip + +# Restart the service +systemctl --user restart sensorpajen +``` + +**Important**: Capabilities must be set on the **actual Python binary**, not symlinks. Use `readlink -f` to resolve the real path. #### Service Won't Start ```bash