zewelor / bt-mqtt-gateway

A simple Python script which provides a Bluetooth to MQTT gateway, easily extensible via custom workers. See https://github.com/zewelor/bt-mqtt-gateway/wiki for more information.
MIT License
549 stars 116 forks source link

Docker container doesn't start up on RasPi - pyinit_main: can't initialize time #242

Closed lobl closed 2 years ago

lobl commented 2 years ago

[x] 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

Trying to start up the latest docker image from DockerHub gives error messages (see debug log section) and the container keeps restarting.

To Reproduce Steps to reproduce the behavior:

  1. Edit config.yml (see config section)
  2. Edit docker-compose.yml (see config section)
  3. docker-compose up --detach
  4. docker logs bluetooth

Expected behavior Container should start up without error.

Config

config.yml:

mqtt:
  host: 192.168.178.109
  port: 1883
  username:
  password:
  client_id: bt-mqtt-gateway
  availability_topic: #status/bluetooth2mqtt

manager:
  workers:
    lywsd03mmc:
      args:
        devices:
          filament:     a4:c1:38:13:24:f0
        topic_prefix: tele
        passive: true         # Set to true for sensors running custom firmware and advertising type custom. See https://github.com/zewelor/bt-mqtt-gateway/wiki/Devices#lywsd03mmc
        #command_timeout: 30   # Optional timeout for getting data for non-passive readouts
        scan_timeout: 20      # Optional timeout for passive scanning
      update_interval: 30

docker-compose.yml:

version: "3.7"

services:
  bluetooth:
    container_name: bluetooth
    image: zewelor/bt-mqtt-gateway:latest
    environment:
      - DEBUG=true
    volumes:
      - /home/pi/docker/runtime/bluetooth2mqtt/config.yml:/application/config.yaml
    cap_add:
      - NET_ADMIN
      - NET_RAW
    network_mode: host
    restart: unless-stopped

Debug gateway logs

Start in debug mode Fatal Python error: pyinit_main: can't initialize time Python runtime state: core initialized PermissionError: [Errno 1] Operation not permitted

Current thread 0xb6f65390 (most recent call first):

Gateway died... Start in debug mode Fatal Python error: pyinit_main: can't initialize time Python runtime state: core initialized PermissionError: [Errno 1] Operation not permitted Current thread 0xb6f2b390 (most recent call first): Gateway died... ... **Server (please complete the following information):** - OS: Linux - Distro: Raspbian - Version 10 - "Raspbian GNU/Linux 10 (buster)" - Installed packages are on the latest version. bluez is on V. 5.50 **Additional context** The config was running with these settings for half a year now (except for the change to provide the config.yml in /application folder instead of / now).
zewelor commented 2 years ago

From quick googling maybe this https://github.com/linuxserver/docker-papermerge/issues/4#issuecomment-735236388 ?

lobl commented 2 years ago

That solved it! With V2.5.3:

wget http://ftp.us.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.3-2_armhf.deb
sudo dpkg -i libseccomp2_2.5.3-2_armhf.deb

Thanks!