alsa-utils cannot always restore mixer settings correctly across upgrades

Bug #21804 reported by Juerd
92
This bug affects 6 people
Affects Status Importance Assigned to Milestone
alsa-utils (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

The problem is that the alsa-utils package inadequately handles changes in
the mixer interface from one kernel version to another. On shutting down
the mixer state is stored in /var/lib/alsa/asound.state. After booting
with the new kernel, "alsactl restore" tries to feed this asound.state to
the (new 'n' improved) driver and the driver gags because the mixer
descriptions have changed.

/etc/init.d/alsa-utils already runs alsactl with the "-F" option in an
attempt to deal with this, but apparently that is not good enough.

It would be nice if alsactl and the driver dealt with this problem in a
better way.

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

I have an X41 model 2527, and sound works fine with it.

Please attach the output from ''amixer''.

Revision history for this message
Juerd (ubuntu-juerd) wrote :

Created an attachment (id=3900)
Output from amixer

Revision history for this message
Juerd (ubuntu-juerd) wrote :

Attached as requested. My model is 2525 - this shouldn't matter. Are you using
the same kernel version? It did work for me in earlier kernels (2.6.10, from
hoary). It may not be clear because it's only in the title, and not in the
comment, but the kernel in which it doesn't work is 2.6.12-8.

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

Simple mixer control 'Headphone Jack Sense',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]

                 ^^^^ This needs to be muted as it is on mine.

This is a difficult problem to resolve, as a search through Bugzilla for
dist-upgrades between Hoary and Breezy regarding ALSA reveals. Technically it
should be assigned to alsa-utils, not linux, because on state restoration the
mixer is important not the modules.

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

(In reply to comment #3)
> Attached as requested. My model is 2525 - this shouldn't matter. Are you using
> the same kernel version? It did work for me in earlier kernels (2.6.10, from
> hoary). It may not be clear because it's only in the title, and not in the
> comment, but the kernel in which it doesn't work is 2.6.12-8.

I'm using 2.6.12-8.13, and it works fine. See the fix I stated in the previous
reply.

Revision history for this message
Juerd (ubuntu-juerd) wrote :

Flipping that bit helped. Thanks a lot! Music again! Woohoo.

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

More to the issue: When Hoary was installed, sound worked by default, correct?
You didn't need to (un)mute any mixer elements, correct? Then when Breezy was
installed, after you rebooted into 2.6.12, this mixer element was unmuted, correct?

Revision history for this message
Juerd (ubuntu-juerd) wrote :

All correct. I started changing things (though not this particular item, or any
other item in kmix's "Switches" tab) only after realizing there was no sound
anymore.

Revision history for this message
Kevin Tappe (kevintappe-deactivatedaccount) wrote :

I had the same problem on my IBM T43:
Headphone Jack Sense AND Line Jack Sense need to be muted to make it work again.

Revision history for this message
Thomas Hood (jdthood) wrote :

The problem is that the alsa-utils package inadequately handles changes in
the mixer interface from one kernel version to another. On shutting down
the mixer state is stored in /var/lib/alsa/asound.state. After booting
with the new kernel, "alsactl restore" tries to feed this asound.state to
the (new 'n' improved) driver and the driver gags because the mixer
descriptions have changed.

/etc/init.d/alsa-utils already runs alsactl with the "-F" option in an
attempt to deal with this, but apparently that is not good enough.

It would be nice if alsactl and the driver dealt with this problem in a
better way.

alsa-utils should be changed so that instead of doing a mere
"alsactl restore" it takes the following steps in the "start"
method (on boot):

     Move old asound.state to asound.state_PREV
     Run "alsactl store" to create new asound.state
     Run asound.state through a processor which sets "sane"
       default values without changing the structure of the file
     Use the values in asound.state_PREV to update the values in
       the new asound.state without changing the structure of
       the file
     Run "alsactl restore"

Mandriva already does something like this.

Any volunteers to implement this? ;)

Revision history for this message
Thomas Hood (jdthood) wrote :

*** Bug 21765 has been marked as a duplicate of this bug. ***

Revision history for this message
Mike Goldman (whig) wrote :

*** Bug 24002 has been marked as a duplicate of this bug. ***

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

*** Bug 24011 has been marked as a duplicate of this bug. ***

Revision history for this message
Thomas Hood (jdthood) wrote :

It appears from #17858 that this bug can cause plug:spdif not to work.
(I am not sure why.)

Matt Zimmerman (mdz)
description: updated
Changed in alsa-utils:
assignee: jdthood → nobody
Revision history for this message
Justin Mason (jm-ubuntu) wrote :

this is still an issue in current dapper; it just bit me after a routine kernel update/reboot.

The error I got was:

: jm 73...; sudo /etc/init.d/alsa-utils start
Password:
 * Setting up ALSA...
 * warning: 'alsactl restore' failed with error message 'alsactl: set_control:894: warning: name mismatch (External Amplifier/Headphone Jack Sense) for control #26
alsactl: set_control:896: warning: index mismatch (0/0) for control #26
alsactl: set_control:898: failed to obtain info for control #26 (Operation not permitted)'...
   ...done.

It was quite tricky to fix, unfortunately, since on my hardware (Thinkpad T40) enabling "Line Jack Sense" inhibits all audio output as a side-effect; attempting to manually recreate a working alsamixer setup led me to switch that on (out of ignorance of the side-effects).

An automatic, script-based recreation of a "sane" mixer setup would have avoided that mis-step.

Revision history for this message
Kevin Otte (nivex) wrote :

This bug is a year and change old, and there have been three releases since it was filed. Safe to close?

Revision history for this message
NeoFax (neofax99) wrote :
Download full text (17.2 KiB)

I am having the problem with Jaunty. I just upgraded from the 2.6.28-12 to 2.6.28-13 kernel and sound does not work. Here is the error from sudo invoke-rc.d alsa-utils restart:

 * Shutting down ALSA... [ OK ]
 * Setting up ALSA... * warning: 'alsactl restore' failed with error message 'alsactl: set_control:1400: Cannot write control '2:0:0:Four Channel Mode:0' : Operation not permitted'... Invalid card number.
Usage: amixer <options> [command]
Available options:
  -h,--help this help
  -c,--card N select the card
  -D,--device N select the device, default 'default'
  -d,--debug debug mode
  -n,--nocheck do not perform range checking
  -v,--version print version of this program
  -q,--quiet be quiet
  -i,--inactive show also inactive controls
  -a,--abstract L select abstraction level (none or basic)
  -s,--stdin Read and execute commands from stdin sequentially
Available commands:
  scontrols show all mixer simple controls
  scontents show contents of all mixer simple controls (default command)
  sset sID P set contents for one mixer simple control
  sget sID get contents for one mixer simple control
  controls show all controls for given card
  contents show contents of all controls for given card
  cset cID P set control contents for one control
  cget cID get control contents for one control
Invalid card number.
Usage: amixer <options> [command]
Available options:
  -h,--help this help
  -c,--card N select the card
  -D,--device N select the device, default 'default'
  -d,--debug debug mode
  -n,--nocheck do not perform range checking
  -v,--version print version of this program
  -q,--quiet be quiet
  -i,--inactive show also inactive controls
  -a,--abstract L select abstraction level (none or basic)
  -s,--stdin Read and execute commands from stdin sequentially
Available commands:
  scontrols show all mixer simple controls
  scontents show contents of all mixer simple controls (default command)
  sset sID P set contents for one mixer simple control
  sget sID get contents for one mixer simple control
  controls show all controls for given card
  contents show contents of all controls for given card
  cset cID P set control contents for one control
  cget cID get control contents for one control
Invalid card number.
Usage: amixer <options> [command]
Available options:
  -h,--help this help
  -c,--card N select the card
  -D,--device N select the device, default 'default'
  -d,--debug debug mode
  -n,--nocheck do not perform range checking
  -v,--version print version of this program
  -q,--quiet be quiet
  -i,--inactive show also inactive controls
  -a,--abstract L select abstraction level (none or basic)
  -s,--stdin Read and execute commands from stdin sequentially
Available commands:
  scontrols show all mixer simple controls
  scontents show content...

Revision history for this message
arkmundi (rkerver) wrote :

Confirm problems in Jaunty, upgrading to 2.6.28-13 kernel. Please advance importance to High. Many people are experiencing this problem. Am now running without sound awaiting a fix via normal updgrade path. Thank you!

Revision history for this message
LimCore (limcore) wrote :

I had this problem as well (few days ago on ubuntu 9.04 amd64)

Revision history for this message
Nilbus (nilbus) wrote :

I am also experiencing this problem.

The volume levels are not properly restored on boot, though they are restored if I run alsactl restore, even though the error message is displayed.

$ sudo alsactl restore
alsactl: set_control:1400: Cannot write control '3:0:0:EMU10K1 PCM Send Routing:0' : Operation not permitted
alsactl: set_control:1400: Cannot write control '3:0:0:EMU10K1 PCM Send Volume:0' : Operation not permitted

$ sudo service alsa-utils start
 * Setting up ALSA...
 * warning: 'alsactl restore' failed with error message 'alsactl: set_control:1400: Cannot write control '3:0:0:EMU10K1 PCM Send Routing:0' : Operation not permitted
alsactl: set_control:1400: Cannot write control '3:0:0:EMU10K1 PCM Send Volume:0' : Operation not permitted'...
Invalid card number.
Usage: amixer <options> [command]
... (amixer error message repeated many times)

Revision history for this message
Nilbus (nilbus) wrote :

I should mention that I am running a fresh install of Jaunty

Revision history for this message
Philip Gottschling (goddisignz) wrote :

Running fresh Karmic Mythbuntu

warning: 'alsactl restore' failed with error message 'alsactl: set_control:1389: Cannot write control '2:0:0:Four Channel Mode:0' : Operation not permitted'...

Revision history for this message
sukumar (wittyguysuku) wrote :

My sound is muted and when I tried:
sudo service alsa-utils restart
 * Shutting down ALSA... [ OK ]
 * Setting up ALSA... * warning: 'alsactl restore' failed with error message 'alsactl: set_control:1389: Cannot write control '2:0:0:Analog/Digital Output Jack:0' : Operation not permitted
alsactl: set_control:1389: Cannot write control '3:0:0:IEC958 Playback Default:0' : Operation not permitted'... ...done.

But I can hear the sound for a moment (say 1 sec), when running the above command.
Has this problem is fixed?

Revision history for this message
Daniel T Chen (crimsun) wrote : Re: [Bug 21804] Re: alsa-utils cannot always restore mixer settings correctly across upgrades

@sukumar Which Ubuntu release?

Revision history for this message
Jan Braunisch (x-r6) wrote :

I'm running kubuntu karmic and sound worked well until one reboot (i dont know if i had installed a new kernel before rebooting) when kmix and amarok said the sound card is not present and not working (i remember seeing both not present and not working)

root@j:~# /etc/init.d/alsa-utils restart
 * Shutting down ALSA... [ OK ]
 * Setting up ALSA... * warning: 'alsactl restore' failed with error message 'alsactl: set_control:1389: Cannot write control '3:0:0:EMU10K1 PCM Send Routing:0' : Operation not permitted
alsactl: set_control:1389: Cannot write control '3:0:0:EMU10K1 PCM Send Volume:0' : Operation not permitted'... ...done.

i tried removing /var/lib/alsa/asound.state but it didn't make anything better

lspci shows:
00:0d.0 Multimedia audio controller: Creative Labs SB Audigy (rev 04)

it's an Audigy2, i wonder why it doesn't say

root@j:~# uname -a
Linux j 2.6.31-16-generic #53-Ubuntu SMP Tue Dec 8 04:02:15 UTC 2009 x86_64 GNU/Linux

root@j:~# rm /var/lib/alsa/asound.state
root@j:~# alsactl restore
alsactl: load_state:1569: Cannot open /var/lib/alsa/asound.state for reading: No such file or directory
Unknown hardware: "Audigy2" "SigmaTel STAC9721,23" "AC97a:83847609" "0x1102" "0x1007"
Hardware is initialized using a guess method
/usr/share/alsa/init/default:51: control element not found
/usr/share/alsa/init/default:52: missing closing brace for format
/usr/share/alsa/init/default:52: error parsing CTL attribute
/usr/share/alsa/init/default:52: invalid rule

i hope this proves useful for someone!

jan

Revision history for this message
Colin Watson (cjwatson) wrote :

alsa-utils (1.0.23-2ubuntu2) maverick; urgency=low

  * debian/init: Restore change from 1.0.21-1ubuntu2 lost during merge
    that skips muting and zeroing levels prior to shutdown/reboot,
    which was a hack for broken drivers. This change closes LP: #21804,
    LP: #208920, #227505, #360108, #432660, #449783, #553132, #564472,
    LP: #584609, #592016, #596360, #613054, #617516, #622487, #632019.
  * debian/patches/alsactl_init_update_to_52bd2f8a_head.patch: Add
    upstream git changesets:
    dcb90a77 - Use "Found hardware:" instead "Unknown hardware:"
    7f6a55e2 - use "generic method" instead "guess method"
    52bd2f8a - Handle "Capture Source" and "Mic Boost"
    ef919a47 - Initialize also "Master Front Playback Volume" & "Switch"
    (yes, this last changeset is included despite the patch filename)

 -- Daniel T Chen <email address hidden> Sun, 05 Sep 2010 11:57:59 -0400

Changed in alsa-utils (Ubuntu):
status: Confirmed → Fix Released
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.