I would first check to see if Ubuntu is detecting both (Headphones and Speakers) in the system settings:
If you see something like one the following images, then you know both were detected:
In my case I have support for my headphones and my stereo output. If in one case I would like to disable sound for the speaker, I would first select the output I want to disable and then disable the option (Marked by the green circle). This way sound will not come out of that output connection. The same goes for input devices. Here is another image of how 12.10 looks. Notice that I have both, the Speakers connection (Analog Output) and the Headphones:
The same case applies here. You select the device you want to mute and click on the mute button.
For cases where this options do not show or sound is still coming from the speakers when you have your headphones connected then follow this steps:
Type in dash
ter for short and press Enter
In the terminal type
alsamixer and press Enter
Inside the alsa mixer app, using your arrow keys, move left or right to any of the options that will show in your mixer window. Pressing up or down you can adjust the volume for that specific connection or pressing M you can mute the connection. What you will be doing here is looking for the one that mutes your speakers but leaves your headphones still with sound.
Now for your case, it seems your headphones are not getting detected correctly. The only option your computer shows is "Speakers" which are the internal ones. When you connect the headphones, the sound comes out of both (Speakers and Headphones) because it thinks they are the same. If you have already upgraded Ubuntu I would suggest to see what the command
dmesg outputs. Type
dmesg on a terminal and see if there is anything related to sound.
UPDATE: After looking at your dmesg and other information (Provided by Mr Jeeblez himself) and seeing that you have the Intel 5 Series/3400 Series Chipset High Definition Audio, searching I found a bug report that was made for said motherboard. You can find the bug report in
The solution was to do the following:
In the terminal type:
sudo gedit /etc/modprobe.d/alsa-base.conf
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
Save and Reboot.
NOTE: If this does not work, change in the second line the part about:
model=dell-m4-1 --> model=hp-m4.