I had this really annoying problem, where the headphone jack would work fine after a cold start. But after suspending or cold rebooting (restart the computer without completely shutting it down) the headphone jack would stop working.

The system detects, when headphones are being plugged in and out, but there is just no sound coming out of the headphones anymore.

I am experiencing this only under Ubuntu 14.04 (under my Windows partition it works fine) on a XMG A305 Laptop. It seems like this problem is related to the drivers used with my soundcard (Card: HDA Intel PCH, Chip: VIA VT1802) or the interaction between different drivers.

Also, there have been several other people experiencing this on other machines: Bugreport for Clevo Laptop


After searching for quite a while, I have come up with a solution that works well for me and might help you too:

The code is mostly taken from here.

Get the code

There exists a python script that can reactivate the headphone jack. This code is taken from ektor5 on GitHub. You need to download the script, place it somewhere where your system finds it and make it executable. You can do all this with this line:

sudo wget https://raw.githubusercontent.com/ektor5/init-headphone/master/init-headphone -O /usr/local/sbin/init-headphone && sudo chmod +x /usr/local/sbin/init-headphone

Install dependencies

The init-headphone script needs dependencies that can be installed with:

sudo apt-get install python-smbus

Add grub flag

Also, your kernel has to be started with an additional flag enabled. You can do this by editing the file ''/etc/default/grub''. Alter this line


to this


After that run

sudo update-grub

Load modules at start up

Additionally, the script needs to modules to be loaded. Namely ´i2c_dev´ and ´i2c_i801´. These can be loaded at runtime with

modprobe i2c_dev
modprobe i2c_i801

You can now test whether it works, by running ´sudo init-headphone´.

To automatically load the modules on startup, add the following lines to ''/etc/modules'':


Create startup script

Last of all, we want the script to run automatically, when our computer reboots or returns from suspension. To do so, place the following script in ´/etc/pm/sleep.d/´.

sudo gedit /etc/pm/sleep.d/init-headphone

Add the following lines


if [ ! -x /usr/local/sbin/init-headphone ]; then
    exit 0

case $1 in

And don't forget to make the file executable

sudo chmod +x /etc/pm/sleep.d/init-headphone

I hope this helps, let me know if you have any problems.


  • Excelent! That works perfectly in my Avell laptop! – Lucas Teske Sep 17 '17 at 3:36

Ran into this same issue just recently while using Fedora 32. The script that @cbandera mentions works great. For my OS, however, the automation needed to be done through systemd.

I created a service file

sudo gedit /etc/systemd/system/init-headphone.service

and placed the following in the file

Description=Initialize headphones upon resume
After=suspend.target hibernate.target hybrid-sleep.target suspsend-then-hibernate.target


WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target

Then I enabled the service

sudo systemctl enable init-headphone

After that everything worked.


You might try checking your volume control panel to see if it's just resetting to standard speakers. If so you could either script it to restart, or manually set it back to headphones.

  • Thanks for the hint. I had tried that, and it would certainly let me select the headphone jack, but there was just no sound coming out of the headphones. The system even detected, when headphones were plugged in and out.... – cbandera Feb 25 '16 at 9:38

I'm not sure which version of Linux you are using but consider trying the relevant equivalent of sudo apt-get install gstreamer followed by running gstreamer-properties via command line and see if there are any unusual settings between pulse audio and alsa regarding your headphones etc.

(I've used this on older Ubuntu based systems to get headphone settings to work for skype etc)

  • It's Ubuntu 14.04. The package can be installed with ´sudo apt-get install gstreamer-tools´. I have run it, but everything looks fine. This might of course be because of the changes I have applied already. Hard to tell now. – cbandera Feb 25 '16 at 9:53
  • If these are usb headphones you might look to see if the kernel you are using supports them. Otherwise since your system recognizes them as plugged in you could try switching the sound system to pulse or alsa just to see what works better from resume. (I'd guess pulse audio typically but alsa has pretty decent hardware detection) – Brian Taylor Feb 25 '16 at 10:08
  • I am using normal headphones on the 3.5mm jack. I think I had tried switching between pulse and alsa already, bit I can't recall right now. I had tried X different solutions I had found all over the net for the last 3 months. The answer posted above was the only solution that worked. – cbandera Feb 25 '16 at 11:32

Adding to the excellent answer from @cbandera: For systems using systemd (e.g. Ubuntu 15.04 or later), the startup script should be /lib/systemd/system-sleep/init-headphone and look like this:


[ -x /usr/local/sbin/init-headphone ] || exit 0

[ "$1" = "post" ] && /usr/local/sbin/init-headphone

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.