On my machine 'alsasound stop' always fails because some modules are not removed. I have a v4l device that loads a module named 'saa7134_alsa'. Because of this module, alsasound init script is not able to remove some alsa modules that are still being referenced. # lsmod Module Size Used by snd_pcm_oss 26144 0 snd_mixer_oss 11392 1 snd_pcm_oss snd_seq_oss 20480 0 snd_seq_midi_event 3264 1 snd_seq_oss snd_seq 30224 5 snd_seq_oss,snd_seq_midi_event saa7134_alsa 6080 0 snd_via82xx 13844 0 snd_ac97_codec 67808 1 snd_via82xx snd_ac97_bus 896 1 snd_ac97_codec snd_pcm 45512 4 snd_pcm_oss,saa7134_alsa,snd_via82xx,snd_ac97_codec snd_timer 11972 2 snd_seq,snd_pcm snd_page_alloc 4488 2 snd_via82xx,snd_pcm snd_mpu401_uart 3072 1 snd_via82xx snd_rawmidi 11808 1 snd_mpu401_uart snd_seq_device 3596 3 snd_seq_oss,snd_seq,snd_rawmidi snd 28196 13 snd_pcm_oss,snd_mixer_oss,snd_seq_oss,snd_seq,saa7134_alsa,snd_via82xx,snd_ac97_codec,snd_pcm,snd_timer,snd_mpu401_uart,snd_rawmidi,snd_seq_device # /etc/init.d/alsasound stop * Service alsasound stopping * WARNING: you are stopping a boot service. [ !! ] * ERROR: alsasound failed to stop # lsmod Module Size Used by saa7134_alsa 6080 0 snd_pcm 45512 1 saa7134_alsa snd_timer 11972 1 snd_pcm snd_page_alloc 4488 1 snd_pcm snd 28196 3 saa7134_alsa,snd_pcm,snd_timer
I was able to fix the problem by changing init.d script. I'll attach a patch. As a side note, I don't understand why unload modules. It seems too much trouble to me.
Created attachment 101572 [details, diff] Unload more alsa modules on stop Proposed fix
When I added a second sound device (cx88-alsa) to my configuration, I was having the same problem. alsasound wasn't unloading all the modules (cx88-alsa) on stop and it was failing. This patch fixed the problem. Why hasn't this been fixed yet??
Because I'm alone working on ALSA, that's why. Also, which package is adding that particular module? I'm afraid that the idea of just using a more weak regexp is not very good, it should instead try to recursively remove snd and everything depending on that, it would be more reliable.
How exactly would alsasound remove cx88-alsa then since there is no snd- prefix for this module? snd_pcm_oss 39968 0 snd_mixer_oss 15040 1 snd_pcm_oss snd_seq_oss 29568 0 snd_seq_midi_event 7104 1 snd_seq_oss snd_seq 48960 4 snd_seq_oss,snd_seq_midi_event lgh06xf 3200 1 lgdt330x 8836 1 cx88_dvb 13764 0 dvb_pll 13380 2 lgh06xf,cx88_dvb video_buf_dvb 5508 1 cx88_dvb dvb_core 74928 2 lgdt330x,video_buf_dvb snd_via82xx 24416 1 snd_ac97_codec 104152 1 snd_via82xx ac97_bus 3008 1 snd_ac97_codec snd_mpu401_uart 7616 1 snd_via82xx snd_rawmidi 20960 1 snd_mpu401_uart snd_seq_device 7188 3 snd_seq_oss,snd_seq,snd_rawmidi nvidia 7740184 16 tuner 58728 0 cx88_alsa 12040 1 snd_pcm 73352 4 snd_pcm_oss,snd_via82xx,snd_ac97_codec,cx88_alsa snd_timer 19912 2 snd_seq,snd_pcm snd_page_alloc 8144 2 snd_via82xx,snd_pcm cx8802 15876 1 cx88_dvb cx8800 31500 0 cx88xx 64100 4 cx88_dvb,cx88_alsa,cx8802,cx8800 ir_common 28356 1 cx88xx i2c_algo_bit 7496 1 cx88xx tveeprom 15888 1 cx88xx i2c_core 19008 8 lgh06xf,lgdt330x,dvb_pll,nvidia,tuner,cx88xx,i2c_algo_bit,tveeprom btcx_risc 4552 4 cx88_alsa,cx8802,cx8800,cx88xx video_buf 21508 6 cx88_dvb,video_buf_dvb,cx88_alsa,cx8802,cx8800,cx88xx
I've fixed this in alsa-utils-1.0.14_rc2-r1. Basically the "snd" module (basic ALSA support) is unloaded recursively, which means anything that depends on it get removed too (in this case, also cx88_alsa).
Created attachment 110510 [details, diff] alsasound.patch Diego: Since you're the only one working on alsa, allow me to help you out with this patch which does just as you requested.
Bugger. I guess I wasn't fast enough.