Have SONY VIAO Desktop Computer, and installed UBUNTU 14.0 and then upgraded to UBUNTU 16.04 LTS Version June 2018. Sound only works from "Headphone" Jack port. Have tried setting to Digital Output (S/PDIF)..no luck. Tried Simultaneous output to Built-in Audio Analog Stereo...sound works better, but only on "Headphone" Port with external speakers plugged in, and volume is way too low to hear well. Cannot get the built in Stereo Speakers to work at all no matter what setting is tried. Computer originally had Windows XP Professional OS, and stereo speakers worked great until systems wiped and changed to UBUNTU.
Possibly an outdated audio driver. Try updating your drivers.
Open a terminal (Ctrl + Alt + T) and paste the following code :
sudo apt-get update sudo apt-get install --reinstall ubuntu-restricted-extras