homebridge / docker-homebridge

Homebridge Docker. HomeKit support for the impatient using Docker on x86_64, Raspberry Pi (armhf) and ARM64. Includes ffmpeg + libfdk-aac.
https://hub.docker.com/r/homebridge/homebridge/
GNU General Public License v3.0
2.57k stars 241 forks source link

HB based Docker container doesn't appear to be correctly interfacing with system AVHI-daemon per documentation #558

Closed taw123 closed 3 weeks ago

taw123 commented 3 months ago

Current Situation

To be concise I am going to leave out some history regarding PRIOR use (5 or so years ago when I did have things working, then later broke in an update and changes to service advertising).....

Compose:

  HomeBridge:
    container_name: HomeBridge
#    hostname: HomeBridge    ?-Potential issue here as net-host should create with same hostname as TRUE host system
    image: homebridge/homebridge:latest  #new container name
    network_mode: host
    restart: unless-stopped
    ports:
      - 8581:8581
    logging:
      driver: json-file
      options:
        max-size: '10m'
        max-file: '1'
    environment:
#      - HOMEBRIDGE_CONFIG_UI=1       # Do I still neeed to play with this? 
      - HOMEBRIDGE_CONFIG_UI_PORT=8581
#      - HOMEBRIDGE_INSECURE=1        # Do I still neeed to play with this? 
      - TZ=America/Los_Angeles
#      - PUID=1005        #Should I still set this (will is break something inside that is actually sharing config with true host?) 
#      - ENABLE_AVAHI=0   # Do I still neeed to play with this? Can we SHARE the QNAP AVHI-deamon properly? Do I need to do something to the name? to match the TRUE Hostname? Do I need to enable IPv6 (ie lateer for Matter) 
    healthcheck:
      test: curl --fail localhost:8581 || exit 1
      interval: 60s
      retries: 5
      start_period: 300s
      timeout: 2s
    security_opt:     # Shouldn't be needed but included for testing/diagnostics/rule out potential issue
      - apparmor:unconfined
    volumes:
      - /share/DockerAppData/HomeBridge-clean:/homebridge    # Start with fresh container before considering migration
      - /etc/localtime:/etc/localtime:ro
      - /var/run/dbus:/var/run/dbus
      - /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket

Per wiki

I am still seeing msgs in the console indicating what I expectted to be that HB calls from it's AVHI implementation being passed to the system daemon are in fact it appears CONFLICTING with the system service.

Successfully dropped root privileges.
avahi-daemon 0.8 starting up.
bind(): Address already in use
avahi-daemon 0.8 exiting.
Starting Avahi daemon
Found user 'avahi' (UID 105) and group 'avahi' (GID 108).
Successfully dropped root privileges.
avahi-daemon 0.8 starting up.
bind(): Address already in use
avahi-daemon 0.8 exiting.
Starting Avahi daemon
Found user 'avahi' (UID 105) and group 'avahi' (GID 108).
Successfully dropped root privileges.
avahi-daemon 0.8 starting up.
bind(): Address already in use
avahi-daemon 0.8 exiting.
Starting Avahi daemon
Found user 'avahi' (UID 105) and group 'avahi' (GID 108).
Successfully dropped root privileges.
avahi-daemon 0.8 starting up.
bind(): Address already in use
avahi-daemon 0.8 exiting.

Clearly I must be missing something here.... Just not sure what... as I CAN see the HB controller IS being advertised on the network, and can add it to iOS due to it reverting to advertising via bonjour-hap

Logs

[3/11/2024, 1:28:18 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[3/11/2024, 1:28:20 PM] [HB Supervisor] OS: Linux 5.10.60-qnap x64
[3/11/2024, 1:28:20 PM] [HB Supervisor] Node.js v18.19.0 /opt/homebridge/bin/node
[3/11/2024, 1:28:20 PM] [HB Supervisor] Homebridge Path: /var/lib/homebridge/node_modules/homebridge/bin/homebridge
[3/11/2024, 1:28:20 PM] [HB Supervisor] UI Path: /opt/homebridge/lib/node_modules/homebridge-config-ui-x/dist/bin/standalone.js
[3/11/2024, 1:28:22 PM] [Homebridge UI] Homebridge UI v4.55.1 is listening on :: port 8581
[3/11/2024, 1:28:22 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules -D --strict-plugin-resolution
[3/11/2024, 1:28:22 PM] [HB Supervisor] Started Homebridge v1.7.0 with PID: 30214
[3/11/2024, 1:28:23 PM] Loaded config.json with 0 accessories and 1 platforms.
[3/11/2024, 1:28:23 PM] Loaded 0 cached accessories from cachedAccessories.
[3/11/2024, 1:28:23 PM] ---
[3/11/2024, 1:28:23 PM] No plugins found.
[3/11/2024, 1:28:23 PM] Loading 1 platforms...
[3/11/2024, 1:28:23 PM] Publishing bridge accessory (name: Homebridge C931, publishInfo: {
  username: '0E:B9:56:A1:C9:31',
  port: 51146,
  pincode: '***-**-***',
  category: 2,
  bind: undefined,
  mdns: undefined,
  addIdentifyingMaterial: true,
  advertiser: 'avahi'
}).
Setup Payload:
X-HM://0024PYUWLKTO8
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 756-43-381 │     
    └────────────┘     

[Homebridge C931 B347] The selected advertiser, "avahi", isn't available on this platform. Reverting to "bonjour-hap"
[3/11/2024, 1:28:23 PM] Homebridge v1.7.0 (HAP v0.11.1) (Homebridge C931) is running on port 51146.

Configuration

clean container for testing purposes. No default/generated config

Environment

Docker Image: HOMEBRIDGE_PKG_VERSION=1.1.6 FFMPEG_VERSION=v2.1.1 Hosted on QNAP Hero: 5.1.x (with avhi service advertising active) Home Assistant: (2024.3), also running in Docker Host mode (without issue) running both HK Bridge & HK Device (need to use HB for legacy AMP integration (Onkyo) and potentially for extended TV support (Tizen Samsung) I both working perviously.

OS  Ubuntu Jammy Jellyfish (22.04.3 LTS)
IPv4 (br-059a6ebd415e)  172.29.60.1
Hostname    MediaServ
User    root
Node.js Version  v18.19.0
Node.js Path    /opt/homebridge/bin
Storage Path    /var/lib/homebridge
Config Path /var/lib/homebridge/config.json
Plugin Path /var/lib/homebridge/node_modules
Timezone    GMT-0700
Docker  Yes

Process Supervisor

Docker (Mention image name in Additional Context)

Additional Context

homebridge/homebridge:latest Container pulled: 2024-03-11

taw123 commented 3 months ago

FYI- I also verified the socket and location of the Avahi-daemon on the host

[~] # ls -la /var/run/dbus
lrwxrwxrwx 1 admin administrators 35 2024-03-06 04:31 /var/run/dbus -> /mnt/ext/opt/avahi0630/var/run/dbus/

[~] # ls -la /var/run/avahi-daemon/socket
srwxrwxrwx 1 guest guest 0 2024-03-06 04:32 /var/run/avahi-daemon/socket=

And of course verified NON HomeBridge based, QNAP-hosted mDNS (avahi-daemon) Network service discovery continues to work fine (SMB, etc).

taw123 commented 3 months ago

Not a dig against the devs here, and I would help if they wanted but...

It seems like mDNS support here STILL is an issue and the best approach for ME.... Despite not making sense from a performance or network arch strategy... is to go back to approach I took years ago and implement an entire second network stack using MACLAN then run HomeBridge's mDNS advertising via avahi on it's own MAC address.

As I said I am still willing to help with diagnostics/dev/etc if you have the cycles to engage otherwise I'll assume that it's just not a good time for you and will implement as I mentioned in a week. Thanks again for all your work on HB I understand one doesn't always have cycles to respond/update.

All the best. --T

NorthernMan54 commented 3 months ago

@taw123 I’m currently on vacation and don’t have access to look at this. I will be back in a few weeks and can look at this then. If you want to start a pull request, can look at it then.

PS GitHub needs a ‘out of office’ function

taw123 commented 2 months ago

Just a friendly/respectful ping SOLELY to ensure that a Bot doesn't prematurely close this before you get cycles "back in the office" ;)

user5812346 commented 1 month ago

I have the exact same issue, avahi daemon works on host, links are there but still that [Homebridge] The selected advertiser, "avahi", isn't available on this platform. Reverting to "bonjour-hap" during startup

user5812346 commented 1 month ago

Actually, was able to resolve this. In my case it turned out that the host's avahi wasn't running with dbus. Installing (apt-get update && apt-get install avahi-utils iputils-ping -y) and running avahi-browse -a on the guest (homebridge) with docker exec -it homebridge bash made it clear that the issue wasn't with homebridge itself. I had to properly setup dbus on the host and then restart avahi with enable-dbus=yes set in /etc/avahi/avahi-daemon.conf

github-actions[bot] commented 4 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 3 weeks ago

This issue has been closed as no further activity has occurred.