[PlanetCCRMA] How do I restart Alsa without rebooting???

Fernando Pablo Lopez-Lezcano nando@ccrma.Stanford.EDU
Wed Jan 15 10:19:02 2003


>    My system has recently gotten much worse about having Alsa come up
> running on my HDSP card on a cold boot. This is still apparently related
> to my use of a USB MidiMan 2x2. If the 2x2 is not plugged in, then Alsa
> starts up fine on the HDSP. IF the 2x2 is plugged in, then I get error
> messages about the Hammerfall not being able to allocate memory. A warm
> boot always seems to solve this problem. On the second boot the
> Hammerfall gets memory and everything is fine from then on.
> 
>    My question is, how to I do the equivalent of a warm boot without
> actually doing the reboot? I've tried 
> 
> service alsasound restart
> 
> but that doesn't seem to solve the problem. When the Hammerfall hasn't
> gotten memory I see only a stop and start OK message. When the
> Hammerfall was allocated memory I see four messages and the restart
> seems to allow Jack to run. Anyway, when the system is in a bad state
> this restart doesn't work.
> 
> (And I'm not supposed to have to reboot Linux anyway!!!) ;-)
> 
> What commands would get memory allocated and Alsa started correctly for
> both devices?

No commands :-)

>From what I know the Hammerfall needs a lot of contiguous memory for its
buffers. If the memory becomes fragmented during the boot process then
it cannot allocate the block it needs and fails. "service alsasound
restart" is the correct way of restarting alsa but it will not do
anything for an out of memory condition. The only solution is start the
module that grabs the memory earlier in the boot sequence. 

You probably have something like this in /etc/modules.conf:

# --- Load the hammerfall memory module
pre-install snd /sbin/modprobe snd-hammerfall-mem

If so, you could (carefully) edit /etc/rc.d/rc.sysinit and add these
lines:

# Load hammerfall memory module if needed
if grep -q "snd-hammerfall-mem" /etc/modules.conf 2>/dev/null ; then
    /sbin/modprobe snd-hammerfall-mem
fi

Just before the lines that say "# Load sound modules ..." would be, I
think, a good choice for inserting this. 

-- Fernando