Ubuntu – No audio with headphones, but audio works with integrated speakers

10.04headphonessound

My speakers work correctly, but when I plug in my headphones, they don't work. I am running Ubuntu 10.04.

My audio card is Realtek ALC259
My laptop model is a HP G62t a10em

In another thread someone fixed a similar issue (headphones work, speakers not) folowing this:

sudo vi /etc/modprobe.d/alsa-base.conf (or some other editor instead of Vi)
Append the following at the end of the file:

alias snd-card-0 snd-hda-intel
options snd-hda-intel model=auto

Reboot

but it doesnt work for me.

Before making and changes to alsa, this was the output:

alsamixer gives me this:
alsamixer output
Audio card is a HDA ATI SB

Things I did:
followed this HowTo but now no hardware seems to be present (before, there were 2 items listed):
sound preferences - hardware tab is empty

Now, alsamixer gives me this:

alsamixer: relocation error: alsamixer: symbol snd_mixer_get_hctl, version ALSA_0.9 not defined in file libasound.so.2 with link time reference

I guess there was and error in the alsa-driver install so I began reinstalling it.

cd alsa-driver*            //this works fine//
sudo ./configure --with-cards=hda-intel --with-kernel=/usr/src/linux-headers-$(uname -r)   //this works fine//
sudo make    //this doesn't work. see ouput error below//
sudo make install

Final lines of sudo make:

hpetimer.c: In function ‘snd_hpet_open’:
hpetimer.c:41: warning: implicit declaration of function ‘hpet_register’
hpetimer.c:44: warning: implicit declaration of function ‘hpet_control’
hpetimer.c:44: error: expected expression before ‘unsigned’
hpetimer.c: In function ‘snd_hpet_close’:
hpetimer.c:51: warning: implicit declaration of function ‘hpet_unregister’
hpetimer.c:52: error: invalid use of undefined type ‘struct hpet_task’
hpetimer.c: In function ‘hpetimer_init’:
hpetimer.c:88: error: ‘EINVAL’ undeclared (first use in this function)
hpetimer.c:99: error: invalid use of undefined type ‘struct hpet_task’
hpetimer.c:100: error: invalid use of undefined type ‘struct hpet_task’
hpetimer.c: At top level:
hpetimer.c:121: warning: excess elements in struct initializer
hpetimer.c:121: warning: (near initialization for ‘__param_frequency’)
hpetimer.c:121: warning: excess elements in struct initializer
hpetimer.c:121: warning: (near initialization for ‘__param_frequency’)
hpetimer.c:121: warning: excess elements in struct initializer
hpetimer.c:121: warning: (near initialization for ‘__param_frequency’)
hpetimer.c:121: warning: excess elements in struct initializer
hpetimer.c:121: warning: (near initialization for ‘__param_frequency’)
hpetimer.c:121: error: extra brace group at end of initializer
hpetimer.c:121: error: (near initialization for ‘__param_frequency’)
hpetimer.c:121: warning: excess elements in struct initializer
hpetimer.c:121: warning: (near initialization for ‘__param_frequency’)
make[1]: *** [hpetimer.o] Error 1
make[1]: Leaving directory `/usr/src/alsa/alsa-driver-1.0.9/acore'
make: *** [compile] Error 1

And then sudo make install gives me:

rm -f /lib/modules/0.0.0/misc/snd*.*o /lib/modules/0.0.0/misc/persist.o /lib/modules/0.0.0/misc/isapnp.o
make[1]: Entering directory `/usr/src/alsa/alsa-driver-1.0.9/acore'
mkdir -p /lib/modules/0.0.0/misc
cp snd-hpet.o snd-page-alloc.o snd-pcm.o snd-timer.o snd.o /lib/modules/0.0.0/misc
cp: cannot stat `snd-hpet.o': No such file or directory
cp: cannot stat `snd-page-alloc.o': No such file or directory
cp: cannot stat `snd-pcm.o': No such file or directory
cp: cannot stat `snd-timer.o': No such file or directory
cp: cannot stat `snd.o': No such file or directory
make[1]: *** [_modinst__] Error 1
make[1]: Leaving directory `/usr/src/alsa/alsa-driver-1.0.9/acore'
make: *** [install-modules] Error 1
[SOLUTION]

After screwing it all up, someone mentioned why not trying using the packages in Synaptic - so I did. 
I have reinstalled the following packages and rebooter:
-alsa-hda-realtek-ignore-sku-dkms
-alsa-modules-2.6.32-25-generic
-alsa-source
-alsa-utils
-linux-backports-modules-alsa-lucid-generic
-linux-backports-modules-alsa-lucid-generic-pae
-linux-sound-base
-(i think i listed them all)

After rebooting, the audio worked, both in speakers and headphones.
I have no idea which is the package that made my audio work, but it certainly was one of them.

[/SOLUTION]

Best Answer

My solution may seem the dumbest but it worked great for me: put your laptop in suspend closing the lid, open it up again and it's fixed.

Related Question