upstart task alsa-restore has no effect

Bug #926688 reported by Jochen Fahrner
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
alsa-utils (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

There is a upstart task 'alsa-restore' which should restore the alsa state to the state that was saved with upstart task 'alsa-store'.

This does not work. It looks like there is some other task that initializes alsamixer to its default state AFTER alsa-restore is run.

There is a help page which recommends running 'alsactl restore' in the users startup applications:
https://help.ubuntu.com/community/MacBook5-1/Natty

This should not be necessary if the upstart task 'alsa-restore' was working right.

I suggest find the task that is initializing alsamixer to its default state and eliminate this, or delay alsa-restore until the initialization was done.

This happens in latest Natty release, but I think this problem also exits in Oneiric because this problem exists as far as I can remember.

Revision history for this message
Jochen Fahrner (jofa) wrote :

I did some more testing on this topic. My Macbook has a optical audio out which is on by default. I want it to be off, so the led is not always on. I turned S/PDIF off in alsamixer and stored it with 'alsactl store'.

I created a script /usr/local/bin/alsarestore:

#!/bin/sh
sleep 15
/sbin/alsactl restore

I changed /etc/init/alsa-restore.conf to execute my script instead of running alsactl directly.

I watched the led during boot and stopped the time the led was on. On boot the led turned on at some stage, then was on for 8 seconds and then switched off by my script.

This means: 7 seconds after upstart task alsa-restore was invoked, some process initiliazed alsa and turned S/PDIF on. 8 seconds later (the sleep was 15 seconds) my script turned it off again.

So the whole process of alsa-store and alsa-restore does not work as designed. It was designed to store the current state of alsamixer on shutdown, and restore it on bootup.

The workaround to restore the state in users startup applications only works if all users have this workaround in their startup, and if a user logs in after boot. I you boot the system and shut it down immediately without logging in (from the gdm screen), then this process is broken because the default settings are stored through alsa-store. From now on the settings you made are lost.

Steve Langasek (vorlon)
affects: upstart (Ubuntu) → alsa-utils (Ubuntu)
Revision history for this message
Luke Yelavich (themuso) wrote : Re: [Bug 926688] [NEW] upstart task alsa-restore has no effect

Have you tried disabling pulseaudio, as that may be the second volume change here. To disable pulseaudio, open /etc/pulse/client.conf, and set autospawn to no. Thsi will prevent pulseaudio from being loaded both in the login session, and when you log into your user session.

Revision history for this message
David Henningsson (diwic) wrote :

In addition to Luke's very valid comment, alsa-restore is either being run by a udev rule or by the upstart script, this is to cover for a race between filesystem being mounted and device being probed.

Revision history for this message
Jochen Fahrner (jofa) wrote :

I tried what Luke suggested, setting autospawn to no in /etc/pulse/client.conf. This way the alsamixer settings remain as they were stored. So pulseaudio must be resetting the mixer settings to its defaults.

What does this autospawn=no mean? Has it any disadvantages?

Revision history for this message
David Henningsson (diwic) wrote :

Disabling pulseaudio will make the sound indicator, the media keys, the standard volume control stop working, and will only enable one application at a time to output sound. And more.

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in alsa-utils (Ubuntu):
status: New → Confirmed
Revision history for this message
lester cram (lestercram) wrote :

Just installed Mint xfce and having same problem with maintaining sound settings. Pulse audio wiki gives this.

Pulseaudio usually overwrites the ALSA settings- for example set with alsamixer- at start up, even when the alsa daemon is loaded. Since there seems to be no other way to restrict this behaviour, a workaround is to restore the alsa settings again after pulseaudio had started. Add the following command to .xinitrc .bash_login or any other autostart file:

restore_alsa() {
 while [ -z "`pidof pulseaudio`" ]; do
  sleep 0.5
 done
 alsactl -f /var/lib/alsa/asound.state restore
}
restore_alsa &
could not find either of these filed but appended to end of user .profile and it works.
Would adding this to .profile programatically solve the issue

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

Other bug subscribers

Remote bug watches

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