Clean logs

birdnet-go: quiet startup logs (chmod, JACK, OSS, dsnoop)
This commit is contained in:
Alexandre
2026-05-27 10:29:18 +02:00
committed by GitHub
5 changed files with 60 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
## nightly-20260525-2 (26-05-2026)
- Suppress noisy startup logs: silence `chmod /dev/snd` errors on the read-only HA mount, and hide unavailable ALSA plugins (JACK, OSS, dsnoop) from device enumeration so libjack and pcm_oss/dsnoop probes no longer print at launch. ALSA overrides are written to `/root/.asoundrc` (since `/etc/asound.conf` is read-only in this environment).
- Allow advanced users to override the ALSA config by dropping a custom `asound.conf` into the addon config folder.
- Add LOG_MAX_SIZE_MB and LOG_MAX_AGE_DAYS addon options to manage log storage size
- Automatically trim log files exceeding configured age on startup

View File

@@ -36,6 +36,13 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \
COPY rootfs/ /
RUN find . -type f \( -name "*.sh" -o -name "run" -o -name "finish" \) -print -exec chmod +x {} \;
# Silence "chmod: Read-only file system" noise from upstream entrypoint:
# Home Assistant mounts /dev/snd read-only, so the chmod is a no-op and the
# stderr output is just noise. The "|| true" already absorbs the exit code.
RUN if [ -f /usr/bin/entrypoint.sh ]; then \
sed -i 's#chmod -R a+rw /dev/snd || true#chmod -R a+rw /dev/snd 2>/dev/null || true#' /usr/bin/entrypoint.sh; \
fi
# Uses /bin for compatibility purposes
# hadolint ignore=DL4005
RUN if [ ! -f /bin/sh ] && [ -f /usr/bin/sh ]; then ln -s /usr/bin/sh /bin/sh; fi && \

View File

@@ -122,4 +122,4 @@ slug: birdnet-go
udev: true
url: https://github.com/alexbelgium/hassio-addons/tree/master/birdnet-go
usb: true
version: "nightly-20260525"
version: "nightly-20260525-2"

View File

@@ -8,6 +8,20 @@ set -e
echo " "
# Allow advanced users to supply their own ALSA config (e.g. to enable JACK
# or a custom dsnoop chain) by dropping asound.conf into the addon config
# folder. Written to /root/.asoundrc because /etc/asound.conf is read-only.
if [ -f /config/asound.conf ]; then
if [ -r /config/asound.conf ]; then
bashio::log.info "Using user-provided /config/asound.conf, overriding addon defaults"
if ! cp /config/asound.conf /root/.asoundrc; then
bashio::log.warning "Failed to copy /config/asound.conf; continuing with bundled /root/.asoundrc defaults"
fi
else
bashio::log.warning "/config/asound.conf exists but is not readable; continuing with bundled /root/.asoundrc defaults"
fi
fi
# Check if alsa_card is provided
CONFIG_LOCATION="/config/config.yaml"
if bashio::config.true "homeassistant_microphone"; then

View File

@@ -0,0 +1,35 @@
# Home Assistant addon: birdnet-go
#
# Shipped at /root/.asoundrc because /etc/asound.conf is read-only in this
# environment. ALSA loads ~/.asoundrc as an additive layer on top of the
# system config, so the overrides below take effect for the birdnet-go process
# (which runs as root, HOME=/root).
#
# Replace ALSA PCM plugins whose backends are not available in the addon
# container (JACK server, OSS /dev/dsp) with type "null" and hide them from
# snd_device_name_hint(). Without this, miniaudio's capture-device enumeration
# probes every PCM hint at startup, triggering noisy errors like:
# - "Cannot connect to server socket" / "jack server is not running" (libjack)
# - "ALSA lib pcm_oss.c: Cannot open device /dev/dsp"
# - "ALSA lib pcm_dsnoop.c: unable to open slave"
# BirdNET-Go itself never opens these PCMs; only the enumeration probe does.
pcm.!jack {
type null
hint.show off
}
pcm.!oss {
type null
hint.show off
}
pcm.!dsp {
type null
hint.show off
}
pcm.!dsnoop {
type null
hint.show off
}