home-assistant / plugin-audio

Pulseaudio implementation for Home Assistant
Apache License 2.0
26 stars 13 forks source link

Sound broken on HA yellow #139

Closed Mapu89rp closed 1 year ago

Mapu89rp commented 1 year ago

About one month ago my speakers does not work anymore. So I ordered new ones. The new one also does not work. They were both active speakers on the output jack of the Home Assistant Yellow.

I am on home assistant OS 10.2

In the official VLC addon log when I try to play it get this error message:

vlcpulse audio output error: stream connection failure: No such entity
main audio output error: module not functional
main decoder error: failed to create audio output

I did a full backup and reset everything then I started again with the backup. On first start it works after a reboot it stopped working. Also tried a USB soundcard which also appear on the drop-down menu in VLC, but when I select it also got the same error. So I do not think that is a hardware fault.

The logs from the audio plugin

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
[11:50:34] INFO: Adjust ALSA mixer settings for /dev/snd/controlC0
[11:50:35] INFO: Adjust ALSA mixer settings for /dev/snd/controlC1
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
[11:50:35] 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/card1: No such file or directory
W: [pulseaudio] module-udev-detect.c: Failed to open /proc/asound/card0: No such file or directory
E: [pulseaudio] module-rescue-streams.c: module-rescue-stream is obsolete and should no longer be loaded. Please remove it from your configuration. 
agners commented 1 year ago

Just tested on HAOS 10.2 on my Yellow, using Google TTS via VLC add-on seems to work here.

My logs look like this:

[core-ssh ~]$ ha 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
[12:41:52] INFO: Adjust ALSA mixer settings for /dev/snd/controlC0
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
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-rescue-streams.c: module-rescue-stream is obsolete and should no longer be loaded. Please remove it from your configuration.

My VLC add-on log doesn't have such an error

s6-rc: info: service vlc: starting
s6-rc: info: service nginx: starting
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service vlc successfully started
s6-rc: info: service nginx successfully started
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/ingress.sh
[12:42:01] INFO: Service restart after closing
cont-init: info: /etc/cont-init.d/ingress.sh exited 0
cont-init: info: running /etc/cont-init.d/secret.sh
[0000007fb8d2d460] main interface error: no suitable interface module
[0000007fbd547b30] main libvlc error: interface "globalhotkeys,none" initialization failed
[0000007fbd41e9d0] main playlist: playlist is empty
[0000007fb8d2d470] [http] lua interface: Lua HTTP interface
cont-init: info: /etc/cont-init.d/secret.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
[0000007fbd3f4140] [telnet] lua interface: Listening on host "telnet://:4212".
s6-rc: info: service legacy-services successfully started
[12:42:02] INFO: Successfully send discovery information to Home Assistant.
2023/06/07 12:42:02 [notice] 149#149: using the "epoll" event method
2023/06/07 12:42:02 [notice] 149#149: nginx/1.22.1
2023/06/07 12:42:02 [notice] 149#149: OS: Linux 6.1.21-v8
2023/06/07 12:42:02 [notice] 149#149: getrlimit(RLIMIT_NOFILE): 1073741816:1073741816
2023/06/07 12:42:02 [notice] 149#149: start worker processes
2023/06/07 12:42:02 [notice] 149#149: start worker process 154
[0000007fbd41e9d0] main playlist: playlist is empty

Maybe a hardware fault in your case? :cold_face:

Can you check the kernel logs, e.g. using

ha host logs -t kernel -b 0 -n 10000
ha host logs -t kernel -b 0 -n 10000 | grep pcm
Mapu89rp commented 1 year ago

If hardware fault shouldn't then at least the USB soundcard work?

With grep pcm I only get recurring this message homeassistant kernel: pcm512x6-004c: No SCLK, using BCLK: -2

agners commented 1 year ago

If hardware fault shouldn't then at least the USB soundcard work?

Hm good point, I guess yeah that should work. But could be another problem :sweat:

If hardware fault shouldn't then at least the USB soundcard work? With grep pcm I only get recurring this message homeassistant kernel: pcm512x6-004c: No SCLK, using BCLK: -2

I have that too, that doesn't seem to be the problem.

What do you try to play? Maybe a file encoding issue with the file you are trying to play?

BebeMischa commented 1 year ago

I'm having similar problem since today on a x86 machine with HA supervised. VLC won't play...

So after yesterdays update VLC-TELNET addon does not breathe anymore.

After almost three years flawless service, we have no more TTS announcements.

The addons says this:

s6-rc: info: service vlc: starting
s6-rc: info: service nginx: starting
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service vlc successfully started
s6-rc: info: service nginx successfully started
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/ingress.sh
[00007f3483f70760] main interface error: no suitable interface module
[00007f34841ee9b0] main libvlc error: interface "globalhotkeys,none" initialization failed
[00007f3483fa09d0] main playlist: playlist is empty
[00007f3483f70740] [http] lua interface: Lua HTTP interface
[00007f3483f75960] [telnet] lua interface: Listening on host "telnet://:4212".
cont-init: info: /etc/cont-init.d/ingress.sh exited 0
cont-init: info: running /etc/cont-init.d/secret.sh
[21:20:34] INFO: Service restart after closing
cont-init: info: /etc/cont-init.d/secret.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[21:20:34] INFO: Successfully send discovery information to Home Assistant.
2023/06/08 21:20:35 [notice] 149#149: using the "epoll" event method
2023/06/08 21:20:35 [notice] 149#149: nginx/1.22.1
2023/06/08 21:20:35 [notice] 149#149: OS: Linux 5.10.0-23-amd64
2023/06/08 21:20:35 [notice] 149#149: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2023/06/08 21:20:35 [notice] 149#149: start worker processes
2023/06/08 21:20:35 [notice] 149#149: start worker process 154

There are some errors…

The VLC media player looks, like there is nothing wrong, says it is playing a file, but no sound is coming out of the speakers.

After that attempt (only one), addon logs says this many times:

[00007f3483f96d50] vlcpulse audio output error: stream connection failure: No such entity
[00007f3483f96d50] main audio output error: module not functional
[00007f347f288fd0] main decoder error: failed to create audio output

Home Assistant 2023.6.0 Supervisor 2023.06.1 Frontend-versie: 20230607.0 - latest

Debian 11 fully up to date OS agent 1.5.1 intel Celeron quadcore machine, onboard sound

Does anyone have an idea?

agners commented 1 year ago

So after yesterdays update

I assume you refer to the Core update? I'd say it is unlikely that it is the Core, but other components like Supervisor got updated as well. Anything in the Core or Supervisor logs?

BebeMischa commented 1 year ago

Supervisor and core logs do not complain, only the addon log, as said already. Seeing even more people having that trouble. https://community.home-assistant.io/t/no-sound-output-vlc-telnet-after-update-2023-6-0/579849

somenewaccountthen commented 1 year ago

Audo log has this, same as OP. Similarly no stuff in supervisor log. 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-rescue-streams.c: module-rescue-stream is obsolete and should no longer be loaded. Please remove it from your configuration.

I tried default and the named audio device in the config. (Output only) I have an intel NUC x86 and worked fine previously.

Is it the add-on wasn't granted access to audio device?

And "you actually want to do that?" It sounds so ominous. ;)

agners commented 1 year ago

I am still unable to reproduce this problem here.

Can you try restarting the audio part to see if that helps?

ha audio restart
Mapu89rp commented 1 year ago

ha audio restart did not change anything. Also downgrade of ha audio does not help. Maybe a problem of Home Assistant OS then?

mib1185 commented 1 year ago

@Mapu89rp could you please show us the outputs of the following commands (run via Terminal addon)

ls -la /dev/snd/*
pactl list cards
Mapu89rp commented 1 year ago

Just the home assistant yellow without USB audio device

**ls -la /dev/snd

drwxr-xr-x    3 root     root           140 Jun 12 22:49 .
drwxr-xr-x   15 root     root          4160 Jun 12 22:49 ..
drwxr-xr-x    2 root     root            60 Jun 12 22:49 by-path
crw-rw----    1 root     29        116,   3 Jun  8 12:12 controlC0
crw-rw----    1 root     29        116,   2 Jun  8 12:12 pcmC0D0p
crw-rw----    1 root     29        116,   1 Apr  4 12:55 seq
crw-rw----    1 root     29        116,  33 Jun  8 12:12 timer

pactl list cards

        Name: alsa_card.platform-soc_sound
        Driver: module-alsa-card.c
        Owner Module: 7
        Properties:
                alsa.card = "0"
                alsa.card_name = "pcm5121-sound"
                alsa.long_card_name = "pcm5121-sound"
                alsa.driver_name = "snd_soc_simple_card"
                device.bus_path = "platform-soc:sound"
                sysfs.path = "/devices/platform/soc/soc:sound/sound/card0"
                device.form_factor = "internal"
                device.string = "0"
                device.description = "Built-in Audio"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card"
        Profiles:
                output:stereo-fallback: Stereo Output (sinks: 1, sources: 0, priority: 5100, available: yes)
                off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
        Active Profile: output:stereo-fallback
        Ports:
                analog-output: Analog Output (type: Analog, priority: 9900, latency offset: 0 usec, availability unknown)
                        Part of profile(s): output:stereo-fallback
[core-ssh ~]$
BebeMischa commented 1 year ago

ls -la /dev/snd

root@ShuttleDomotica:~# ls -la /dev/snd/*
crw-rw----+ 1 root audio 116,  8 Jun 10 23:45 /dev/snd/controlC0
crw-rw----+ 1 root audio 116,  6 Jun 10 23:45 /dev/snd/hwC0D0
crw-rw----+ 1 root audio 116,  7 Jun 10 23:45 /dev/snd/hwC0D2
crw-rw----+ 1 root audio 116,  3 Jun 10 23:45 /dev/snd/pcmC0D0c
crw-rw----+ 1 root audio 116,  2 Jun 10 23:45 /dev/snd/pcmC0D0p
crw-rw----+ 1 root audio 116,  4 Jun 10 23:45 /dev/snd/pcmC0D3p
crw-rw----+ 1 root audio 116,  5 Jun 10 23:45 /dev/snd/pcmC0D7p
crw-rw----+ 1 root audio 116,  1 Jun 10 23:45 /dev/snd/seq
crw-rw----+ 1 root audio 116, 33 Jun 10 23:45 /dev/snd/timer

/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root  60 Jun 10 23:45 .
drwxr-xr-x 3 root root 240 Jun 10 23:45 ..
lrwxrwxrwx 1 root root  12 Jun 10 23:45 pci-0000:00:1b.0 -> ../controlC0

pactl ilist cards

Connection failure: Connection refused
pa_context_connect() failed: Connection refused
agners commented 1 year ago

Maybe a problem of Home Assistant OS then?

I don't think so, as things started to happen on the same version for some people. Also @BebeMischa is on Supervised and sees the same issue.

In case you want, you can downgrade the OS to see if that helps in your case, e.g. using:

ha os update --version 9.5
agners commented 1 year ago

Can you also share the output of ha audio info and ha audio logs?

BebeMischa commented 1 year ago

ha audio info

audio:
  application: []
  card:
  - driver: module-alsa-card.c
    index: 0
    name: alsa_card.pci-0000_00_1b.0
    profiles:
    - active: false
      description: Analog Stereo Input
      name: input:analog-stereo
    - active: false
      description: Analog Stereo Output
      name: output:analog-stereo
    - active: true
      description: Analog Stereo Duplex
      name: output:analog-stereo+input:analog-stereo
    - active: false
      description: "Off"
      name: "off"
  input:
  - applications: []
    card: 0
    default: true
    description: Built-in Audio Analog Stereo
    index: 1
    mute: false
    name: alsa_input.pci-0000_00_1b.0.analog-stereo
    volume: 0.1259002685546875
  output:
  - applications: []
    card: 0
    default: true
    description: Built-in Audio Analog Stereo
    index: 0
    mute: false
    name: alsa_output.pci-0000_00_1b.0.analog-stereo
    volume: 1
host: 172.30.32.4
update_available: false
version: 2023.04.1
version_latest: 2023.04.1

ha 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
[23:45:26] INFO: Adjust ALSA mixer settings for /dev/snd/controlC0
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
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-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.45" is not allowed to own the service "org.pulseaudio.Server" due to security policies in the configuration file

ls -la /dev/snd

root@ShuttleDomotica:~# ls -la /dev/snd/*
crw-rw----+ 1 root audio 116,  8 Jun 10 23:45 /dev/snd/controlC0
crw-rw----+ 1 root audio 116,  6 Jun 10 23:45 /dev/snd/hwC0D0
crw-rw----+ 1 root audio 116,  7 Jun 10 23:45 /dev/snd/hwC0D2
crw-rw----+ 1 root audio 116,  3 Jun 10 23:45 /dev/snd/pcmC0D0c
crw-rw----+ 1 root audio 116,  2 Jun 10 23:45 /dev/snd/pcmC0D0p
crw-rw----+ 1 root audio 116,  4 Jun 10 23:45 /dev/snd/pcmC0D3p
crw-rw----+ 1 root audio 116,  5 Jun 10 23:45 /dev/snd/pcmC0D7p
crw-rw----+ 1 root audio 116,  1 Jun 10 23:45 /dev/snd/seq
crw-rw----+ 1 root audio 116, 33 Jun 10 23:45 /dev/snd/timer

/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root  60 Jun 10 23:45 .
drwxr-xr-x 3 root root 240 Jun 10 23:45 ..
lrwxrwxrwx 1 root root  12 Jun 10 23:45 pci-0000:00:1b.0 -> ../controlC0

pactl ilist cards

Connection failure: Connection refused
pa_context_connect() failed: Connection refused
agners commented 1 year ago

So after yesterdays update VLC-TELNET addon does not breathe anymore.

What update are you referring to here? Home Assistant Core?

BebeMischa commented 1 year ago

Well, I found out, that I can't be sure, which update caused this. It could be Supervisor or Core, they came both in a short period. I've stated, that VLC stopped working after both. But I can't say, if it already was broken after the supervisor update. I was not at home very much between the two updates.

agners commented 1 year ago

Thanks for all the logs and help to get the bottom of this! This is proven to be a Supervisor issue and handled in https://github.com/home-assistant/supervisor/issues/4355.

BebeMischa commented 1 year ago

Thanks all for dealing with it. Now it just needs to be released, so my wife is happy again :-P

somenewaccountthen commented 1 year ago

The fix works for me .. i checked the change.. 1 line, few letters changed. So much pain for such a a few letters. :) It's the way of the Bug. Can be 1 char :)

Thanks all for dealing with it. Now it just needs to be released, so my wife is happy again :-P

I've seen your struggles in the comments, friend. I can read between the lines. I am happy to hear much of your wife's speech can now be directed at the HA again.