On my laptop (Ubuntu 12.04 LTS) arose out of the blue the following problem: After seemingly a random number of seconds the sound switches to the headphone jack and switches off the speakers. If I close the lid and wait for a few seconds, open it then there is speaker sound again for some seconds. Same thing after rebooting. I have tried everything including fresh install of Ubuntu, install, fresh install of the soundcard driver, alsamixer, pulsaudio and so on. Now here comes the funny part: the same thing happens under Window 8.1 (I use a dual boot system). So logically it must be a hardware problem. In some way the soundcard must be broken. Since I hardly can believe my own theory I am wondering if I am missing something here?
It is definitely a hardware failure. I opened the laptop and put it on its right side. Problem gone! On the left side or horizontal: problem remains. So it must be a faulty PCB, IC, connector. Impossible to find. Anyway thanks to the people who have thougt about this.