59

The problem is that I can hear the sound from my laptop's speakers even if I plugged in my headphones. Headphones is just standard stereo headphones. And the most interesting thing is that all was working just a week ago.

I tried to play with pulseaudio and alsamixer settings - no results.

Ilay
  • 868
  • What machine do you use? Netbook? Laptop? Desktop? Tell us the model and specification too, please. – Drie Jun 14 '12 at 16:52
  • Also, if what you mean is that you get sound from both headphones and speakers at once when headphones are plugged in, I recommend editing your post to clarify that this is what you are saying. Also please let us know about whatever you've tried so far (if anything) to fix this problem. Also, is this the question you were thinking of? – Eliah Kagan Jun 14 '12 at 16:53
  • Look to the 'Related' questions, located to the right on this page. Some of the answers may help. – loklaan Jun 14 '12 at 16:55
  • 1
    Did you install any sound or video editing tools? Similar problem happened to me. I think it was Audacity (it changed some sound port settings by default). Solution was to run that program and change some settings. – Ljiljan Veselinovic Jun 01 '15 at 05:55

17 Answers17

51

Follow these steps to automatically mute your speakers when plugging in headphones:

  1. Open Terminal (Ctrl+Alt+T)
  2. Type: alsamixer and press Enter/Return
  3. Select the correct sound device by pressing F6
  4. Navigate to the right with (Right Arrow key) until you highlight Auto-Mute
  5. Press (Up Arrow key) and select Enabled (or Line Out)
  6. Press Esc to exit
kleinfreund
  • 1,232
user247077
  • 611
  • 5
  • 2
  • Great, this worked perfectly without the need to add repos and/or packages, or edit a config file! – stragu Jun 01 '15 at 05:30
  • 7
    For those that were lost like me, there's a step missing. After #2, press F6 to select your audio device. Then you'll see the option mentioned in #3. – Nick Zinger Oct 06 '15 at 13:20
  • 1
    People have been telling me I have a problem with my audio driver. You just saved me from a bunch of troubleshooting. – Marcel Nov 04 '16 at 15:04
  • after struggling for months, you saved me ;-) – senseiwu May 17 '17 at 21:53
  • 3
    I actually wanted to play audio on both speakers and headphones at the same time. I "Disable"d it and it works perfectly! – e18r Jun 12 '17 at 16:48
  • This eight year old answer resolved my problem at appeared after upgrading to 22.04. When I dock and close the lid on my laptop sound still could be heard in laptop speakers instead of just the docking station connected speakers. This wasn't an issue with 20.04 nor 18.04. – Sean Sep 16 '22 at 14:49
  • In my case, the option in alsamixer (v1.2.6) on Ubuntu 22.04 was called "HP/Speaker Auto Detect" and the mechanism to enable it was to press the 'M' key. The Up/Down arrow did not toggle the state of this option. – scooter Jan 03 '23 at 05:46
  • The magical answer! One of those amazing answers that makes you love linux more. So easy to tune down source you don't want to use. Previously I had trouble with pulse audio control. But this solution worked perfectly. Thanks! – Игор Mar 06 '23 at 09:34
27

Original Solution

  1. Go to Realtek official site, accept the disclaimer, then download the audio driver for linux/unix. You need to select version 3 for Kernel 3 or later.

  2. Setup necessary tools to compile this driver.

    sudo apt-get install build-essential gcc make

  3. Extract the downloaded file, run sudo ./install file from a terminal after going to the extracted folder to compile the driver.

  4. Read the Readme.txt file for more information.

  5. Install gnome-alsamixer by this command.

     sudo apt-get install gnome-alsamixer
    
  6. Open the gnome-alsamixer by typing alsamixer in the dash.

  7. Select the "Auto mute mode" in the new window.

Reboot and see whether it fixed now. (Step 6 and 7 might not necessary). Automute will automatically enabled upon restart


Solution 2:

I have just found another solution:

(It worked for me with Only S/PDIF profile, Sound from both headphone and speaker and not being able to switch profile)

  1. Add this ppa by the command

      sudo apt-add-repository ppa:ubuntu-audio-dev/alsa-daily
    
  2. Update packages list. by

     sudo apt-get update
    
  3. Then install "alsa-hda-dkms" package:

      sudo apt-get install alsa-hda-dkms
    

Reboot, And See the result!

Anwar
  • 76,649
  • I had exactly this problem. but it now fixed. you can install gnome-alsa-mixer to gain more control over your sound. Note that after compilation the sound will be muted. – Anwar Jun 14 '12 at 20:09
  • apt-get install alsa-hda-dkms has worked for me, thank you very much. – Dmytro Sirenko Oct 13 '12 at 22:09
  • 2
    Hey! I tried to install alsa-hda-dkms. First two steps worked but when ever I execute third step sudo apt-get install alsa-hda-dkms it gives this error: E: Unable to locate package alsa-hda-dkms. Is this package removed from the repository? Reply!! – Saurav Kumar Sep 03 '13 at 19:48
  • @SauravKumar Are you using 12.04? It seems the package has now been removed, Anyway, the problem also got solved in the later updates of 12.04, So, you may want to update your Ubuntu – Anwar Sep 04 '13 at 13:21
  • 1
    Just enabling auto mute in alsamixer worked for me. Thanks. (Ubuntu 14.04) – rodrigo-silveira Aug 17 '15 at 13:17
  • i get "Unable to locate package alsa-hda-dkms" and I am on 18.04. My ultimate issue is sound going to s/pdif while set to headphones- built in audio – TheArchitecta Aug 03 '19 at 03:34
7

I also had this problem on my HP laptop. I found a post and take one of the advice, which suggests adding two lines to the bottom of the file /etc/modprobe.d/alsa-base.conf:

options snd-hda-intel model=laptop
options snd-hda-intel position_fix=1 enable=yes

save it and reboot. It works for me!

David Foerster
  • 36,264
  • 56
  • 94
  • 147
hiqhan
  • 79
4

Had this issue on XUbuntu 12.04, reviewed this page, installed the gnome-alsamixer package, ran gnome-alsamixer, checked the "Headphone Jack Sense" option in the gnome-alsamixer GUI screen that came up, verified the problem is resolved. Thanks!

Bob
  • 41
2

The command sudo apt-get install gnome-alsa-mixer did the trick for me on my Compaq nw8000.

I could enable the Headphone Jack Sense option and now it switches the audio to the headphone when I plug-in my head phones.

Lucio
  • 18,843
2

I had the same problem on 13.04 with an Asus X201E, and tried the gnome-alsamixer solution but it failed as the gnome-alsamixer crashed with "No idea what to do for mixer element "Auto-Mute Mode"!". So I opened the command line alsamixer and navigated to the Auto-Mute Mode using the arrows (only Auto-Mut is visible in the terminal window) and set it from Disabled to Enabled. Now connecting the headphones mutes the internal speakers.

asterx
  • 21
  • 1
2

What worked for me was to run alsamixer and enable the auto-mute option. I did this while the headphones were connected and everything started working perfectly.

Vishal
  • 156
1

18.04

None of these answers above worked for me in 18.04 I tried a number of them from re-installing pulse audio through to alsamixer in terminal etc. But none worked. Everything was up to date.

My Issue was:

Dual sound out of headphones (low volume) and Speakers (120% volume) (crazy loud volume out of my Amp (s/pdif)), when selecting "Headphones - Built-in Audio" in Sound settings (3rd box in my picture). When selecting s/pdif it would go to normal Audio level out of my speakers. Very strange as it was working fine for months and started this for no reason a week ago after an update.

An answer above provided an elaborate way to install Gnome Alsa Mixer, but I just did:

sudo apt-get install gnome-alsamixer

I have actioned many things, so hard to say what was the perfect sequence of events, but with this install of Gnome Alsa Mixer

Auto-Mute Mode had little effect I turned off all IEC958 settings, not sure what they do, but the setting that stopped the crazy behaviour (headphones and speakers at full volume) was turning OFF "IEC956 Default-PCM" as per 1st box in picture using the Gnome Alsa Mixer

Extra Question about how Gnome Alsa Mixer works here waiting for an answer:

How does the GNome Alsa Mixer Work with my settings

I  then

1

This one worked for me perfectly.

  1. Edit /etc/modprobe.d/alsa-base.conf as super-user with you favourite text editor, e. g.:

    sudo gedit /etc/modprobe.d/alsa-base.conf
    
  2. At the end of the file paste the following:

    alias snd-card-0 snd-hda-intel
    options snd-hda-intel model=dell-m4-1 enable_msi=1
    
  3. Save and Reboot.

If this does not work, change in the second line the part about model=dell-m4-1 to model=hp-m4.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
1

after upgrading from 15.04 -> 15.10 and now on 16.10 (where problem started)

the only resolution that worked for me was to do a full reinstall

dpkg -l | grep 'alsa-'
apt-get install --reinstall  alsa-base alsa-utils
0

Try plugging in your headphones properly. This happened to me once and then after fixing that pin of the headphones correctly it worked properly.

Pranit Bauva
  • 1,091
0

I had the same exact problem with a fresh install of Xubuntu. I tried a buch of things including typing alsamixer in terminal. The option was not there for me to turn on the Headphone Jack Sense. I installed gnome-alsamixer and found the Headphone Jack Sense option, checked it and alas no audio from the pc speakers while headphones are plugged in. This worked for me.

Jason
  • 1
0

Running alsamixer in terminal worked for me, set it to Auto Mute and you should find your machine will play sound through one or the other rather than both

David Foerster
  • 36,264
  • 56
  • 94
  • 147
0

in alsamixer, try using arrow key Up, then turn everything up to 100% and you will see the right bar turns up. After that turn down arrow key to % you like. Now it should be down together and your right speaker will work on both sides.

Jens Erat
  • 5,051
  • 7
  • 31
  • 37
0

On an Asus X551MA I was having this problem as soon as I replaced Windows with Ubuntu 14.04. Even if I muted the speakers in aslamixer, they would come back on unexpectedly.

When I got to step three in this troubleshooting procedure, that seems to have fixed everything. It's a long complicated command which installed various packages, so I'm not sure which part(s) were really necessary:

sudo apt-get update;sudo apt-get dist-upgrade; sudo apt-get install pavucontrol linux-sound-base alsa-base alsa-utils lightdm ubuntu-desktop linux-image-`uname -r` libasound2; sudo apt-get -y --reinstall install linux- sound-base alsa-base alsa-utils lightdm ubuntu-desktop linux-image-`uname -r` libasound2; killall pulseaudio; rm -r ~/.pulse*; ubuntu-support-status; sudo usermod -aG `cat /etc/group | grep -e '^pulse:' -e '^audio:' -e '^pulse- access:' -e '^pulse-rt:' -e '^video:' | awk -F: '{print $1}' | tr '\n' ',' | sed 's:,$::g'` `whoami`
Brian Z
  • 663
  • 6
  • 17
0

Simply just go to the alsamixer (alsamixer in terminal) and use the right/left arrow keys to navigate to the speakers setting and click M. This will disable the speakers but not the headphones.

Rhys
  • 1
0

This worked for me (Ubuntu 14.04 LTS running on Compaq NC6120 laptop):

  1. Ctrl+Alt+T (to open terminal)
  2. Type alsamixer
  3. Press until you get to the "Headphone Jack Sense" option
  4. Press m to enable (automatically mute the speakers when headphone is plugged in)
TheOdd
  • 3,012
XqRG
  • 1