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

clemens fischer ino-news at spotteswoode.dnsalias.org
Sun Nov 27 14:06:35 EST 2011


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



More information about the arch-general mailing list