Headphone jack not reliably detecting on Ubuntu 20.04

21,823

Solution 1

Open your terminal and run these

pulseaudio --kill 
pulseaudio --start

This solved my problem in Ubuntu 20.04. But unfortunately there should be automatic detection, which is not working. Slightly disappointed

Solution 2

On ubuntu 20.04 below steps worked

1) Alsa and timidity-daemon

More here.

sudo apt-get install --reinstall alsa-base pulseaudio
sudo alsa force-reload
sudo apt purge timidity-daemon

2) Auto set output and mic based on Jack events

sudo apt install alsa-tools-gui
sudo hdajackretask

Then follow options

set Radio button of Parser hints and

  • jack_detect = yes
  • trigger_sense = yes
  • primary_hp = yes
  • multi_io = yes
  • add_hp_mic = yes
  • then Press >> "Apply now" & Press >> "Install boot override"
reboot

Read on all option of Hint Strings here.

Solution 3

Using alsactrl you can reload the driver state from configuration file using :

sudo alsactl restore

This solution is only temporary, meaning you will need to do this every time you plug-in your headphones.

Solution 4

Be aware that the problem might not be software-related — it could be hardware-related.

Many headphones have inbuilt microphones and, as a result, the headphone jack has one more contact than those that do not have inbuilt microphones.

headphone jacks with and without microphone support

If the socket on your computer is expecting one type of jack, and you plug in the other type of jack, then you may not end up with a 'clean' contact. If there is no clean contact, then the OS (via the audio subsystem) may either not recognise what you have inserted, or not recognise that you have inserted anything at all.

In the majority of cases where hardware is at fault, folks plug in a jack with two central bands (headphones with microphone support) into a socket expecting only one central band (headphones only). To test to see if this is your problem, find a plain headphone jack (only one central band) and plug/unplug that sucker repeatedly. If that behaves normally, but your two-band jack doesn't, then you know what the problem is.

PS: Whether or not you actually use the microphone is irrelevant. The issue is simply one of electrical metal-on-metal connections when you physically plug the jack into the socket. Due to manufacturers adhering to standards to varying degrees, and manufacturing tolerances being all over the place, we do not live in a perfect world where these things 'just work' as they are supposed to.

Share:
21,823

Related videos on Youtube

Matthew Miller
Author by

Matthew Miller

Updated on September 18, 2022

Comments

  • Matthew Miller
    Matthew Miller over 1 year

    The issue that I'm having is that headphones plugged into the 3.5mm jack on the front of my desktop computer are not always detected. I'm running Ubuntu 20.04 on a custom built computer with a B450 Tomahawk motherboard. I'm certain that the issue is with Ubuntu 20.04 because the issue was not occurring (as far as I'm aware) when the same computer was running 18.04.

    The steps to create my problem are:

    1. Be running computer with headphones disconnected using another audio output.
    2. Simply plug headphones into computer but headphones don't appear in sound settings.
    3. By suspending and unsuspending the computer, the problem is usually fixed and headphones will now appear in sound settings.

    Some things that I've tried:

    Any help would be greatly appreciated!

  • Natolio
    Natolio over 2 years
    Is logging out and back in again your answer to the question? Or did you find something else? Your answer does not provide much help if not.
  • Community
    Community over 2 years
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
  • Force
    Force about 2 years
    Thanks, that did help on my MSI board as well.
  • Admin
    Admin almost 2 years
    Hi, I just read through the comments here. How does it address the issue? The topic of this thread is that the headphone jack isn't reliably detected. And that's the problem that I'm dealing with as well. When I am inside a session, plug out the headphone jack and then plug in again, the headphone jack wouldn't be reliably detected. Logging out and logging in again "fixes" that, so at least I can use my earphones. I'm using the MSI B450 Gaming Plus mainboard and a fairly recent BIOS version 7B86v1D (Ubuntu 20.04.4 LTS).