Sometimes no sound on Lenovo Thinkpad W541 headphones, speakers fine

Hello dear Arch users

I recently got started with Arch Linux on a Lenovo Thinkpad W541. Everything has been working neatly and the Arch Wiki has helped a lot. But there is one thing I can't fix: I sometimes (only sometimes) have no sound on my headphones.

The headphones are plugged in via a 3.5mm jack on the left side. They work fine with other devices.

The laptop's speakers play sounds just fine without any issues.

What I have tried:- read at dozens of forum threads,- the ALSA/OSS/PULSE Wiki pages,- I have tried uncommenting lines below "Element Headphone" in "/usr/share/pulseaudio/alsa-mixer/paths/*",- adding "options snd-hda-intel model=thinkpad" (also with "model=lenovo" and "model=auto") in a "/etc/modprobe.d/alsa-base.conf" file,- check volume levels in "alsamixer" and "pavucontrol" (in both cases, headphones are unmuted and levels are at 100%, pavucontrol even shows a moving sound bar, but I can't hear any sounds through the headphones),- playing with the "Auto-Mut" setting from the sound card in "alsamixer", but it didn't fix my missing sound issue.

I had tried with hdajackretask without success as well. Maybe I didn't understand how to properly use hdajackretask though. I tried removing the battery, but that didn't solve it for me.

At the moment, I have a workaround that makes the headphones work for me:I boot the PC with the headphones plugged out, I wait till I reach the login screen (I'm using Slim), then I plug the headphones in, then I login. And then the headphones work.

I have this same issue on W540. One fix that I have noted to work roughly 90% of the time is to start pavucontrol right after logging in, this seems to enable the output on the headphones (you can hear a pop and the headphones start to have a slight noise). This would indicate that the actual hardware is not properly enabling the headphone output.

Has anyone figured out a way to force the hardware to enable the output, or even ways to diagnose this issue as I cant find anything abnormal from the software side of things, just no sound coming out of the headphone jack.

@Scifi: I've figured out a way that works quite well for me now. Maybe it can help you figure out an even better way for yourself.

I have completely uninstalled PulseAudio. This effectively means I can't use some applications that require it, but all applications I need go directly through the native "ALSA" driver.

Then, I put this in my ~/.asoundrc file (if this file does not exist on your system, simply create it):

pcm.!default {
type hw
card 1
}
ctl.!default {
type hw
card 1
}

Finally, I need to unplug my headphones before shutting down my laptop. And I need to not plug them in until after I've turned on the laptop and logged in successfully. If I do that, I have sound in the headphones, every time.

If I forget to unplug the headphones before shutting down, or I plug them in too soon, I don't have any sound. In that case, here's what I do to get back to normal: I unplug the headphones, shut down the laptop, remove the power cable and unplug the battery for a few seconds. Then I turn on the laptop, log in and plug the headphones in.

This is not perfect, obviously, but it is reliable.

Let us know if you figure out a better solution (maybe one that works well with Pulse Audio ?).

Your problem is that the sound is sent to the HDMI output per default...

Test this:- do you have sound on your HDMI monitor when the sound does not work on your laptop?- do you have sound on your laptop when you unplug the HDMI monitor? - does "aplay -l" return HDMI as card "0" and PCI as card ="1" ?

If so, you need to prioritize the sound outputs the way you want them... PCI > HMDI instead of HDMI > PCI (default) (read the link I posted above).

It turns out the issue on my Thinkpad came from IRST, which I disabled and replaced with delayed hibernation. It's actually way faster than IRST, since it doesn't copy 12GB from RAM to disk and back, and doesn't mess with the sound card for some reason.

Anyway, two of my biggest annoyances fixed in one go. It's a good day.