[arch-general] alsa start (Re: Fwd: udev events and /usr not mounted)

Myra Nelson myra.nelson at hughes.net
Sun Nov 27 19:21:17 EST 2011


On Sun, Nov 27, 2011 at 13:06, clemens fischer <
ino-news at spotteswoode.dnsalias.org> wrote:

> Myra Nelson wrote:
>
> > Alsa is in my daemons array and starts. The problem is the udev
> > rule to restore the volume levels fails as it is run before /usr
> > is mounted. That's why I was asking about udev rules and why [
> > /usr/bin/alsactl restore ] works from the console after I've
> > booted. After reading through the initscripts, rc.d, and mkinitcpio
> > code I think it may be possible to run:
> >
> > [
> > run_hook sysinit_postmount
> >
> >  udevam control --reload-rules
> >
> > run_hook single_end
> > ]
> >
> > in rc.local.
>
> The hooks don't work like this, rc.local might run too late.
>
> You'd make a file eg. /etc/rc.d/functions.d/my-hooks.sh:
>
>  my_sysinit_postmount_udevadm()
>  {
>      udevadm control --reload-rules ||
>      echo "my_sysinit_postmount_udevadm: udevadm err $?"
>      return 0
>  }
>  add_hook sysinit_postmount my_sysinit_postmount_udevadm
>
> Putting the file into etc/rc.d/functions.d/ will let the hooks system
> see and source it, and add_hook() will put your function into the array
> of functions to run at a specific point.  The list of hooks is in
> etc/rc.d/functions and a custom hook function is a regular shell
> function.  No special error handling or sandboxing is done on them, so
> you want to make sure they don't block or kill the shell.  This is why
> I'd recommend to use the "|| ..." clause after some user command and to
> return a zero at the end, though ATM neither seems strictly necessary.
> It will make a hook funtion future proof, I presume.
>
>
> clemens
>
> Clemens:

Thanks for the reply. I figured out the hook didn't work that way but it
didn't keep me from booting. Removing the run_hook around the udevadm
command and leaving it in rc.local takes care of the problem.  It's only
necessary to restore the volume state stored in the asound file in /etc and
the udevadm command takes care of it. However I will take your response and
study the hooks and how to use them and learn something from this
experience.

Myra

-- 
Life's fun when your sick and psychotic!


More information about the arch-general mailing list