Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when using host avahi daemon #592

Open
codemeister64 opened this issue Feb 17, 2025 · 0 comments
Open

Issue when using host avahi daemon #592

codemeister64 opened this issue Feb 17, 2025 · 0 comments
Labels

Comments

@codemeister64
Copy link

codemeister64 commented Feb 17, 2025

Analysis

Hello!
I'm trying to use avahi daemon from the host (linux+docker) according to this guide: https://github.com/homebridge/homebridge/wiki/mDNS-Options
The issue is that after server reboot, homebridge can't be started. It freezes and constantly "rebooting", WebUI can't be accessed.
To fix this I need to stop and restart avahi daemon on the host. But after that I see IPv4 issues in avahi daemon status - "Failed to create IPv4 socket, proceeding in IPv6 only mode".

Expected Behavior

Homebridge should successfully use host avahi daemon. In case of issues, homebridge should log crash report (There are no any useful logs even with DEBUG enabled) and/or omit using avahi (graceful handling)

Steps To Reproduce

Nothing special:

  1. Install latest TrueNAS Scale Electic Eel (24.10.2)
  2. Install Homebridge via docker-compose (I'm using portainer stack deploy)
  3. Issue reproduced

Logs

Homebridge constant reboot logs:


[2/16/2025, 7:47:02 PM] [Homebridge UI] Homebridge UI v4.71.0 is listening on :: port 8581.
[2/16/2025, 7:47:03 PM] [HB Supervisor] Homebridge storage path: /var/lib/homebridge.
[2/16/2025, 7:47:03 PM] [HB Supervisor] Homebridge config path: /var/lib/homebridge/config.json.
[2/16/2025, 7:47:03 PM] [HB Supervisor] Logging to /var/lib/homebridge/homebridge.log.
[2/16/2025, 7:47:03 PM] [HB Supervisor] OS: Linux 6.6.44-production+truenas x64.
[2/16/2025, 7:47:03 PM] [HB Supervisor] Node.js v22.14.0 /opt/homebridge/bin/node.
[2/16/2025, 7:47:03 PM] [HB Supervisor] Homebridge path: /var/lib/homebridge/node_modules/homebridge/bin/homebridge.
[2/16/2025, 7:47:03 PM] [HB Supervisor] UI path: /opt/homebridge/lib/node_modules/homebridge-config-ui-x/dist/bin/standalone.js.
[2/16/2025, 7:47:03 PM] [Homebridge UI] Homebridge UI v4.71.0 is listening on :: port 8581.
[2/16/2025, 7:47:04 PM] [HB Supervisor] Homebridge storage path: /var/lib/homebridge.
[2/16/2025, 7:47:04 PM] [HB Supervisor] Homebridge config path: /var/lib/homebridge/config.json.
[2/16/2025, 7:47:04 PM] [HB Supervisor] Logging to /var/lib/homebridge/homebridge.log.
[2/16/2025, 7:47:04 PM] [HB Supervisor] OS: Linux 6.6.44-production+truenas x64.
[2/16/2025, 7:47:04 PM] [HB Supervisor] Node.js v22.14.0 /opt/homebridge/bin/node.
[2/16/2025, 7:47:04 PM] [HB Supervisor] Homebridge path: /var/lib/homebridge/node_modules/homebridge/bin/homebridge.
[2/16/2025, 7:47:04 PM] [HB Supervisor] UI path: /opt/homebridge/lib/node_modules/homebridge-config-ui-x/dist/bin/standalone.js.


After restart of the host Avahi daemon, Homebridge immediatly successfully booting, but avahi on the host has issue:



root@truenas[~]# systemctl status avahi-daemon
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
     Loaded: loaded (/lib/systemd/system/avahi-daemon.service; enabled; preset: disabled)
     Active: active (running) since Mon 2025-02-17 21:47:14 EET; 3s ago
TriggeredBy: ● avahi-daemon.socket
   Main PID: 30965 (avahi-daemon)
     Status: "avahi-daemon 0.8 starting up."
      Tasks: 2 (limit: 153879)
     Memory: 848.0K
        CPU: 20ms
     CGroup: /system.slice/avahi-daemon.service
             ├─30965 "avahi-daemon: running [truenas.local]"
             └─30967 "avahi-daemon: chroot helper"

Feb 17 21:47:14 truenas avahi-daemon[30965]: Failed to create IPv4 socket, proceeding in IPv6 only mode
Feb 17 21:47:14 truenas avahi-daemon[30965]: Joining mDNS multicast group on interface eno1.IPv6 with address fdfc:3fa0:e138:e942:abf>
Feb 17 21:47:14 truenas avahi-daemon[30965]: New relevant interface eno1.IPv6 for mDNS.



This issue can be fixed if I stop homebridge container and restart avahi daemon again.


root@truenas[~]# systemctl status avahi-daemon
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
     Loaded: loaded (/lib/systemd/system/avahi-daemon.service; enabled; preset:>
     Active: active (running) since Mon 2025-02-17 21:38:12 EET; 6min ago
TriggeredBy: ● avahi-daemon.socket
    Process: 6554 ExecReload=/usr/sbin/avahi-daemon -r (code=exited, status=0/S>
   Main PID: 5518 (avahi-daemon)
     Status: "avahi-daemon 0.8 starting up."
      Tasks: 2 (limit: 153879)
     Memory: 964.0K
        CPU: 85ms
     CGroup: /system.slice/avahi-daemon.service
             ├─5518 "avahi-daemon: running [truenas.local]"
             └─5610 "avahi-daemon: chroot helper"

Feb 17 21:38:12 truenas avahi-daemon[5518]: Registering new address record for >
Feb 17 21:38:12 truenas avahi-daemon[5518]: Registering new address record for >
Feb 17 21:38:13 truenas systemd[1]: Reloading avahi-daemon.service - Avahi mDNS>
Feb 17 21:38:13 truenas avahi-daemon[5518]: Got SIGHUP, reloading.
Feb 17 21:38:13 truenas systemd[1]: Reloaded avahi-daemon.service - Avahi mDNS/>
Feb 17 21:38:13 truenas avahi-daemon[5518]: Server startup complete. Host name >
Feb 17 21:38:14 truenas avahi-daemon[5518]: Service "truenas" (/services/nut.se>
Feb 17 21:38:14 truenas avahi-daemon[5518]: Service "truenas" (/services/SMB.se>
Feb 17 21:38:14 truenas avahi-daemon[5518]: Service "truenas" (/services/HTTP.s>

Configuration

services:
  homebridge:
    image: homebridge/homebridge:latest
    user: "0:0"
    container_name: homebridge
    hostname: homebridge
    network_mode: host
    labels:
      - traefik.enable=true
      - traefik.http.routers.homebridge-https.tls=true
      - traefik.http.routers.homebridge-https.tls.certresolver=cloudflare
      - traefik.http.routers.homebridge-https.entrypoints=websecure
      - traefik.http.routers.homebridge-https.rule=Host(`homebridge.${EXTERNAL_HOSTNAME}`)
      - traefik.http.services.homebridge-https.loadbalancer.server.port=8581
      - homepage.group=IoT
      - homepage.name=Homebridge
      - homepage.icon=homebridge.svg
      - homepage.href=https://homebridge.${EXTERNAL_HOSTNAME}
      - homepage.description=HomeKit Hub
    volumes:
      - /mnt/applications/apps-data/homebridge:/homebridge:rw
      - /var/run/dbus:/var/run/dbus:rw
      - /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket:rw
    logging:
      driver: json-file
      options:
        max-size: "10mb"
        max-file: "1"
    environment:
      PUID: "0"
      PGID: "0"
      TZ: "${TZ}"
      ENABLE_AVAHI: 0
    security_opt:
      - apparmor:unconfined
    deploy:
      resources:
        limits:
          memory: 4096M
    restart: unless-stopped

networks:
  home-lab:
    external: true

Environment

  • OS: Debian 12 bookworm 6.6.44 (TrueNAS Scale Electric Eel 24.10.2)
  • Software: Homebridge v1.9.0 (HAP v0.12.3)
  • Node: v22.14.0
  • npm: 10.9.2

Process Supervisor

Docker (Mention image name in Additional Context)

Additional Context

homebridge/homebridge:latest - sha256:27414632249e9066de7cc856336780813447fd547d54be849c5a3af1c1dda880

It doesn't matter if mDNS discovery on TrueNAS settings enabled or disabled - issue still persist, if avahi-daemon is running.

@NorthernMan54 NorthernMan54 transferred this issue from homebridge/homebridge Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant