[Pkg-alsa-devel] Bug#848395: Bug#848395: udev rule fails with exit code 99

Paul Menzel pmenzel at molgen.mpg.de
Sun Dec 18 19:52:54 UTC 2016


Dear Elimar,


On 2016-12-18 11:50, Elimar Riesebieter wrote:
> * Paul Menzel <pmenzel at molgen.mpg.de> [2016-12-17 16:01 +0100]:
> 
>> On 2016-12-17 14:10, Elimar Riesebieter wrote:
>> > Control: tags -1 +moreinfo
>> >
>> > * Paul Menzel <pmenzel at molgen.mpg.de> [2016-12-17 11:03 +0100]:
>> >
> [...]
>> The manual page of alsactl says.
>> 
>> > init tries to initialize all devices to a default state. If device is
>> > not known, error code 99 is returned.
> 
> [...]
> 
>> > > Is the udev rule still needed?
>> >
>> > yes
>> 
>> Interesting. Sorry, for being ignorant, just to be clear, it does the 
>> same
>> thing, what the systemd service unit does?
> 
> Sysvinit systems don't have "systemd device units"

That wasn’t my question. So reading both files again, the udev rule and 
the systemd service unit do the same thing, that means, they run 
`alsactl restore …`.

But you argue, that the udev rule is needed on a system using SysV.

Unfortunely, I don’t understand that argument, as there is also the SysV 
init script `/etc/init.d/alsa-utils`. That contains the code below.

```
[…]
# $1 <card ID> | "all"
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
	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
}
[…]
   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"
	;;
```

So doesn’t that cover systems using SysV as init system?

>> > > I don’t really know, how it’s supposed to
>> > > work, and what I don’t have that file `asound.state`.
>> >
>> > Create it as mentioned above
>> >
>> > > It would be nice to not run `alsactl` during startup, if it’s failing,
>> > > to get rid of the error message.
>> >
>> > What do you think: Is it an error or just a message?
>> 
>> As it exits with an error code different from 0, I consider it an 
>> error.
> 
> As you found out by quoting alsactl's manpage that your device is not
> known.

Do you have an idea, why it wasn’t initialized on my system?


Kind regards,

Paul



More information about the Pkg-alsa-devel mailing list