Subject: alsa-utils: alsa-restore.service uses /run wiich is tmpfs
Date: Thu, 17 Aug 2017 21:22:26 +0200
Package: alsa-utils
Version: 1.1.3-1
Severity: normal
Dear Maintainer,
*** Reporter, please consider answering these questions, where appropriate ***
* What led up to the situation?
modified values with alsamixer are not restored at boot
* What exactly did you do (or not do) that was effective (or
ineffective)?
use alsamixer
reboot
* What was the outcome of this action?
cursors are not well restored
* What outcome did you expect instead?
same values than before the boot
i modify to use /var/lib/alsa
cat /lib/systemd/system/alsa-restore.service
#
# Note that two different ALSA card state management schemes exist and they
# can be switched using a file exist check - /etc/alsa/state-daemon.conf .
#
[Unit]
Description=Save/Restore Sound Card State
Documentation=man:alsactl(1)
ConditionPathExists=!/etc/alsa/state-daemon.conf
ConditionPathExistsGlob=/dev/snd/control*
After=alsa-state.service
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=-/usr/sbin/alsactl -E HOME=/var/lib/alsa restore
ExecStop=-/usr/sbin/alsactl -E HOME=/var/lib/alsa store
-- System Information:
Debian Release: buster/sid
APT prefers testing
APT policy: (500, 'testing'), (500, 'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.9.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages alsa-utils depends on:
ii kmod 24-1
ii libasound2 1.1.3-5
ii libc6 2.24-12
ii libfftw3-single3 3.3.6p2-1
ii libncursesw5 6.0+20170715-2
ii libsamplerate0 0.1.8-8+b2
ii libtinfo5 6.0+20170715-2
ii lsb-base 9.20161125
ii whiptail 0.52.20-1+b1
alsa-utils recommends no packages.
alsa-utils suggests no packages.
-- Configuration Files:
/etc/init.d/alsa-utils changed:
[ -x /usr/sbin/alsactl ] || exit 0
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MYNAME=/etc/init.d/alsa-utils
ALSACTLHOME=/run/alsa
[ -d "$ALSACTLHOME" ] || mkdir -p "$ALSACTLHOME"
. /lib/lsb/init-functions
. /usr/share/alsa/utils.sh
log_action_end_msg_and_exit()
{
log_action_end_msg "$1" ${2:+"$2"}
exit $1
}
executable()
{
# If which is not available then we must be running before
# /usr is mounted on a system that has which in /usr/bin/.
# Conclude that $1 is not executable.
[ -x /bin/which ] || [ -x /usr/bin/which ] || return 1
which "$1" >/dev/null 2>&1
}
executable amixer || { echo "${MYNAME}: Error: No amixer program available." >&2 ; exit 1 ; }
restore_levels()
{
[ -f /var/lib/alsa/asound.state ] || return 1
CARD="$1"
[ "$1" = all ] && CARD=""
# Assume that if alsactl prints a message on stderr
# then it failed somehow. This works around the fact
# that alsactl doesn't return nonzero status when it
# can't restore settings for the card
touch /home/guy/alsa-utils-ok.txt
if MSG="$(alsactl -E HOME="$ALSACTLHOME" restore $CARD 2>&1 >/dev/null)" && [ ! "$MSG" ] ; then
return 0
else
# Retry with the "force" option. This restores more levels
# but it results in much longer error messages.
alsactl -F restore $CARD >/dev/null 2>&1
log_action_cont_msg "warning: 'alsactl -E HOME="$ALSACTLHOME" restore${CARD:+ $CARD}' failed with error message '$MSG'"
return 1
fi
}
store_levels()
{
CARD="$1"
[ "$1" = all ] && CARD=""
if MSG="$(alsactl -E HOME="$ALSACTLHOME" store $CARD 2>&1)" ; then
sleep 1
return 0
else
log_action_cont_msg "warning: 'alsactl store${CARD:+ $CARD}' failed with error message '$MSG'"
return 1
fi
}
mute_and_zero_levels_on_card()
{
CARDOPT="-c $1"
for CTL in \
Master \
PCM \
Synth \
CD \
Line \
Mic \
"PCM,1" \
Wave \
Music \
AC97 \
"Master Digital" \
DAC \
"DAC,0" \
"DAC,1" \
Headphone \
Speaker \
Playback
do
mute_and_zero_level "$CTL"
done
return 0
}
mute_and_zero_levels()
{
TTZML_RETURNSTATUS=0
case "$1" in
all)
for CARD in $(echo_card_indices) ; do
mute_and_zero_levels_on_card "$CARD" || TTZML_RETURNSTATUS=1
done
;;
*)
mute_and_zero_levels_on_card "$1" || TTZML_RETURNSTATUS=1
;;
esac
return $TTZML_RETURNSTATUS
}
card_OK()
{
[ "$1" ] || bugout
if [ "$1" = all ] ; then
[ -d /proc/asound ]
return $?
else
[ -d "/proc/asound/card$1" ] || [ -d "/proc/asound/$1" ]
return $?
fi
}
case "$1" in
start)
EXITSTATUS=0
TARGET_CARD="$2"
case "$TARGET_CARD" in
""|all) TARGET_CARD=all ; log_action_begin_msg "Setting up ALSA" ;;
*) log_action_begin_msg "Setting up ALSA card ${TARGET_CARD}" ;;
esac
card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
preinit_levels "$TARGET_CARD" || EXITSTATUS=1
if ! restore_levels "$TARGET_CARD" ; then
sanify_levels "$TARGET_CARD" || EXITSTATUS=1
restore_levels "$TARGET_CARD" >/dev/null 2>&1 || :
fi
log_action_end_msg_and_exit "$EXITSTATUS"
;;
stop)
EXITSTATUS=0
TARGET_CARD="$2"
case "$TARGET_CARD" in
""|all) TARGET_CARD=all ; log_action_begin_msg "Shutting down ALSA" ;;
*) log_action_begin_msg "Shutting down ALSA card ${TARGET_CARD}" ;;
esac
card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
store_levels "$TARGET_CARD" || EXITSTATUS=1
#mute_and_zero_levels "$TARGET_CARD" || EXITSTATUS=1
log_action_end_msg_and_exit "$EXITSTATUS"
;;
restart|force-reload)
EXITSTATUS=0
$0 stop || EXITSTATUS=1
$0 start || EXITSTATUS=1
exit $EXITSTATUS
;;
reset)
TARGET_CARD="$2"
case "$TARGET_CARD" in
""|all) TARGET_CARD=all ; log_action_begin_msg "Resetting ALSA" ;;
*) log_action_begin_msg "Resetting ALSA card ${TARGET_CARD}" ;;
esac
card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
preinit_levels "$TARGET_CARD"
sanify_levels "$TARGET_CARD"
log_action_end_msg_and_exit "$?"
;;
*)
echo "Usage: $MYNAME {start [CARD]|stop [CARD]|restart [CARD]|reset [CARD]}" >&2
exit 3
;;
esac
-- no debconf information
Acknowledgement sent
to Grand T <[email protected]>:
Extra info received and forwarded to list. Copy sent to Debian ALSA Maintainers <[email protected]>.
(Fri, 18 Aug 2017 16:33:07 GMT) (full text, mbox, link).
To ensure a full restore of all level ( PCM for example) i modify the service as below
[Unit]
Description=Save/Restore Sound Card State
Documentation=man:alsactl(1)
ConditionPathExists=!/etc/alsa/state-daemon.conf
ConditionPathExistsGlob=/dev/snd/control*
After=alsa-state.service
[Service]
Type=oneshot
RemainAfterExit=true
ExecStartPre=/bin/sleep 60
ExecStart=-/usr/sbin/alsactl -E HOME=/var/lib/alsa restore
ExecStop=-/usr/sbin/alsactl -E HOME=/var/lib/alsa store
So it is much better and done after all snd management
journalctl -b|grep -i -e alsa -e sound -e snd août 18 17:47:13 debian kernel: snd_hda_intel 0000:02:00.1: Refused to change power state, currently in D3 août 18 17:47:13 debian kernel: snd_hda_intel 0000:02:00.1: Handle vga_switcheroo audio client août 18 17:47:13 debian kernel: snd_hda_intel 0000:02:00.1: VGA controller is disabled août 18 17:47:13 debian kernel: snd_hda_intel 0000:02:00.1: Delaying initialization août 18 17:47:13 debian kernel: snd_hda_codec_idt hdaudioC0D0: autoconfig for 92HD81B1X5: line_outs=1 (0xd/0x0/0x0/0x0/0x0) type:speaker août 18 17:47:13 debian kernel: snd_hda_codec_idt hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) août 18 17:47:13 debian kernel: snd_hda_codec_idt hdaudioC0D0: hp_outs=1 (0xb/0x0/0x0/0x0/0x0) août 18 17:47:13 debian kernel: snd_hda_codec_idt hdaudioC0D0: mono: mono_out=0x0 août 18 17:47:13 debian kernel: snd_hda_codec_idt hdaudioC0D0: inputs: août 18 17:47:13 debian kernel: snd_hda_codec_idt hdaudioC0D0: Internal Mic=0x11 août 18 17:47:13 debian kernel: snd_hda_codec_idt hdaudioC0D0: Mic=0xa août 18 17:47:13 debian kernel: input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:14.2/sound/card0/input12 août 18 17:47:13 debian kernel: input: HDA ATI SB Mic as /devices/pci0000:00/0000:00:14.2/sound/card0/input13 août 18 17:47:13 debian kernel: input: HDA ATI SB Front Headphone as /devices/pci0000:00/0000:00:14.2/sound/card0/input14 août 18 17:47:15 debian systemd[1]: Reached target Sound Card. août 18 17:47:23 debian systemd[1]: Starting Save/Restore Sound Card State... août 18 17:47:46 debian kernel: snd_hda_intel 0000:02:00.1: Start delayed initialization août 18 17:47:46 debian kernel: snd_hda_intel 0000:02:00.1: CORB reset timeout#2, CORBRP = 65535 août 18 17:47:46 debian kernel: snd_hda_intel 0000:02:00.1: no codecs initialized août 18 17:47:46 debian kernel: snd_hda_intel 0000:02:00.1: initialization error août 18 17:48:23 debian systemd[1]: Started Save/Restore Sound Card State.
Debbugs is free software and licensed under the terms of the GNU General
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.