Volume at login set to Maximum after a reboot

Bug #598308 reported by buddyd16
148
This bug affects 31 people
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Fix Released
High
Ricardo Salveti
Trusty
Fix Released
High
Ricardo Salveti

Bug Description

Release: Ubuntu 10.04 64-bit Desktop Edition

What You Expected to Happen: System volume to remain as set before reboot and as shown in volume panel applet
What Happened Instead: After reboot/shutdown at and after login system volume is set to maximum

Extended Description:

Intel HD Audio Chipset using S/PDIF coax out to speakers and system audio set to digital output

After either rebooting or shutting down my system at the next login the system volume will be set to maximum. Once the panel loads I can click on the system volume applet and if I move the volume slider in any direction the volume will immediately be set to the correct level.

**MORE INFO 6/25/10**

This also affects the system alert volume in the same fashion as above. Adjusting the slider for the alert value via the panel applet reset the volume to the correct level.

LTS Stable Update:

[Impact]
 * Volume at the maximum level after a reboot

[Test Case]
1. (logged in system running)slide volume to 75% using system volume applet on panel
2. reboot
3. Login,
4. login soundbite plays at 100% volume
5. open rhythmbox play audio track system volume at 100%
6. click on system volume panel applet, do not click slider, slider shows volume set at 75% as before reboot <---- This is the odd part
7. click on volume slider and adjust in either direction system volume abruptly adjusts to match the volume level indicated by the slider.

[Regression Potential]
 * Small, just restoring the volume in case the device only has sw volume support

[Other Info]
 * Patch already available in upstream

buddyd16 (donnieb)
description: updated
description: updated
priya (priyamtk)
affects: ubuntu → libgtk2-ex-volumebutton-perl (Ubuntu)
Revision history for this message
Ansgar Burchardt (aburch) wrote :

This does not seem to be related to libgtk2-ex-volumebutton-perl.

affects: libgtk2-ex-volumebutton-perl (Ubuntu) → ubuntu
Revision history for this message
buddyd16 (donnieb) wrote :

Forgive me if I misspeak as I am still very new to using linux but it seems that this may be a problem with pulseaudio and its interaction with alsa on startup. When I run alsa-mixer in terminal at startup the volume levels indicated match that of those displayed on the slider in the panel applet. So it seems pulseaudio is acting independent of my system settings at startup rather than dependently.

affects: ubuntu → pulseaudio (Ubuntu)
Revision history for this message
buddyd16 (donnieb) wrote :

It seems a recent update to pulseaudio has fixed my issue. Updated my system yesterday, june 12, which also came with a kernel update which prompted a reboot per usual and volume levels seem to be normal now after reboot and after a shutdown and restart.

Revision history for this message
Aaddron (aaddron) wrote :

I have pretty much word for word the exact same issue except updates didn't fix it. Are you sure it was the updates that fixed it and not something else?

Revision history for this message
buddyd16 (donnieb) wrote :

It doesn't appear to have been completely fixed but the volume is no longer at a maximum when I reboot now it is however still louder than what it should be.

Revision history for this message
Aaddron (aaddron) wrote :

I'm getting the same behaviour, Ubuntu 10.10 32-bit also happens in 64-bit. Before I found this report I made one for this issue with what I've noticed so far, I marked it a duplicate of this bug. Here's the link:

https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/661885

So far I've determined this started a couple release cycles ago, pretty sure it was 9.10 and is only specific to Ubuntu, I haven't experienced this bug is non-Ubuntu distro's. Also I'm pretty sure it has to do with PulseAudio or at least is related to it. Kubuntu was effected until 10.10, in the release notes for 10.10:

"Kubuntu now uses the PulseAudio sound server by default. Building on the efforts of Ubuntu over the last several release cycles"

The bug started several release cycles ago and Kubuntu wasn't effected until it started using Ubuntu audio work this release.

It's a vary odd bug as the sound difference isn't reflected anywhere.

Revision history for this message
Daniel T Chen (crimsun) wrote :

@Aaddron Your symptom isn't precisely the same as the cause for this bug. If you're using KMix (or any environment that uses KMix, e.g., Kubuntu), you have a stale KMix configuration file. Please remove it and cycle your login.

Revision history for this message
Aaddron (aaddron) wrote :

I'm new to this so if you say so but how is my bug report not a duplicate of his? Both running Ubuntu and we both have described the same issue. That sounds a lot like a duplicate to me.

The only reason I brought up Kubuntu was because I found it odd that Kubuntu worked fine until this release when they added some of Ubuntu's audio work(what would be the correct term for this?) and that this bug started around the same time Ubuntu started working on PulseAudio.

Revision history for this message
Daniel T Chen (crimsun) wrote : Re: [Bug 598308] Re: Volume at login set to Maximum

KMix handles restoring of volume state *in addition* to pulse. Can you
reproduce this symptom from a boot of the Kubuntu10.10 live cd?

Revision history for this message
Aaddron (aaddron) wrote : Re: Volume at login set to Maximum

Yes and like Ubuntu moving the volume slider even slightly fixes it until rebooting, also forgot to say that you can log out and back in without issue it's only after booting.

Revision history for this message
Daniel T Chen (crimsun) wrote : Re: [Bug 598308] Re: Volume at login set to Maximum

Please note that volumes being set to max is a design decision of
PulseAudio; see http://pulseaudio.org/wiki/PulseAudioStoleMyVolumes

Revision history for this message
buddyd16 (donnieb) wrote : Re: Volume at login set to Maximum

Based on how the volume reacts when I adjust it via the tray icon and the values that show up in alsamixer it seems there is some kind of disconnect between pulse and alsa. Based on the page you linked pulse goes through and adjusts the alsa channel levels at startup, shouldn't these adjustments be reflected when running alsamixer?

Revision history for this message
Aaddron (aaddron) wrote :

I'm sure PCM being set to max by default isn't the cause of this. Using the directions in a workaround for another bug I set PulseAudio to only control the Master pipeline and then lowered PCM in alsamixer... this lower the volume of the "bugged" sound but as soon as you move the volume slider sound is too quiet because PCM needs to be maxed for good sound levels, at least on my system it does. Either way the bug still happened.

Besides that this bug exist in no other distro other than Ubuntu and Ubuntu based ones, if it was something PulseAudio does by default or design it would effect all of the other distros. I can't find even one other one that is effected.

Revision history for this message
Aaddron (aaddron) wrote :

I have an idea for a workaround but have no idea how to do it or even if it's possible. Make a script that runs during boot or maybe right after log in that adjust the volume by +1 or -1 automatically... in theory this would "fix" the issue and the change in volume would be so slight it would be like it never changed.

Revision history for this message
Aaddron (aaddron) wrote :

Not that I'd expect any different as it's only Alpha 1 but this bug is still around in 11.04 Alpha 1.

Revision history for this message
Aaddron (aaddron) wrote :

I finally found a fix for my bug! As they are vary similar, possibly even the same it might work for you too, here's what I did:

sudo gedit /etc/pulse/daemon.conf

add a ; and a space to these four lines:

resample-method = speex-float-1
flat-volumes = no
default-fragments = 8
default-fragment-size-msec = 10

Every other line in the file should already have a ; and a space

After a restart the bug was gone.

Revision history for this message
Andrew Helwer (andrew-helwer) wrote :

This bug has terrorized my hearing for a while - I use headphones through an external soundcard, and I've nearly deafened myself several times forgetting to slightly adjust the volume before listening to music.

Aaddron, you solution worked great! Just tested it. I hope there are no side effects, but for now I'm keeping my daemon.conf file all commented out.

Revision history for this message
Aaddron (aaddron) wrote :

Small update, you only need to put the ; before flat-volume = no.

Glad it worked for you!

Montblanc (montblanc)
Changed in pulseaudio (Ubuntu):
status: New → Confirmed
Revision history for this message
Montblanc (montblanc) wrote :

I followed Aaddron's suggestion in comment #18 and then #16 but I had no luck. Using Creative Sound Blaster X-Fi on Kubuntu Natty i386.

Revision history for this message
Montblanc (montblanc) wrote :

Just found a working fix for my hardware: tell Pulse to control just one mixer control.

1. edit /etc/pulse/default.pa
2. uncomment the line that says

#load-module module-alsa-sink

3.change it to

load-module module-alsa-sink control=PCM

4. save & reboot

Revision history for this message
Geoff Williams (geoff-geoffwilliams) wrote :

I've been affected by this too:

Kubuntu 11.04 amd64
kmix 4:4.6.2-0ubuntu2

Comment #7 fixed it for me.

After doing rm ~/.kde/share/config/kmix* and cycling , was saved. Thanks!

Revision history for this message
Matt Pharoah (mpharoah) wrote :

I started being affected by this after installing the JACK audio plugin for pulseaudio in synaptic. The problem persists, however, after I have purged the previouslyy mentioned packaged.

Revision history for this message
Stefan Lithén (spacebug-se-deactivatedaccount) wrote :

I started to get this problem when I put in a new soundcard.

The new soundcard is "Asus Xonar DX".

The alsa volumes are restored as they should but pulse volume is set to like 100% but the slider in "ubuntu/unity 12.04" is set to what is was before reboot.
Just changing the slider a little bit sets the correct voume to pulseserver.

I have also this issue in KDE.

Revision history for this message
Nasa (tsx-5) wrote :

I am also having this issue. I am using an USB Creative X-FI 5.1 sound card. I having flat-volumes "on" just made matters worse as every new song played moved to 100% and having it "off" leaves things like the basic description. The other suggestions also didn't resolve the issue for me.

Revision history for this message
Ryan Press (ryan-nryiuoo) wrote :

I have this same problem. Upon reboot Digital Output (S/PDIF) volume is always set to maximum.

I think I've traced it to the pulse module "module-device-restore". Attached is a log, loglevel=4. I can see that module-device-restore opens the TDB file, but I never see in the log something like "Restoring volume for sink %s" like I would expect, by looking at the source.

Revision history for this message
twipley (smt-infp) wrote :

I also am affected by this bug. (Xonar DX)

Revision history for this message
mrtwister (mrtwister) wrote :

In my case the package pulseaudio-equalizer (or depencencies) from ppa:nilarimogard/webupd8 caused this issue. After removing, the problem is solved.

Revision history for this message
Raymond (superquad-vortex2) wrote :

>> Intel HD Audio Chipset using S/PDIF coax out to speakers and system audio set to digital output

do your HDA codec SPDIF has volume control ???

Changed in pulseaudio (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Raymond (superquad-vortex2) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for pulseaudio (Ubuntu) because there has been no activity for 60 days.]

Changed in pulseaudio (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

I can also confirm this issue, and affects ubuntu touch. After the device is booted, when playing something, it'll always be set to maxium, even though pactl list sinks shows the right volume

Once I change volume up or down, it gets to the right and expected volume level (abruptly changing the volume).

In my case:
Sink #1
 State: SUSPENDED
 Name: sink.primary
 Description: Droid sink primary
 Driver: module-droid-card.c
 Sample Specification: s16le 2ch 44100Hz
 Channel Map: front-left,front-right
 Owner Module: 7
 Mute: no
 Volume: 0: 15% 1: 15%
         0: -49.44 dB 1: -49.44 dB
         balance 0.00
 Base Volume: 100%
              0.00 dB
 Monitor Source: sink.primary.monitor
 Latency: 0 usec, configured 0 usec
 Flags: HARDWARE DECIBEL_VOLUME LATENCY
 Properties:
  device.description = "Droid sink primary"
  device.class = "sound"
  droid.hw_module = "primary"
  device.icon_name = "audio-card"
 Ports:
  output-earpiece: Output to earpiece (priority: 200)
  output-speaker: Output to speaker (priority: 300)
  output-wired_headset: Output to wired headset (priority: 400, not available)
  output-wired_headphone: Output to wired headphone (priority: 400, not available)
  output-bluetooth_sco: Output to bluetooth sco (priority: 100)
  output-sco_headset: Output to sco headset (priority: 100)
  output-sco_carkit: Output to sco carkit (priority: 100)
  output-aux_digital: Output to aux digital (priority: 100)
  output-analog_dock_headset: Output to analog dock headset (priority: 100)
  output-digital_dock_headset: Output to digital dock headset (priority: 100)
  output-fm_tx: Output to fm tx (priority: 100)
  output-speaker+wired_headphone: Output to speaker+wired headphone (priority: 100)
  output-parking: Parking port (priority: 50)
 Active Port: output-speaker
 Formats:
  pcm

This is already enough to set the right value:
phablet@ubuntu-phablet:~$ pactl set-sink-volume sink.primary 16%

Changed in pulseaudio (Ubuntu):
status: Expired → Confirmed
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Tracking down the pa_sink_set_volume call (which is what pactl set-sink-volume uses), the original sink had the correct real volume, but a wrong soft_volume (as in my use case the driver/hw is not providing hardware volume support). The soft_volume was actually at the max volume, which is the initial value provided by pa_sink_new.

Follows the dbg info from the first call to pa_sink_set_volume call (via pactl):

Breakpoint 1, pa_sink_set_volume (s=s@entry=0x821c8, volume=volume@entry=0xbeffeeb4, send_msg=send_msg@entry=true, save=save@entry=true) at pulsecore/sink.c:1990
1990 pulsecore/sink.c: No such file or directory.
(gdb) p *s
$1 = {parent = {parent = {_ref = {value = 2}, type_id = 0xb6fb036c <pa_sink_type_id> "pa_sink", free = 0xb6f82ffd <sink_free>, check_type = 0xb6f81859 <pa_sink_check_type>}, process_msg = 0xb11eb29d <sink_process_msg>}, index = 1, core = 0x38350,
  state = PA_SINK_SUSPENDED, flags = (PA_SINK_LATENCY | PA_SINK_HARDWARE | PA_SINK_DECIBEL_VOLUME), suspend_cause = PA_SUSPEND_IDLE, name = 0x82df8 "sink.primary", driver = 0x82f78 "module-droid-card.c", proplist = 0x827b0, module = 0x44c48, card = 0x6c020,
  sample_spec = {format = PA_SAMPLE_S16LE, rate = 44100, channels = 2 '\002'}, channel_map = {channels = 2 '\002', map = {PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT, PA_CHANNEL_POSITION_MONO <repeats 30 times>}}, default_sample_rate = 44100,
  alternate_sample_rate = 48000, inputs = 0x829c8, n_corked = 0, monitor_source = 0x83788, input_to_master = 0x0, base_volume = 65536, n_volume_steps = 65537, reference_volume = {channels = 2 '\002', values = {9830, 9830, 0 <repeats 30 times>}}, real_volume = {
    channels = 2 '\002', values = {9830, 9830, 0 <repeats 30 times>}}, soft_volume = {channels = 2 '\002', values = {65536, 65536, 0 <repeats 30 times>}}, muted = false, refresh_volume = false, refresh_muted = false, save_port = false, save_volume = true,
  save_muted = false, saved_volume = {channels = 0 '\000', values = {0 <repeats 32 times>}}, saved_save_volume = false, asyncmsgq = 0x61378, silence = {memblock = 0xb23fc000, index = 0, length = 65496}, ports = 0x81d28, active_port = 0x61aa8, mixer_dirty = {value = 0},
  latency_offset = 0, priority = 9000, set_state = 0x0, get_volume = 0x0, set_volume = 0x0, write_volume = 0x0, get_mute = 0x0, set_mute = 0x0, request_rewind = 0x0, update_requested_latency = 0x0, set_port = 0xb11eb9a5 <sink_set_port_cb>, get_formats = 0x0,
  set_formats = 0x0, update_rate = 0x0, thread_info = {state = PA_SINK_SUSPENDED, inputs = 0x83038, rtpoll = 0x60d78, soft_volume = {channels = 2 '\002', values = {65536, 65536, 0 <repeats 30 times>}}, soft_muted = false, requested_latency_valid = false,
    requested_latency = 0, max_rewind = 0, max_request = 0, rewind_nbytes = 0, rewind_requested = false, min_latency = 500, max_latency = 10000000, fixed_latency = 23311, latency_offset = 0, volume_changes = 0x0, volume_changes_tail = 0x0, current_hw_volume = {
      channels = 2 '\002', values = {9830, 9830, 0 <repeats 30 times>}}, volume_change_safety_margin = 1, volume_change_extra_delay = 0}, userdata = 0x60cc8}

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

So this is the call trace I'm getting with my device:
1) module specific (droid in my case) -> pa_sink_new
2) pa_sink_new fires up PA_CORE_HOOK_SINK_FIXATE before finishing setting up the sink, giving the original data (pa_sink_new_data) to the callback;
3) module-device-restore gets PA_CORE_HOOK_SINK_FIXATE and calls sink_fixate_hook_callback, updating the real volume for pa_sink_new_data, and setting up save_volume;
4) pa_sink_new then correctly sets reference_volume and real_volume, getting it from pa_sink_new_data (which was used by module-device-restore)
5) pa_sink_new initializes soft_volume with the max value, causing this broken behavior

Code:
src/pulsecore/sink.c:
 169 /* Called from main context */
 170 pa_sink* pa_sink_new(
 171 pa_core *core,
 172 pa_sink_new_data *data,
 173 pa_sink_flags_t flags) {
 174
...
 285 s->reference_volume = s->real_volume = data->volume;
 286 pa_cvolume_reset(&s->soft_volume, s->sample_spec.channels);
...

At the time you call pactl set-sink-volume (or set the volume via the indicator), it'll call sink_port_hook_callback that will call pa_sink_set_volume, which will then set the real_volume and soft_volume to the same value (as my driver is not providing the set_volume callback.

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

As a test I created the following patch, that fixes the initial broken behaviour for my driver/hw:

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index ccf6ea1..0f1a0b8 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -283,7 +283,10 @@ pa_sink* pa_sink_new(
     s->input_to_master = NULL;

     s->reference_volume = s->real_volume = data->volume;
- pa_cvolume_reset(&s->soft_volume, s->sample_spec.channels);
+ if (data->save_volume)
+ s->soft_volume = data->volume;
+ else
+ pa_cvolume_reset(&s->soft_volume, s->sample_spec.channels);
     s->base_volume = PA_VOLUME_NORM;
     s->n_volume_steps = PA_VOLUME_NORM+1;
     s->muted = data->muted;

Here data->save_volume will be true if module-device-restore was called before getting to this block (with the right volume restored as real_volume).

Now just need to discuss with upstream to see what would be the right fix.

Revision history for this message
Raymond (superquad-vortex2) wrote :

how do user know pulseaudio really save the sound setting ?

any program which dump those pulsraudio database file to verify the sound setting is really saved ?

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

That depends if module-device-restore is load in your env (it is by default).

You can check the volume database at ~/.config/pulse/<hash>-device-volumes.tdb

Revision history for this message
Raymond (superquad-vortex2) wrote :

do pulseaudio save volume setting of all ports ?

if headphones were plugged during shutdown

but unplugged before next boot

will pulseaudio restore the speaker volume ?

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Yes, module-device-restore saves the volume per port/sink.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:4.0-0ubuntu19

---------------
pulseaudio (1:4.0-0ubuntu19) utopic; urgency=medium

  * 0210-module-device-restore-adding-property-to-skip.patch:
    - Adding property to skip device store/restore per sink/source
  * 0211-fix-volume-max-boot.patch:
    - Fix initial volume for sink (LP: #598308)
  * 0207-Enable-pulseaudio-droid.patch:
    - Adding support to track voice call volume when switching to the
      voicecall mode
 -- Ricardo Salveti de Araujo <email address hidden> Wed, 20 Aug 2014 15:15:16 -0300

Changed in pulseaudio (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Ryan Press (ryan-nryiuoo) wrote :

I can confirm that this fixes the problem for me, thanks!

Revision history for this message
Matt Hanyok (matthew-hanyok) wrote :

Sorry for adding a comment to a 'fix released' bug, but, is there a plan for the updated pulseaudio package to get backported to 14.04? I just checked and it's on 1:4.0-0ubuntu11 with nothing in the updates repository.

It would be nice to have this fix available for LTS.

Revision history for this message
Matt Hanyok (matthew-hanyok) wrote :

Anyone? Chance of a backport to the current LTS release? It'd be nice to have this fix included before 16.04.

Revision history for this message
Eric Vlasov (eric-vlasov) wrote :

I second this, a package for 14.04 would be highly welcome as at this moment my Xonar card is just laying on a shelf without any use.

summary: - Volume at login set to Maximum
+ Volume at login set to Maximum after a reboot
description: updated
no longer affects: pulseaudio (Ubuntu Utopic)
Changed in pulseaudio (Ubuntu Trusty):
status: New → In Progress
Changed in pulseaudio (Ubuntu):
assignee: nobody → Ricardo Salveti (rsalveti)
Changed in pulseaudio (Ubuntu Trusty):
assignee: nobody → Ricardo Salveti (rsalveti)
Changed in pulseaudio (Ubuntu):
importance: Undecided → High
Changed in pulseaudio (Ubuntu Trusty):
importance: Undecided → Critical
importance: Critical → High
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello buddyd16, or anyone else affected,

Accepted pulseaudio into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/pulseaudio/1:4.0-0ubuntu11.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in pulseaudio (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Dan Rice (dnrce) wrote :

This update fixed the bug for me.

Tested pulseaudio 1:4.0-0ubuntu11.1 (amd64).

Hardware is Intel Corporation 82801I (ICH9 Family) HD Audio Controller, using S/PDIF digital (coaxial) output.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:4.0-0ubuntu11.1

---------------
pulseaudio (1:4.0-0ubuntu11.1) trusty; urgency=medium

  * 0107-sink-source-Fix-restore-of-volume-on-devices-without.patch:
    - Fix initial volume for sink (LP: #598308)
 -- Ricardo Salveti de Araujo <email address hidden> Wed, 28 Jan 2015 16:17:08 -0200

Changed in pulseaudio (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Adam Conrad (adconrad) wrote : Update Released

The verification of the Stable Release Update for pulseaudio has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.