Raspberry pi 4 3.5mm audio problem

Hey,
I am using home assistant on raspberry pi 4 with docker long time.
When i see rhasspy local voice app, i challenging audio with raspberry. but only see in the list ’ Dummy Output ’

I read a lot of topics and comments from sites, then i realize, docker cant use host(raspberry pi) onboard audio.

I found code for solution (i think its solution)

docker run -it --rm --device /dev/snd:/dev/snd

I couldnt success with it because i havent enough information with commands.

This is my configuration;

Sürüm	core-2023.3.2
Kurulum Türü	Home Assistant Supervised
Geliştirme	false
Süpervizör	true
Docker	true
Kullanıcı	root
Sanal Ortam	false
Python Sürümü	3.10.10
İşletim Sistemi Ailesi	Linux
İşletim Sistemi Sürümü	5.15.84-v8+
CPU Mimarisi	aarch64
Saat dilimi	Europe/Istanbul
Yapılandırma Dizini	/config

Audio logs;

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/alsa-mixer.sh
[02:53:14] INFO: Adjust ALSA mixer settings for /dev/snd/controlC0
[02:53:14] INFO: Adjust ALSA mixer settings for /dev/snd/controlC1
[02:53:15] INFO: Adjust ALSA mixer settings for /dev/snd/controlC2
cont-init: info: /etc/cont-init.d/alsa-mixer.sh exited 0
cont-init: info: running /etc/cont-init.d/filesystem.sh
cont-init: info: /etc/cont-init.d/filesystem.sh exited 0
cont-init: info: running /etc/cont-init.d/pulse-config.sh
[02:53:15] INFO: Found RaspberryPi system
cont-init: info: /etc/cont-init.d/pulse-config.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun alsa (no readiness notification)
services-up: info: copying legacy longrun pulseaudio (no readiness notification)
s6-rc: info: service legacy-services successfully started
W: [pulseaudio] main.c: Running in system mode, but --disallow-module-loading not set.
W: [pulseaudio] main.c: Home directory of user 'root' is not '/var/run/pulse', ignoring.
W: [pulseaudio] caps.c: Normally all extra capabilities would be dropped now, but that's impossible because PulseAudio was built without capabilities support.
W: [pulseaudio] main.c: OK, so you are running PA in system mode. Please make sure that you actually do want to do that.
W: [pulseaudio] main.c: Please read http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/ for an explanation why system mode is usually a bad idea.
W: [pulseaudio] module-udev-detect.c: Failed to open /proc/asound/card0: No such file or directory
E: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
E: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="0" name="platform-bcm2835_audio" card_name="alsa_card.platform-bcm2835_audio" namereg_fail=false tsched=no fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1""): initialization failed.
W: [pulseaudio] module-udev-detect.c: Failed to open /proc/asound/card1: No such file or directory
E: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
E: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="1" name="platform-fef00700.hdmi" card_name="alsa_card.platform-fef00700.hdmi" namereg_fail=false tsched=no fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1""): initialization failed.
W: [pulseaudio] module-udev-detect.c: Failed to open /proc/asound/card2: No such file or directory
E: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
E: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="2" name="platform-fef05700.hdmi" card_name="alsa_card.platform-fef05700.hdmi" namereg_fail=false tsched=no fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1""): initialization failed.
E: [pulseaudio] module-rescue-streams.c: module-rescue-stream is obsolete and should no longer be loaded. Please remove it from your configuration.
E: [pulseaudio] main.c: Failed to acquire org.pulseaudio.Server: org.freedesktop.DBus.Error.AccessDenied: Connection ":1.53" is not allowed to own the service "org.pulseaudio.Server" due to security policies in the configuration file

Sorry for my bad english, trying get help with sound.
Any help would be appreciated.

I have the same problem and I haven’t found a solution yet :frowning:

The solution is already there: the device /dev/snd needs to be set in a parameter when you run the docker container. I’d recommend to use docker compose, as you can set things like this very easy and don’t need to remember the exact command that you used to run your container last time.

That being said, it should look something like this:

version: "3"
services:
  rhasspy:
    image: "rhasspy/rhasspy"
    container_name: rhasspy
    restart: unless-stopped
    volumes:
        - "./app/config/rhasspy/profiles:/profiles"
        - "/etc/localtime:/etc/localtime:ro"
    ports:
        - "12101:12101"
# the following two lines 
    devices:
        - "/dev/snd:/dev/snd"
    command: --user-profiles /profiles --profile de

That should enable the docker container to use the audio from the Pi. :slight_smile: