# Fresh install, no sound *SOLVED*

## todd93

Hi, I just finished installing Gentoo on my machine, and I don't have any sound. The problem is I'm not sure what to do to get my sound working. I know it's something to do with kernel settings, as I used genkernel in order to get the machine booted, and into my gui. I do plan on rolling out my own kernel, but I'm not sure where to get started on getting my sound to work. Any help would be appreciated!

Thanks!

ToddLast edited by todd93 on Sat Dec 01, 2018 12:03 am; edited 1 time in total

----------

## fedeliallalinea

Put with wget paste lspci -k and you kernel config

----------

## NeddySeagoon

todd93,

What fedeliallalinea said and post the content of /proc/asound/devices too.

Its quite popular to have several sound cards and send the audio to the wrong card.

e.g. if you want the on board analogue audio to work, having the default be your HDMI or webcam is not what you want.

Which audio output are you listening to?

----------

## todd93

 *fedeliallalinea wrote:*   

> Put with wget paste lspci -k and you kernel config

 

Hi, thanks, Here is the requested materials:

lspci -k

Kernel config

NeddySeagoon,

There's an issue with that, I'm not listening or able to choose any audio output at the moment, Which leads me to believe that it has to be a missing kernel module. Forgive me, I'm not sure what you're asking for with the content of /proc/asound/devices, is this what you need?:

```

# ls /proc/asound/

card0/   cards    Generic/ modules  oss/     seq/     version  

card1/   devices  hwdep    NVidia/  pcm      timers

```

If not, please direct me in the way I need to go.

Thanks!

Todd

----------

## fedeliallalinea

The sound cards seems correct configures. As NeddySeagoon say try with alsamixer (media-sound/alsa-utils) to see if is active correct sound card (with F6 you can change sound card)

----------

## todd93

 *fedeliallalinea wrote:*   

> The sound cards seems correct configures. As NeddySeagoon say try with alsamixer (media-sound/alsa-utils) to see if is active correct sound card (with F6 you can change sound card)

 

Ok, there was one mistake I found, I did not have media-sound/alsa-utils emerged on my system. Somehow I guess I forgot to emerge it, along with anything else alsa. I was looking through the alsa packages, and I'm not sure which ones I don't need. I am assuming this is my problem. If it is, then it makes this not a kernel issue, and apparently I've put this post in the incorrect thread. For that I appologize.

Thanks

Todd

----------

## NeddySeagoon

todd93,

Check that your emerge --info shows the alsa USE flag set.

If you have a desktop profile set, it should already be on.

You do have two sound cards but until alsamixer works, thats something for the future.

-- edit --

```
09:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050 Ti] (rev a1)

   Subsystem: eVga.com. Corp. GP107 [GeForce GTX 1050 Ti]

   Kernel driver in use: nouveau

   Kernel modules: nouveau

09:00.1 Audio device: NVIDIA Corporation GP107GL High Definition Audio Controller (rev a1)

   Subsystem: eVga.com. Corp. GP107GL High Definition Audio Controller

   Kernel driver in use: snd_hda_intel

   Kernel modules: snd_hda_intel

...

12:00.3 Audio device: Advanced Micro Devices, Inc. [AMD] Device 1457

   Subsystem: Gigabyte Technology Co., Ltd Device a0b8

   Kernel driver in use: snd_hda_intel
```

Your video card will be your default sound card.

	Kernel modules: snd_hda_intel

----------

## todd93

NeddySeagoon,

Yes, I do have the alsa USE flag set. I fear that I need to emerge more of alsa, but I'm not sure what. The only things alsa I have installed are: media-libs/alsa-lib and media-sound/alsa-utils.There's several more packages having to do with alsa, I'm not sure which ones I need.

Thanks

Todd

----------

## krinn

 *NeddySeagoon wrote:*   

> Your video card will be your default sound card.

 

You miss this important part of what NeddySeagoon has said, it's normal, he is too wise to be understand by normal human

In human language he said

If you have more than one cards, the default one may not be the one you want use with your speakers, and as sound is played thru default selected card, you have no sound (while in real sound is working, just it work with the "wrong" card)

How to fix that?

Solve is easy and here

----------

## todd93

krinn,

Ok, yes, I get it now, that is very simple, one thing I'm having a problem with, however, is the link you provided says: "the following kernel command line option will swap the MID and PCM card indicies so that the default card 0 is the PCM card:

snd-hda-intel.index=1,0"

Do I need to add that into the kernel config? OR is there a step I'm missing? The alternative is stated to only work if snd-hda-intel is compiled as a module, and not built in, it was my understanding that this has to be built in to the kernel, and not compiled as a module, or am I incorrect about that?

Thanks,

Todd

----------

## krinn

if you have built it "build-in" kernel, then you must pass it from kernel command line parameter, you can do this by

* in your boot manager, adding it as boot option, ie: kernel /boot/vmlinuz root=/dev/sd?? snd-hda-intel.index=1,0

* in kernel config, adding it to CONFIG_CMDLINE="snd-hda-intel.index=1,0"

but i'm always using myself modules where i could for the flexibilty provided by loading/unloading them with new settings (that's the same except you don't have to reboot), so myself i keep building all sound related entries (the CONFIG_SND* entries) as module

----------

## NeddySeagoon

todd93,

The module parameter has to be available to the kernel when the module is initialised.

There are three cases to consider. 

1) The snd-hda-intel code is built into the kernel. The module parameter must be passed on the kernel command line as root is not mounted when snd-hda-intel is initialised, so /etc/conf.d/modules can have no effect.

2) snd-hda-intel is built as a loadable module. The module parameter must be passed at module load time. When the module is on the root filesystem /etc/conf.d/modules is effective, along with all the other alsa fine tuning files.

3) snd-hda-intel is built as a loadable module. The module parameter must be passed at module load time. When the module is in the initrd, its unclear to me if /etc/conf.d/modules can be consulted or not.

Root may be mounted, but it may not be at the right place, so somehow the module parameters need to be made available to the module loading process in the initrd.

For experiment you can do in by hand.

```
modprobe -r snd-hda-intel 

modprobe snd-hda-intel index=1,0
```

Your kernel config says that snd-hda-intel is a loadable module.

----------

## todd93

NeddySeagoon, krinn,

Ok, I understand totally what you're both saying, However when I do the commands you specified, I get the following:

```

# modprobe -r snd-hda-intel

modprobe: FATAL: Module snd_hda_intel is in use.

```

However, the command of:

```

modprobe snd-hda-intel index=1,0

```

completed without error.

There is still no difference, when I open alsamixer, it's still defaulting to the video card, when I choose the right card, I'm able to adjust the volumes, yet I continue to have no sound..

I just don't understand what else needs to be done. Would I be better off to roll my own kernel out? I'm not sure the genkernel is serving the purpuse I need, or does that have nothng to do with my problem?

Thanks

Todd

----------

## NeddySeagoon

todd93,

You are not allowed to remove a module in use. Your kernel also needs to support module removal.

Look at the output of 

```
lsmod

Module                  Size  Used by

...

snd_hda_codec_via      20480  1

snd_hda_codec_generic    65536  1 snd_hda_codec_via

snd_hda_codec_hdmi     45056  1

snd_hda_intel          24576  4

snd_hda_codec          77824  4 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_via

snd_hwdep              16384  2 snd_usb_audio,snd_hda_codec

snd_hda_core           49152  5 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_codec_via

snd_pcm                73728  5 snd_hda_codec_hdmi,snd_hda_intel,snd_usb_audio,snd_hda_codec,snd_hda_core

snd_timer              28672  1 snd_pcm

...
```

before snd_hda_intel  can be unloaded, everything using it must be unloaded too.  On my system, it doesn't list anything but says its in use by 4 things.

```
modprobe snd-hda-intel index=1,0 
```

finds that snd-hda-intel is already loaded and does nothing.

Its not an error to attempt to load an already loaded module.

There is another way ...

You create a file 

```
/etc/asound.conf 
```

 Containing

```
defaults.pcm.card 1

defaults.ctl.card 1

defaults.pcm.device X
```

I don't know what value of X you need but you find out like this. Look in  /proc/asound/devices.

You will see something like

```
  2: [ 1- 3]: digital audio playback

  3: [ 1- 7]: digital audio playback

  4: [ 1- 8]: digital audio playback

  5: [ 1- 9]: digital audio playback

  6: [ 1-10]: digital audio playback

  7: [ 1- 0]: hardware dependent

  8: [ 1]   : control

  9: [ 0- 0]: digital audio playback

 10: [ 0- 0]: digital audio capture

 11: [ 0- 3]: digital audio playback

 12: [ 0- 0]: hardware dependent

 13: [ 0]   : control

 33:        : timer
```

The bit of interest is the bit inside the square brackets, which means [card_no - device_on_card_no]

Look at your card 1. Find the device_on_card number for your hardware dependent device. Thats X.

/etc/asound.conf  is read every time alsa is used, so trial and error isn't hard.

Instead of swapping cards, this tells alsa to default to the analogue output on card 1.

----------

## todd93

NeddySeagoon,

We have success!! That did it, I can't tell you how much I appreciate all your help through this!

Thanks again!

Todd

----------

