Bug 11642 - After install, pulseaudio configured to send sound to headphone jack
Summary: After install, pulseaudio configured to send sound to headphone jack
Status: RESOLVED INVALID
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: i586 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Colin Guthrie
QA Contact:
URL:
Whiteboard: 4beta2
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-11 14:19 CET by Dave Hodgins
Modified: 2014-02-28 17:16 CET (History)
6 users (show)

See Also:
Source RPM: pulseaudio-5.0-0.20131010.3.mga4.src.rpm
CVE:
Status comment:


Attachments
pacmd ls output (23.79 KB, text/plain)
2013-11-14 11:45 CET, Dave Hodgins
Details
pacmd ls output under Mageia 3 (23.79 KB, text/plain)
2013-11-14 20:37 CET, Dave Hodgins
Details
pacmd ls output showing HDMI only (18.03 KB, text/plain)
2013-11-17 13:21 CET, Edgar Johansen
Details

Description Dave Hodgins 2013-11-11 14:19:20 CET
After installing from the beta1 kde live cd, the system wasn't producing sound.
Right click on kmix, selecting audio setup, I noticed that the connector was
set to the unplugged headphone jack. Changing it to the line output
corrected the problem.

I'm not sure if this is a pulseaudio, kde, or live iso config problem.



Reproducible: 

Steps to Reproduce:
Dave Hodgins 2013-11-11 14:20:13 CET

CC: (none) => eeeemail, mageia

Dave Hodgins 2013-11-11 14:20:50 CET

Whiteboard: (none) => 4beta1

Comment 1 Colin Guthrie 2013-11-12 11:54:41 CET
hmmm, module-device-restore will restore the port of anything manually selected, but this should not include headphone port switches which should be automatic and not trigger a save. Can you kill PA or make sure it's not running (you likely have to do it via a tty login after a fresh boot), mv the ~/.pulse/*-device-volumes.tdb file out the way and then restart to see if this "solves" the problem?

Can you also check the timestamps etc. on the tdb file initially to see if they correspond to some time that would have been live on the live boot and copied across?

Did you have headphones plugged in at any point?
Colin Guthrie 2013-11-12 11:55:02 CET

Assignee: tmb => mageia

Comment 2 Dave Hodgins 2013-11-14 04:21:37 CET
I don't have any headphones, so no.

Same thing is now happening doing a kde install from the i586 classical
installer dvd. Sound was set to hdmi, instead of built in audio. After
switching it to built in, connector was set to headphones.
Dave Hodgins 2013-11-14 04:22:07 CET

CC: (none) => ennael1

Dave Hodgins 2013-11-14 04:22:32 CET

Summary: After install from kde livecd, pulseaudio configured to send sound to headphone jack => After install, pulseaudio configured to send sound to headphone jack

Comment 3 Colin Guthrie 2013-11-14 08:53:33 CET
Can you provide the output of "pacmd ls". I suspect a kernel jack-detection bug.
Comment 4 Dave Hodgins 2013-11-14 11:45:24 CET
Created attachment 4508 [details]
pacmd ls output
Comment 5 Colin Guthrie 2013-11-14 11:51:38 CET
That's weird.

None of your ports are actually available.


	ports:
		analog-output-lineout: Line Out (priority 9900, latency offset 0 usec, available: no)
			properties:
				
		analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: no)
			properties:
				device.icon_name = "audio-headphones"
	active port: <analog-output-headphones>

Do you actually have something plugged into the lineout port? If so then the jack detection is indeed busted. Regardless, it should still be the default used as it's priority is the highest.
Comment 6 Dave Hodgins 2013-11-14 20:37:57 CET
Created attachment 4509 [details]
pacmd ls output under Mageia 3

I have amplified speakers connected to the built-in audio output, and
once I change the setting to use line out, it's working. It's been working
in Mageia 4, with auto detection, up until the latest builds.
Comment 7 Colin Guthrie 2013-11-15 09:58:11 CET
OK, so I've been studying the code this morning and the default port selection is definitely based on priority numbers - the higher the better.

So *something* is definitely messing with things.

If you could do a test that would be most awesome:

1. Fresh boot, switch to text console and login.
2. Confirm PA is NOT running for your user (it's OK if it's running for GDM) and rm -f all the tdb files in ~/.pulse/ This is kinda like simulating a fresh user account.
3. cp /etc/pulse/default.pa to your ~/.pulse/ folder.
4. Edit it and remove/comment the line: load-module module-switch-on-port-available
5. Then logout and back in as normal, but do not load any KDE GUIs.
6. Confirm PA is started.
7. Confirm the modules is not loaded (pacmd list-modules | grep switch)
8. Check which port is selected via pacmd list-sinks (look for the right card and the active_port: identifier.
9. I really hope it has the line out selected.
10. If 9 is as I hope, reboot, and repeat steps 1 and 2, but this time rm the ~/.pulse/default.pa file created in 3 and login again. Do steps 5, 6 and 8.
11. If things are still OK, then start the KDE GUI and see if it's actually IT that changes the port.


It's really just a matter of trying to narrow down which part of the puzzel sets this value to the wrong one.

Thanks!
Comment 8 Dave Hodgins 2013-11-15 23:34:07 CET
I'm not sure what you mean by step 5, since a normal login starts kde,
so I logged in, with the edited file in ~/.pulse, and the sound worked,
so I didn't bother with steps 7 and 8.

I then rebooted, logged into a tty to delete the default.pa, switched
back to kdm, and logged in, and the active port was switched back to
<analog-output-headphones>.
Comment 9 Edgar Johansen 2013-11-17 12:49:36 CET
Here is an observation that could be related.

Booting from the live beta 1 KDE x86_64 DVD iso. Speakers are connected to the analog output. Nothing is connected to HDMI (monitor is on DVI).

KMix audio setup | Device preference shows only "Built-in Audio Digital Stereo (HDMI)". No sound is heard. (Mageia 3 shows "Built-in Audio Analog Stereo" here and it works out of the box.)

Choosing Audio hardware setup | Profile "Analog stereo output" adds "Built-in Audio Analog Stereo" to Device preference below HDMI. Still no sound, probably playing to the unconnected HDMI.

Moving Analog stereo up above HDMI in Device preference gives sound to the speakers.

CC: (none) => arberg

Comment 10 Colin Guthrie 2013-11-17 12:57:30 CET
That's certainly a curious observation Edgar.

The list should show all sinks. So it would suggest that the something is certainly broken there - it will not show different ports until they are selected so it seems to me that the h/w you have actually shares HDMI and analog out on the same sink (some h/w does do this).

Can you post your "pacmd ls" output too please so I can have a closer look at your h/w. Ideally after a fresh boot from the live ISO.
Comment 11 Edgar Johansen 2013-11-17 13:21:40 CET
Created attachment 4513 [details]
pacmd ls output showing HDMI only

Added "pacmd ls" output after a fresh boot from Mageia 4 beta 1 KDE live iso.
Comment 12 Colin Guthrie 2013-11-17 13:42:31 CET
OK, so due to your h/w setup, it's somewhat expected that the KDE list only shows one device by default.

What is certainly NOT expected is that it defaults to the HDMI output....


The card in question supports HDMI as a profile not as a totally separate card. Only when HDMI is supported via a different card will both show up initially in the KDE list. This isn't ideal but it's how it works for now in KDE.

Anyway, looking at the problem, it seems that the profile with the highest priority is NOT the default:

	profiles:
		input:analog-stereo: Analog Stereo Input (priority 60, available: unknown)
		output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
		output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060, available: unknown)
		output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5400, available: unknown)
		output:hdmi-stereo+input:analog-stereo: Digital Stereo (HDMI) Output + Analog Stereo Input (priority 5460, available: unknown)
		output:hdmi-stereo-extra1: Digital Stereo (HDMI) Output (priority 5200, available: unknown)
		output:hdmi-stereo-extra1+input:analog-stereo: Digital Stereo (HDMI) Output + Analog Stereo Input (priority 5260, available: unknown)
		off: Off (priority 0, available: unknown)
	active profile: <output:hdmi-stereo-extra1+input:analog-stereo>


Here you can see that the active profile is actually one with a priority value of 5260. This is basically somewhere in the middle of priorities.

As I don't have h/w that works like this I think it's important to work out what component is causing this, but I'm not 100% sure how best to do it....

Here are some tests that would be useful:

1. Login. Don't open any KDE GUIs. Quit kmix.
2. rm -f .pulse/*.tdb
3. killall -9 pulseaudio
4. run "start-pulseaudio-x11"
5. run "pacmd list cards"

Does the active profile read "output:analog-stereo+input:analog-stereo" (i.e. the one with the highest priority? If so then this is how it should be. If it's still wrong, then stop here and I'll ask some different quesionts.

If it's correct, run: start-pulseaudio-kde. Do "pacmd list cards" again. Is the device now incorrect?

Run kmix. Is the device now incorrect?

Run the KMix audio setup | Device preference GUI. Is this now showing the correct device?


The problem I'm having is that all the individual bits for deciding which is the correct initial output all seem to be working OK individually but somehow seem to break when used together. I'm pretty sure the tests described above will work OK and correct which will deepen this mystery!
Comment 13 Colin Guthrie 2013-11-17 14:17:02 CET
Also one further test, could you run the same tests on the GNOME live DVD? Or rather just boot and see if it's affected? The only difference in the PA setup should be that GNOME doesn't run start-pulseaudio-kde than thus doesn't load module-device-manager. Looking at this code I cannot see how this could affect things as this module does not have any code to change the card profile.

My current best guess is some kind of low level KDE ALSA probing that happens outside of PA that makes PA *think* the HDMI profile is currently active and thus that is what PA uses and saves for the future.
Comment 14 Edgar Johansen 2013-11-17 14:32:17 CET
(In reply to Colin Guthrie from comment #12)

Colin, I have tested, but may have misunderstood something.

> Here are some tests that would be useful:
> 
> 1. Login. Don't open any KDE GUIs. Quit kmix.

The KDE desktop opens, but I have not opened any KDE applications, if that is what you mean. Quit kmix.

> 2. rm -f .pulse/*.tdb

There is no directory named /home/live/.pulse

> 3. killall -9 pulseaudio

Done, but it seems to respawn automatically. It still runs, but with another pid.

> 4. run "start-pulseaudio-x11"

Done.

> 5. run "pacmd list cards"
> 
> Does the active profile read "output:analog-stereo+input:analog-stereo"
> (i.e. the one with the highest priority? If so then this is how it should
> be. If it's still wrong, then stop here and I'll ask some different
> quesionts.

It is still wrong, but that could be due to pulseaudio still running after trying to kill it.

I will download and test the Gnome version.
Comment 15 Colin Guthrie 2013-11-17 14:48:31 CET
(In reply to Edgar Johansen from comment #14)
> > 1. Login. Don't open any KDE GUIs. Quit kmix.
> 
> The KDE desktop opens, but I have not opened any KDE applications, if that
> is what you mean. Quit kmix.

Perfect.

> > 2. rm -f .pulse/*.tdb
> 
> There is no directory named /home/live/.pulse

Ahh. Perhaps I'm getting my folders messed up. Can you check ~/.config/pulse/ for any *.tdb files? I should double check this myself really... If no *.tdb files exist then this is OK too.

> > 3. killall -9 pulseaudio
> 
> Done, but it seems to respawn automatically. It still runs, but with another
> pid.

Yeah, sorry this is expected and OK. The important part was for it to not write any *.tdb files (hence the kill -9 to prevent it writing them again during a graceful kill)

> > 4. run "start-pulseaudio-x11"
> 
> Done.
> 
> > 5. run "pacmd list cards"
> > 
> > Does the active profile read "output:analog-stereo+input:analog-stereo"
> > (i.e. the one with the highest priority? If so then this is how it should
> > be. If it's still wrong, then stop here and I'll ask some different
> > quesionts.
> 
> It is still wrong, but that could be due to pulseaudio still running after
> trying to kill it.

No, it will restart and that's OK (and needed for pacmd to work!).

The important part is to clear out any saved config (in the tdb files) and let it start up "fresh".

As it's still wrong one of three things is happening:

A. It's loading it's saved config from a tdb file in a different folder (e.g. ~/.config/pulse/)
B. It's taking the current configuration of the h/w and preserving it - e.g. if it's currently set to HDMI, then it will keep it that way. This could mean a problem with the initial init of the h/w state.
C. Something else interferes.

As a secondary test:

1. run "pactl set-card-profile 0 output:analog-stereo+input:analog-stereo"
2. Check that a tdb file was written (might be up to two or three seconds later) in ~/.pulse/ or ~/.config/pulse/ and rm it. If one doesn't appear something is strange!
3. Repeat the previous test from "killall -9 pulseaudio" onwards.

By doing this we'll test B above. If PA restarts and the h/w is still in a nice state, we know it's not loading it from config as we rm'ed the file so we know it's preserving the current state of the h/w. You can double confirm this by doing the same test again but this time setting the profile to: "pactl set-card-profile 0 output:hdmi-stereo+input:analog-stereo" and see if that "sicks" passed the rm of the tdb and restart of PA.

If however, in both cases it reverts back to the HDMI again, then it feels very much like something else is interfering.

If it is the problem then we need to check the very first initialisation of alsa state to see if we're perhaps initialising the card badly on very first boot.

> I will download and test the Gnome version.

Thanks!
Comment 16 Edgar Johansen 2013-11-17 16:20:16 CET
More test results:

(In reply to Colin Guthrie from comment #13)

> Also one further test, could you run the same tests on the GNOME live DVD?

Also on Gnome, "pacmd list cards" shows HDMI as active profile and there is no sound.

On "Configure sound", "HDMI / DisplayPort 2 - Built-in Audio" is preselected. Selecting "Speakers - Built-in Audio" enables sound.

(In reply to Colin Guthrie from comment #12)

> 1. Login. Don't open any KDE GUIs. Quit kmix.

Done

> 2. rm -f .pulse/*.tdb

rm -f .config/pulse/*.tdb

> 3. killall -9 pulseaudio

Done

> 4. run "start-pulseaudio-x11"

Done

> 5. run "pacmd list cards"
> 
> Does the active profile read "output:analog-stereo+input:analog-stereo"
> (i.e. the one with the highest priority? If so then this is how it should
> be. If it's still wrong, then stop here and I'll ask some different
> quesionts.

Still wrong, active profile shows HDMI.

(In reply to Colin Guthrie from comment #15)

> As a secondary test:

Login
Quit KMix
rm -f .config/pulse/*tdb

> 1. run "pactl set-card-profile 0 output:analog-stereo+input:analog-stereo"

Done

> 2. Check that a tdb file was written (might be up to two or three seconds
> later) in ~/.pulse/ or ~/.config/pulse/ and rm it. If one doesn't appear
> something is strange!

No tdb files!

> 3. Repeat the previous test from "killall -9 pulseaudio" onwards.

"pacmd list cards" shows HDMI.
Comment 17 Colin Guthrie 2013-11-17 19:16:41 CET
Thank you for all the tests :)

The fact that the gnome dvd does the same seems to suggest that we somehow inherit the state of the system and pick that. It's all very confusing tho' as I'm not sure I can see the code that does this :s

I think I need to get my hands on some hardware that is similar to this and see if I can poke about a bit personally, as it's the kind of problem that really needs properly poking around.

I'm not really convinced this issue is new however as there have been similar reports for a while about this.

The headphones issues this bug was originally about does seem new, but the root cause could be the same.

Dave, out of curiosity, does the same thing happen for you on this h/w under a gnome install (or a live dvd which I guess should exhibit the same problem).
Comment 18 Dave Hodgins 2013-11-18 12:47:44 CET
Yes. Using the gnome x86-64 live dvd, the active port is set to the
analog headphone.
Comment 19 Liam Quin 2013-12-03 05:42:20 CET
I'm not sure if it's related, but I find on my HP elitepack (both with mageia 3 and now in cauldron) that the sequence
1. listen with headphones
2. close lid of laptop (suspend)
3. remove headphones
4. open lid again
leaves the sound on Headphones until I plug headphones into the jack and then remove them again.

This in GNOME 3.

CC: (none) => liam

Comment 20 Colin Guthrie 2013-12-03 10:14:14 CET
(In reply to Liam Quin from comment #19)
> I'm not sure if it's related, but I find on my HP elitepack (both with
> mageia 3 and now in cauldron) that the sequence
> 1. listen with headphones
> 2. close lid of laptop (suspend)
> 3. remove headphones
> 4. open lid again
> leaves the sound on Headphones until I plug headphones into the jack and
> then remove them again.
> 
> This in GNOME 3.

This is an interesting one, but I *think* it's not related. It is likely a bug that needs fixing tho'. I'll mention it to David who wrote the jack-detection stuff to see if he's had any reports about this and thoughts on how to fix.
Comment 21 Dave Hodgins 2013-12-08 16:40:24 CET
Still happens with Mageia 4 beta2, after installing kde from the x86_64 dvd.

Whiteboard: 4beta1 => 4beta2

Comment 22 Colin Guthrie 2013-12-08 16:44:28 CET
This is going to be nigh on impossible for me to fix unless I can reproduce it with h/w here and so far I've not been able to :(
Comment 23 Dave Hodgins 2013-12-09 00:33:44 CET
We can document how to workaround it in the errata, but it is annoying that it
was working previously, and isn't now
Comment 24 Colin Guthrie 2013-12-09 00:59:33 CET
Oh, don't get me wrong, I'm planning on trying to fix it. Was just stating that I don't think it'll change until I can get some hardware that I can reproduce this on....
Comment 25 Dave Hodgins 2014-02-06 05:25:27 CET
I don't understand what has changed, but I have found a workaround.

I moved the jack for the amplified sound system from the black jack,
which I understand is supposed to be used for such a sound system, to
the green jack, which I understand is supposed to be used for headphones.

It now is working, so I'm going to close this bug as invalid.

Very strange, as it's been working for years using the black jack,
prior to Mageia 4.

Even though the speakers are now connected to what I understand is the
headphone jack, the kde audio setup now shows that as line out, whereas
before, it was showing that the plug was "unplugged".

Not sure if we should add something to the errata for this, or not. I
haven't noticed anyone else reporting this problem, though I've not been
able to keep up with the bugs mailing list, so have had to delete a lot
of the messages, unread.

Status: NEW => RESOLVED
Resolution: (none) => INVALID

Comment 26 Samuel Verschelde 2014-02-28 17:16:27 CET
I think I got this problem on my laptop. I would have to plug and unplug the headphones in order to get the speakers to produce sound.

Having disabled pulseaudio for now, I don't have this problem anymore but I could test.

CC: (none) => stormi


Note You need to log in before you can comment on or make changes to this bug.