On boot, /etc/init.d/alsasound loads the necessary alsa modules and if RESTORE_ON_START is set, it runs restore() to restore previous mixer levels. I've noticed the following problems on two different machines, both using external USB sound cards: - load_modules() successfully loads all necessary modules, however, /proc/asound is not ready directly after the modprobe, which yields eerror "ERROR: Failed to load necessary drivers" - restore() tries to parse /proc/asound/cards which is not ready yet, resulting in a wrong command line for alsactl -f "${alsastatedir}/asound.state" restore ${cardnum}, thus || ewarn "Errors while restoring defaults, ignoring". Please have a look at the attached rc.log for the errors. Since USB devices can take some time to initialize, the solution seems rather simple: Instead of: ebegin "Loading: ${DRIVER}" modprobe ${DRIVER} eend $? We would need something like: ebegin "Loading: ${DRIVER}" modprobe ${DRIVER} ; local E=$? if ! (( E )) ; then if modprobe -c | grep -q "^alias ${DRIVER} snd-usb-audio$" ; then # Wait for slow USB audio devices to initialize sleep 1 fi fi eend $E This actually works fine for both of my machines. I'll attach a diff. Thanks. Reproducible: Always
Created attachment 153325 [details] Alsa RC config
Created attachment 153327 [details] The snd-card-0 alias
Created attachment 153329 [details] Alsa portion of RC-Log
Created attachment 153331 [details, diff] The QND approach to fix it..
USB latency is the worst, however, I would rather put a SLEEP_SECONDS var in alsasound conf.d rather than insert the possiblity of it sleeping forever. Assuming this is still an issue with newer kernel / ALSA, lemme know.
Fixed with linux-2.6.31-gentoo-r1. Thanks.