Ubuntu – No sound from speakers, but headphones work


I have had a problem with my sound for a while now. Sound comes from my headphones, but not from my speakers. I am running Ubuntu 11.10 on a Compaq 320. I have searched around, but none of the threads have worked, some had made it worse (no sound at all, but I managed to get back to where I am now).
Any help would on how to fix this would be great.

Best Answer

try using these commands

sudo apt-get update
sudo apt-get upgrade
sudo apt-get purge linux-sound-base alsa-base alsa-utils
sudo apt-get install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop


if this not help trying running this script