# [SOLVED] Recompiling the kernel/ALSA Sound Card Issue

## Bladesy

Hello all, I'm new to this forum, as well as Gentoo and even Linux in general. 

My system is almost in acceptable working order - the only issue I'm having is with sound. When I use the command 

```
alsamixer
```

 it says that my sound device does not have any controls, and 

```
aplay -l
```

 does not list it as a sound device.  

The above leads me to believe that I did not select the driver for my audio controller when compiling my kernel. 

What steps are usually taken when this happens? 

I'm guessing that the kernel needs to be recompiled - but on the Gentoo Wiki, they recompile the kernel after selecting a different source, yet keep the configuration the same. I'm thinking that I need to do the opposite - which is keep the source the same, but change the configuration. 

Is this possible? If so, how exactly would I go about doing so? 

And if this were possible and achieved, would I have to recompile all of my programs? How would this be achieved? 

I hope I haven't missed anything, or jumped from conclusion to conclusion too much. 

Thanks in advance.Last edited by Bladesy on Sun Apr 05, 2015 6:48 pm; edited 1 time in total

----------

## NeddySeagoon

Bladesy,

Welcome to Gentoo.

You may have several sound devices.  The one that has no controls is usually sound over HDMI. 

Lets start at he beginning.  Run 

```
lspci
```

and post the output. If you don't have lspci yet, its part of pciutils. You wirr need to emerge that.

lspci -k will tell the kernel driver in use, if any.

```
 00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA)

   Subsystem: ASUSTeK Computer Inc. Device 8357

   Kernel driver in use: snd_hda_intel
```

You will not need to rebuild any programs. You might need to rebuild your kernel. Depending on what you have now, it micght just be a configuration issue.

```
alsamixer
```

on its own, is the same as 

```
alsamixer -c0
```

Thats sound card 0. 

```
alsamixer -c1
```

 might show controls.  You may even have -c2 ... and so on.

----------

## Bladesy

Thank you very much, I may have only joined today, but your posts have helped me a lot as of late.  

This may seem like a very beginner question, but how exactly do I copy the log of the lspci command? I have it stored in a text file, but I can't seem to get it across to firefox...

----------

## NeddySeagoon

Bladesy,

There are two ways.  You can copy and past with your mouse.

Highlight the text to copy it. Middle click to paste.

The other way, which is used for pastes that won't fit in a forum post, is to use wgetpaste and post the link it returns.

Don't worry about beginner questions, we all remember starting out.  If you do get RTFM responses here they will include a reference to the friendy manual along the lines of see 

```
man foo
```

and if its a big man page, a pointer to the bit you need to read :)

----------

## Bladesy

```
tux fractured # lspci

00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 03)

00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (primary) (rev 03)

00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (secondary) (rev 03)

00:1a.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 (rev 04)

00:1a.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 04)

00:1a.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 04)

00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 04)

00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 04)

00:1c.3 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 4 (rev 04)

00:1c.5 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 6 (rev 04)

00:1d.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 04)

00:1d.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 04)

00:1d.2 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 04)

00:1d.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 04)

00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f4)

00:1f.0 ISA bridge: Intel Corporation 82801HM (ICH8M) LPC Interface Controller (rev 04)

00:1f.1 IDE interface: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 04)

00:1f.2 SATA controller: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] (rev 04)

00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 04)

06:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection (rev 02)

08:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5787M Gigabit Ethernet PCI Express (rev 02)

0a:09.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 05)

0a:09.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 22)

0a:09.2 System peripheral: Ricoh Co Ltd R5C843 MMC Host Controller (rev 12)

0a:09.3 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 12)

0a:09.4 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev 12)

tux fractured # lspci > lspci.txt

tux fractured # ls

Desktop  lspci.txt

tux fractured # nano lspci.txt

tux fractured # lspci -k

00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 03)

   Subsystem: Acer Incorporated [ALI] Acer Aspire 5920G

   Kernel driver in use: agpgart-intel

00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (primary) (rev 03)

   Subsystem: Acer Incorporated [ALI] Device 0121

   Kernel driver in use: i915

00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (secondary) (rev 03)

   Subsystem: Acer Incorporated [ALI] Device 0121

00:1a.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 (rev 04)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

   Kernel driver in use: uhci_hcd

00:1a.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 04)

   Subsystem: Acer Incorporated [ALI] Acer Aspire 5920G

   Kernel driver in use: uhci_hcd

00:1a.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 04)

   Subsystem: Acer Incorporated [ALI] Acer Aspire 5920G

   Kernel driver in use: ehci-pci

00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 04)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

   Kernel driver in use: snd_hda_intel

00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 04)

   Kernel driver in use: pcieport

00:1c.3 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 4 (rev 04)

   Kernel driver in use: pcieport

00:1c.5 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 6 (rev 04)

   Kernel driver in use: pcieport

00:1d.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 04)

   Subsystem: Acer Incorporated [ALI] Acer Aspire 5920G

   Kernel driver in use: uhci_hcd

00:1d.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 04)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

   Kernel driver in use: uhci_hcd

00:1d.2 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 04)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

   Kernel driver in use: uhci_hcd

00:1d.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 04)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

   Kernel driver in use: ehci-pci

00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f4)

00:1f.0 ISA bridge: Intel Corporation 82801HM (ICH8M) LPC Interface Controller (rev 04)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

00:1f.1 IDE interface: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 04)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

   Kernel driver in use: ata_piix

00:1f.2 SATA controller: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] (rev 04)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

   Kernel driver in use: ahci

00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 04)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

06:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection (rev 02)

   Subsystem: Intel Corporation WM3945ABG MOW2

08:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5787M Gigabit Ethernet PCI Express (rev 02)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

   Kernel driver in use: tg3

0a:09.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 05)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

0a:09.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 22)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

0a:09.2 System peripheral: Ricoh Co Ltd R5C843 MMC Host Controller (rev 12)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

0a:09.3 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 12)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

0a:09.4 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev 12)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G
```

What a strange way to copy and paste text, much faster though.

----------

## NeddySeagoon

Bladesy,

In the GUI you can use the windows way to copy/paste.

So far so good.

```
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 04)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G

   Kernel driver in use: snd_hda_intel 
```

Your kernel is in good shape.  You don't have HDMI sound or any other PCI sound cards.

What about a USB headset or webcam?

Playing sound to a webcam doesn't sound very good.

What does 

```
ls /dev/snd/con*
```

show?

I get  

```
$ ls /dev/snd/con*

/dev/snd/controlC0  /dev/snd/controlC1  /dev/snd/controlC2  /dev/snd/controlC3
```

which tells that my kernel can see four sound cards, C0 .. C3

Your system will be trying to use sound card 0 by default.

----------

## Bladesy

I only get 

```
/dev/snd/controlC0
```

----------

## Bladesy

Where exactly do I go from here? The system detects my sound card, so does this mean my kernel needs recompiling?

----------

## NeddySeagoon

Bladesy,

Use wgetpaste to put your kernel configuration file onto a pastebin site. The file name is /usr/src/linux/.config

```
/dev/snd/controlC0
```

tells that you have exactly one sound card.  We know from your previous posts that the basic kernel driver is there.

There are four possibilities.

1. The kernel driver is in several pieces - you have a piece missing

2. Your alsa install is incomplete - but you have alsamixer, thats encouraging

3. Your audio codec chip is too new and is not yet supported - unlikely

4. Your audio codec or its wirirng is not auto detected correctly - you will need to pass a parameter to the kernel module when it loads.

Oops - there is another ... your normal user is not in tho audio group, so cannot see the sound card.

Check your groups as a normal user 

```
$ groups

tty wheel uucp audio cdrom video games kvm cdrw users vboxusers scanner plugdev roy
```

You must have audio listed.

Does alsamixer work for root?

At the top of alsamixer you should see 

```
│ Card: HDA ATI SB                                     F1:  Help               │

│ Chip: VIA VT1708S                                    F2:  System information │

│ View: F3:[Playback] F4: Capture  F5: All             F6:  Select sound card  │

│ Item: Master [dB gain: 0.00]                         Esc: Exit   
```

What do you have for Chip:

----------

## Bladesy

I've got my config file uploaded here: https://bpaste.net/show/0e784d0082b8

Alsamixer works for both root and my normal user, and my normal user is also in the audio group. However, in alsamixer, it only says that my card is a HDA Intel - it doesn't display the chip, or any controls.

----------

## NeddySeagoon

Bladesy,

This shows that all of your codec dirvers are off except one.

```
# CONFIG_SND_HDA_CODEC_REALTEK is not set

# CONFIG_SND_HDA_CODEC_ANALOG is not set

# CONFIG_SND_HDA_CODEC_SIGMATEL is not set

# CONFIG_SND_HDA_CODEC_VIA is not set

# CONFIG_SND_HDA_CODEC_HDMI is not set

CONFIG_SND_HDA_I915=y

# CONFIG_SND_HDA_CODEC_CIRRUS is not set

# CONFIG_SND_HDA_CODEC_CONEXANT is not set

# CONFIG_SND_HDA_CODEC_CA0110 is not set

# CONFIG_SND_HDA_CODEC_CA0132 is not set

# CONFIG_SND_HDA_CODEC_CMEDIA is not set

# CONFIG_SND_HDA_CODEC_SI3054 is not set

# CONFIG_SND_HDA_GENERIC is not set
```

Thats a kernel rebuild to fix - I guess you have one of the others.

There is no clue in 

```
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 04)

   Subsystem: Acer Incorporated [ALI] Aspire 5920G 
```

either.  Well the Ali might be ...

Google hints that it might be Realtek but vendors often mix and match.

The kernel rebuild goes like this ...

```
cd /urs/src/linux
```

 to get to the kernel tree

```
make menuconfig
```

  to change the settings - don't ever use a text editor.

Press / for search, enter  SND_HDA_CODEC_REALTEK case is not important here.

Read what it says about where the option is. You will find them all on the same menu.

Set the codecs to either <M> or <Y> ... all of them.

Exit menuconfig, being sure to save the changes.

```
make -j4
```

  will build the kernel and its modules

```
make modules_install
```

 will install the modules.

```
mount /boot
```

  if you have a separate boot partition.

```
cp arch/x86/boot/bzImage /boot/<nice_kernel_name>
```

  to copy the kernel to boot.  Its a really bad idea to overwrite your only working kernel.

Add /boot/<nice_kernel_name> to your boot loader.

Reboot to test.

Run 

```
uname -a
```

  and look at the date/time in the output.  That's the build date/time of the running kernel.  It should be nowish, if you are actually using the new kernel.

Try alsamixer.

----------

## Bladesy

Thank you very much, I've been searching for a suitable method for recompiling the kernel. I'll post back when I've got it recompiled - hopefully this solves the problem.

----------

## Bladesy

When you say all the codecs, I should enable all I see in the HD-Audio tab? Not just "Build Realtek HD-audio codec support", but all those below it too?

----------

## NeddySeagoon

Bladesy,

Yes, include all the codecs.  We don't really know which one you need

----------

## Bladesy

Ah, I see, better to have them all incase we left out the one that was actually needed.

----------

## Bladesy

Will I need to enable anything in the generic sound device drivers, or PCI sound devices?

----------

## Bladesy

I've actually noticed something in the PCI drivers - there are 2 options which include the phrase "ALi", which are "Intel/SiS/nVidia/AMD/ALi AC97 Controller" and "ALi M5451 PCI Audio Controller". Should I enable these?

----------

## Bladesy

Sorry for posting so much, but I've included all the options I think I might need - maybe an excess slightly - but I've copied arch/x86/boot/bzImage to /boot/gentoo-sound-kernel. However, when I run 

```
grub2-mkconfig -o /boot/grub/grub.cfg
```

 it only finds one linux image, which is /boot/vmlinuz-3.18.9-gentoo. Shouldn't it be finding /boot/gentoo-sound-kernel? Is there a way to manually add it?

----------

## NeddySeagoon

Bladesy,

The options "Intel/SiS/nVidia/AMD/ALi AC97 Controller" and "ALi M5451 PCI Audio Controller" are for PCI sound chips.

AC97 refers to the year that the standard was introduced 1997.

We already know that the PCI chip you have is the HD Audio PCI, since lspci -k shows SND_HDA_INTEL in use.

Those options aro just ballast/bloat in your kernel. They won't matter.

I've never used grub2, so I don't know how it works.

----------

## Bladesy

I could not find any information on the naming conventions grub2 uses, but I found the name of my old kernel "vmlinuz-3.18.9-gentoo" and changed the name of "gentoo-sound-kernel" to "vmlinuz-3.18.9.1-gentoo" and it suddenly detected it.

----------

## Bladesy

I ran uname -a and got a very recent date, so I continued to run alsa mixer and it came up with controls and everything. However, I'm not quite sure how to configure it and achieve sound. Are there any ways to test the sound? I should also note that for some reason my terminal emulator urxvt isn't working. Will it need recompiling? Firefox seems to be fine, but I tried to play a video, and got no sound. I assume this means it needs to be recompiled to work with my updated kernel also?

----------

## NeddySeagoon

Bladesy,

By default, all of your sound channes are muted. If you unmute them they will be muted again after a reboot.

Add  alsasound to the default runlevel to preserve your sound settings across reboots.

```
│     │OO│     │OO│              │OO│     │MM│              │OO│     │OO│      │

│     └──┘     └──┘              └──┘     └──┘              └──┘     └──┘      │

│     100              75<>75   94<>94    0<>0     0<>0   100<>100   100       │

│  < Master >Headphon   PCM     Front   Front Mi Front Mi Surround  Center    
```

The MM at the bottom of a slider indicates Muted. Sliders are stereo controls, so there is one M each for left and right.

Do not unmute everything in sight.  Most sound cards can do digital and analogue sound but not at the same time.

Be sure to leave anything with SPDI/F or IEC in its name muted.  This is because digital takes priority over analogue.

Unmute Master and PCM, set the controls to about 70% then try 

```
speaker-test 
```

You may find 

```
man speaker-test 
```

and

```
speaker-test -h
```

useful.

----------

## Bladesy

Thanks so much for your help, but would you happen to know why my terminal fails to load? Should I try recompiling it - and how would I do so?

----------

## Bladesy

Oh, I forgot to ask in my last post, but is it safe to remove my old kernel? Is there anything to take caution with? I should also mention that sound is working perfectly from the speaker test, and also in firefox.

----------

## NeddySeagoon

Bladesy,

```
$ emerge urxvt -pv

These are the packages that would be merged, in order:

Calculating dependencies... done!

emerge: there are no ebuilds to satisfy "urxvt".

emerge: searching for similar names...

emerge: Maybe you meant any of these: x11-terms/rxvt, x11-terms/mrxvt, x11-terms/xvt?
```

Where did you get urxvt?

All terminal emulators need a pair of ptys per instance.  You have pyy support it your kernel.

What does the mount commanh - no parameters have to say?

It should include the line 

```
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
```

If not, does turning that line into a mount command and mounting devpts manually help?

----------

## NeddySeagoon

Bladesy,

Yes, its safe to remove the old kernel now the new one is tested.

Every now and again, everyone makes a dud kernel.  The idea of keeping a few old ones in the kernel menu is that it allows you to fix a dud without reaching for a liveCD. 

I use lvm on top of raid5, so its not trivial to get started wint a liveCD.

Oh another reason.  I use Virtualbox.  At the moment, I can't get it to run on kernels more recent than 3.16.x, so I need to keep an old kernel for that, until I get around to fixing it.

----------

## Bladesy

The reinstall worked as expected, so I'm able to launch my terminal now. The package name for urxvt is rxvt-unicode, which I got from x11-terms. I guess the last step in this process is removing the old kernel?

----------

## NeddySeagoon

Bladesy,

Don't be in too much of a hurry to remove the old kernel but you can if you want to.

----------

## Bladesy

Thank you so much for all your help, my system is working perfectly now. Is there any proceedure for marking a thread as finished?

----------

## NeddySeagoon

Bladesy,

You can edit the title of the your original post to include [solved] if you wish. 

You can only edit your own posts.

----------

## Bladesy

I'll do that now, thanks again.

----------

