# [SOLVED] ALSA, Intel HD Audio: sound occasionally disappears

## NilPointer

Hello, people!

I'm in late stages of migrating my laptop (Lenovo M5400) from Ubuntu to Gentoo. It went nice for most part, but I've been struggling with sound for a long time and can't seem to find a proper solution anywhere. I want to run pure-ALSA installation and avoid installing PulseAudio.

The problem is that soundcard seems to be detected, it isn't muted, but sometimes, it stops playing all audio.

When sound disappears, it usually goes undetected by all software, i.e. it keeps "playing" sounds, but it couldn't be heard at all. alsamixer shows all channels as not muted. That could be fixed by launching Audacity, it does some magic with sound devices during startup that fixes that particular problem temporarily. However, later (for example, during reboots) it might break again.

However, sometimes another problem appears, sound device seems to get locked and all software that produce sound begin to show errors that "file cannot be opened" or "device or resource busy", it could be fixed with combination of restarting ALSA and launching Audacity. SOLVED

My guess is that Audacity initializes proper device during startup or something.

I'll post some outputs and config exerpts in a moment.Last edited by NilPointer on Fri Oct 09, 2015 9:03 pm; edited 3 times in total

----------

## NilPointer

Here's my Audio device listing:

```
# lspci | grep Audio

00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)

00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 04)
```

Yes, I have one of these configurations, where there's an Intel Haswell HDMI Audio output and it steals place as a default card 0. That's why I've compiled snd-hda-intel as a Module and appended following lines into /etc/modprobe.d/alsa.conf:

```
options snd cards_limit=2

options snd-hda-intel id=PCH index=0

options snd-hda-intel id=HDMI index=1

options snd-hda-intel enable=0,1

options snd-hda-intel model=generic
```

At first, I've swapped them to the right order, but eventually I completely disabled HDMI output to prevent it from breaking audio. It didn't help much, though. Even that now I have only PCH device, there's still something bad going on.

Here's codec, that's in use with card:

```
$ grep Codec: /proc/asound/card*/codec*

Codec: Realtek ALC3239
```

I've compiled snd-hda-intel with Realtek and HDMI codecs:

```
                      <M> HD Audio PCI

  │ │                      (64) Pre-allocated buffer size for HD-audio driver

  │ │                      [*] Build hwdep interface for HD-audio driver

  │ │                      <M> Build Realtek HD-audio codec support

  │ │                      <M> Build HDMI/DisplayPort HD-audio codec support
```

----------

## NilPointer

Eventually, I seem to have figured one of problems (the one, where someone exclusively locked soundcard). I've migrated over my VirtualBox machines, which were set to use PulseAudio driver and I've forgotten to change it to ALSA driver, since I don't want to use PA. Virtual machines worked, but apparently, VirtualBox's PulseAudio Driver exclusively locked ALSA soundcard. Changing them to use ALSA driver apparently fixed problem and sound card no longer gets exclusively locked (no more "device or resource is busy").

However, with first problem, I'm still not sure, whether it's gone or not. It may or may not be related to VBox issue. Sound didn't disappear in last few hours and survived a few reboots. I'll wait a bit, and if problem is gone, I'll mark thread as solved.

----------

