Your problem may be related to Ubuntu not detecting all your speakers correctly. I solved all sound related problems on my Zenbook (UX390UA) by editing:
sudo nano /usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common
and changing this section:
[Element PCM]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
Into this:
[Element Master]
switch = mute
volume = ignore
[Element PCM]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element LFE]
switch = mute
volume = ignore
save (with Ctrl+x) and restart pulse audio:
pulseaudio -k
I had the same problem. Following these instructions got my headphones working.
Open the terminal and enter the following commands:
cd /usr/share/pulseaudio/alsa-mixer/paths/
sudo cp analog-output-headphones.conf analog-output-headphones.bak
sudo nano analog-output-headphones.conf
Look for the section called [Element Speaker] and change it so that it looks like this:
[Element Speaker]
switch = on
volume = ignore
Save the changes and exit nano.
Create a backup of the corrected analog-output-headphones.conf:
sudo cp analog-output-headphones.conf analog-output-headphones.fixed
Now you can restore the fix if a future installation or update overwrites it.
Reboot.
After rebooting, you may need to remove and reinsert the headphone plug to get it to work. After it's working, though, you will be able to remove and insert the plug, and behavior will be as expected.
I've tried all these responses. Here is the ONLY way that worked for me (and it was remarkably quick... after spending hours on all the other suggestions!). Go into Terminal, and simply key this in:
$ alsactl restore
And that's that! :)