plugin-audio icon indicating copy to clipboard operation
plugin-audio copied to clipboard

Audio stopped working on the host system

Open frkos opened this issue 6 years ago • 99 comments

Hello @pvizeli After the latest release #9 audio on my host system stopped working. Looks like hassio audio locked it... Wben I run aplay I see this error: aplay: main:828: audio open error: Device or resource busy So I had to rollback to the version 8: ha audio update --version 8 and it works again

frkos avatar Mar 11 '20 06:03 frkos

Ohh.... it's upgraded back to 9 automatically =(

frkos avatar Mar 11 '20 07:03 frkos

DEL

NVM, load the module for IDLE manual with pactl

pvizeli avatar Mar 11 '20 09:03 pvizeli

is there a quck way to disable this? How to downgrade to an usable version?

dimovnike avatar Mar 11 '20 13:03 dimovnike

where to find the ha binary? It's not present in any of the containers...

dimovnike avatar Mar 11 '20 14:03 dimovnike

a temporary fix:

service hassio-supervisor stop docker stop hassio_audio

Afte this, homeassistant stops working for about 3 minutes then it comes back and is usable.

dimovnike avatar Mar 11 '20 14:03 dimovnike

Well, you can just load manually the IDLE module for PulseAudio... just use google for the commands on PulseAudio. As the docu said, you have the full control of Pulse

pvizeli avatar Mar 11 '20 16:03 pvizeli

@pvizeli I'm running into this issue on Ubuntu 18.04. I looked into loading module-suspend-on-idle for pulseaudio, but my /etc/pulse/default.pa file already has it loaded. Is there somewhere else I should be looking?

jbirdjavi avatar Mar 11 '20 20:03 jbirdjavi

@pvizeli What was the reasoning for https://github.com/home-assistant/audio/pull/11? This has hosed two machines I'm running both home-assistant and mythtv on since the audio no longer works in mythtv.

jbirdjavi avatar Mar 11 '20 20:03 jbirdjavi

@pvizeli I also don't understand what you mean by this. I think you mean I should configure pulse audio in the hassio_audio container, but if I do so using docker run changes will not be persistent.

Is there anything I can change in /usr/share/hassio/audio to make hassio_audio not steal my host pc audio, as I currently don't want to have hassio_audio. This might change in the future, but as of right now, this is not sufficient for my use case. The only way that quickly worked is what @dimovnike mentioned. But turning off hassio_supervisor and hassio_audio is probably a bit much.

deisi avatar Mar 11 '20 20:03 deisi

How do I permanently disable hassio_audio from running? It breaks pulse audio on the host system.

journalctl --since "1 day ago" | grep pulseaudio shows messages like these:

Mar 11 22:58:43 hades pulseaudio[1840]: [alsa-sink-ALC700 Analog] alsa-sink.c: Error opening PCM device front:0: Device or resource busy
Mar 11 22:58:43 hades pulseaudio[1840]: [alsa-sink-ALC700 Analog] alsa-sink.c: Error opening PCM device front:0: Device or resource busy
Mar 11 22:59:20 hades pulseaudio[1840]: [alsa-sink-ALC700 Analog] alsa-sink.c: Error opening PCM device front:0: Device or resource busy
Mar 11 22:59:27 hades pulseaudio[1840]: [alsa-sink-ALC700 Analog] alsa-sink.c: Error opening PCM device front:0: Device or resource busy
Mar 11 22:59:27 hades pulseaudio[1840]: [pulseaudio] sink-input.c: Failed to create sink input: sink is suspended.

Rebooting the host I can get audio back for a few minutes before these messages begin appearing again.

Edit: Trying to play YouTube on Chromium on the host system; the video gets stuck loading with a message: "If playback doesn't being shortly, try restarting your device."

If I kill hassio_audio container, the video begins to play immediately.... Once video playback on the host stops and hassio_audio has booted up again, it's back to "If playback doesn't being shortly, try restarting your device." on the next video.

deftdawg avatar Mar 12 '20 03:03 deftdawg

You need to use the pactl tool over the Terminal add-on to load the IDLE module if you need this.

The Supervisor is designed to get full control over your to host and everything is running as an add-on. If you use it differently, it ends up with such issues and they can get more in the future. You should maybe look into the OVA (OpenVirtualAppliance) or just use the Core installation.

pvizeli avatar Mar 12 '20 08:03 pvizeli

I'm running HA on a x86 pc, that I also use as desktop and for various other things. I know that hassio is primarily run on raspberrys. Given that more of this will happen in the future, it might be a good time to switch to a virtual machine to host the hassio instance. I'm a bit worried about mapping all the USB devices, as I have about 20 of them or so, but it might eventually work.

deisi avatar Mar 12 '20 11:03 deisi

That is the out of the box handling with supervisor: host -> supervisor -> add-ons. However, you can manage the PulseAudio instance by your self and tweak what do you want.

The Project have just 1 developer and that is me. If someone will jump into and maintain the generic installer with all issues and use case to make sure it work like you need, welcome to the team. But the size of the project and that is all maintain by just 1 person make that we need focus me to to the roots. Home Assistant is a full manage system with allow to run the Supervisor on Debian/Ubuntu. However, the nature of the Supervisor is the same. If you want manage all by your self, you can just install the Core.

pvizeli avatar Mar 12 '20 14:03 pvizeli

The Project have just 1 developer and that is me

You don't need to justify anything to me. I'm very happy for your work. :)

Putting hassio in a dedicated VM should be fine as well or am I wrong? This would also be future proof, as hassio can do in the VM what ever it likes. Plz correct me if I'm wrong as I would like to give that a try soon.

deisi avatar Mar 12 '20 14:03 deisi

Per @pvizeli's clue, I believe these are the steps to get hassio audio to release audio back to the host:

  1. Select Supervisor tab from the sidebar
  2. Install the Terminal & SSH add-on from the supervisor, start it, add it to the sidebar
  3. Select the Terminal tab from the sidebar
  4. At the prompt type pactl load-module module-suspend-on-idle

This should release the ALSA sink back to pulse audio on the host until the next hassio_addon container restart.

deftdawg avatar Mar 12 '20 15:03 deftdawg

@pvizeli I would still like to know the reasoning for #11 as it seems to be causing more issues than it's solving.

jbirdjavi avatar Mar 12 '20 15:03 jbirdjavi

why is not module-suspend-on-idle loaded on default? Is there a reason for it? Or there are other addons that actually use pulse audio?

dimovnike avatar Mar 12 '20 15:03 dimovnike

However, you can manage the PulseAudio instance by your self and tweak what do you want.

This is only somewhat true, since a reboot of the host will reset things to default. Is there a way to persist my changes? I would prefer to stick with using the supervisor since there seems to be very little documentation for just installing and using Core in my brief searching.

jbirdjavi avatar Mar 13 '20 22:03 jbirdjavi

I have the same problem, on my PC host system (Ubuntu 18.04.4, Kernel 5.3.0-40) there is no sound and microphone on host system. I have homeassistant 0.106.6, supervisor 209. I'm not using any of audio steam/pass options in homeassistant, so I can live without it. It's not working in my case: pactl load-module module-suspend-on-idle

For my the best solution would be to turn off hassio_audio container from run by supervisor. Is there any option to do that?

rothvaw avatar Mar 14 '20 18:03 rothvaw

I’m in the same situation as the others - I run home-assistant through hass.io on a multipurpose x86 computer and suddenly lost sound on the host - it took a while to diagnose if I’m honest. I understand the intention of this container/project and will probably just build out a docker compose of all the things the hass.io install does (e.g. all the add-ons I use) currently but that’s a bigger project...

What worked for me (at least so far) was to stop and remove the audio container, as it looks like the supervisor gets a bit confused when it expects an image to be available locally and it isn’t.

# as root or prefixed with sudo:
docker stop hassio_audio
docker image rm -f homeassistant/amd64-hassio-audio:9

Super hacky but I couldn’t work out a way to tell the supervisor not to start the audio container, or a way to persist which pulse/alsa modules are loaded.

fourseven avatar Mar 16 '20 07:03 fourseven