Headphones disable system audio

Whenever I plug my headphones in after starting Audacity the audio stops working while they’re plugged in, including on all other programs running. If I unplug the headphones, the speaker audio continues playback properly. But, plugging the headphones back in kills the audio again. This problem doesn’t occur with any other program I use that plays audio (e.g., VLC, lmms, browser-embedded video, etc.), just Audacity. When the headphone audio is killed under Audacity, headphones are also subsequently killed for any other program that plays audio, until I reset it (i.e.,

alsactl init

)… again, just for headphones, not speakers. I’ve had this problem before on this computer (Dell Precision 7710), even with earlier Ubuntu versions. I love Audacity and used to use it regularly on an earlier machine, but playback via speakers isn’t as helpful as with headphones, so this is a big problem. This seems like an Audacity problem, but it may be related to sound settings. Any ideas?

Ubuntu Bionic (18.04), Audacity 2.2.1-1 (software repository)

What sort of headphones?
What happens if you plug in the headphones before you launch Audacity?

Thanks for the command “alsactl init”, that saved me from restarting my computer to get the headphone working again. I have the same problem on Ubuntu 18.04 with Audacity 2.2.1 and 2.2.2. I can play music with or without headphone using VLC or hearing system sound just fine, but when Audacity starts with a headphone (tested with Grado SR60i, Audio Technica CKR70, and Audio Technica CKR30), I hear a loud thud on the headphone as if it was probing/resetting then no sound can play through the earphone/headphone anymore until I restart the system (or “alsactl init”), but laptop’ speaker still works fine.

I can confirm that if I start Audacity with no headphone plugged in, the problem doesn’t happen, I can plug the headphone in later and hear well in Audacity. But if Audacity starts with the headphone plugged, the problem will happen.

dmesg doesn’t show any message related to the event. My laptop is Dell 7567 with GTX 1050Ti, and I don’t have audio through HDMI working yet. I get “snd_hda_codec_hdmi hdaudioC1D0: out of range cmd” in syslog sometimes.

Forgot to mention that when the problem happens after starting Audacity with headphone plugged, I can just run “alsactl init” without closing Audacity and the headphone will work in Audacity again.

While the problem is in effect, system and other players (VLC, Videos) and Audacity don’t seem to be aware of it. They all play the audio normally, displaying the level bars normally, it’s just no sound is heard on the headphone.

What settings are you using in the device toolbar?

Google brought me here while searching for a solution to this exact same problem.
alsactl init fixes the problem when it happens.
Does anyone have a permanent fix?