← Back to team overview

aims team mailing list archive

[Bug 1289730] Re: [RFC PATCH] alsactl: Do not run udev rule before datadir is mounted

 

At Fri, 13 Jun 2014 11:05:52 +0200,
David Henningsson wrote:
> 
> 
> 
> On 2014-06-13 10:26, Jaroslav Kysela wrote:
> > Date 13.6.2014 10:15, David Henningsson wrote:
> >> The 90-alsa-restore.rules udev rule is primarily meant to handle hotplugging,
> >> but sometimes it is also run before /usr is mounted,
> >> and alsactl restore depends on /usr/share/alsa being present.
> >>
> >> If /usr/share/alsa is not present, we're so early in the boot
> >> process that alsa-restore.service (or upstart equivalent) will
> >> run later on.
> >>
> >> BugLink: https://bugs.launchpad.net/bugs/1289730
> >> Signed-off-by: David Henningsson <david.henningsson@xxxxxxxxxxxxx>
> >> ---
> >>
> >> I'm not really sure of all quirks in the boot process, and I haven't tested the
> >> patch either, hence the RFC above. Do you think it makes sense?
> >
> > Yes, I think that's ok. Takashi?
> >
> >> Should we also add @sbindir@ to the things to test for?
> >
> > It shouldn't harm anything. Could you prepare a new patch?
> 
> Sure, please find it attached. I was also considering adding something 
> under /var as well, but I didn't do that, because I think it will fall 
> back to an "alsactl init" in that case (right?), so it still makes some 
> sense to run alsactl without /var.
> 
> >
> >>   alsactl/90-alsa-restore.rules.in | 2 +-
> >>   alsactl/Makefile.am              | 1 +
> >>   configure.ac                     | 1 +
> >>   3 files changed, 3 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/alsactl/90-alsa-restore.rules.in b/alsactl/90-alsa-restore.rules.in
> >> index c68119d..c83c6b5 100644
> >> --- a/alsactl/90-alsa-restore.rules.in
> >> +++ b/alsactl/90-alsa-restore.rules.in
> >> @@ -1,4 +1,4 @@
> >> -ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", GOTO="alsa_restore_go"
> >> +ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST=="@datadir@", GOTO="alsa_restore_go"
> >>   GOTO="alsa_restore_end"
> >>
> >>   LABEL="alsa_restore_go"
> >> diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am
> >> index b862412..afbedb3 100644
> >> --- a/alsactl/Makefile.am
> >> +++ b/alsactl/Makefile.am
> >> @@ -44,6 +44,7 @@ endif
> >>
> >>   edit = \
> >>   	$(SED) -r -e 's,@sbindir\@,$(sbindir),g' \
> >> +		  -e 's,@datadir\@,$(mydatadir),g' \
> >>   		  -e 's,@daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \
> >>   							< $< > $@ || rm $@
> >>
> >> diff --git a/configure.ac b/configure.ac
> >> index 7e6894a..a4d2db3 100644
> >> --- a/configure.ac
> >> +++ b/configure.ac
> >> @@ -292,6 +292,7 @@ AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data])
> >>
> >>   mydatadir="$dir/alsa"
> >>   AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration])
> >> +AC_SUBST(mydatadir)
> >>
> >>   AC_ARG_WITH(testsound,
> >>     AS_HELP_STRING([--with-testsound=file], [give the path of test sound file for alsaconf]),
> >>
> >
> >
> 
> -- 
> David Henningsson, Canonical Ltd.
> https://launchpad.net/~diwic
> >From 09a4abb5560448eb434a33fc237d578e14666940 Mon Sep 17 00:00:00 2001
> From: David Henningsson <david.henningsson@xxxxxxxxxxxxx>
> Date: Fri, 13 Jun 2014 10:04:25 +0200
> Subject: [PATCH] alsactl: Do not run udev rule before datadir/sbindir are both
>  mounted
> 
> Sometimes 90-alsa-restore.rules is run before /usr is mounted,
> and alsactl restore depends on /usr/share/alsa being present.
> 
> If /usr/share/alsa is not present, we're so early in the boot
> process that alsa-restore.service (or upstart equivalent) will
> run later on.
> 
> BugLink: https://bugs.launchpad.net/bugs/1289730
> Signed-off-by: David Henningsson <david.henningsson@xxxxxxxxxxxxx>
> ---
>  alsactl/90-alsa-restore.rules.in | 2 +-
>  alsactl/Makefile.am              | 1 +
>  configure.ac                     | 1 +
>  3 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/alsactl/90-alsa-restore.rules.in b/alsactl/90-alsa-restore.rules.in
> index c68119d..80fc043 100644
> --- a/alsactl/90-alsa-restore.rules.in
> +++ b/alsactl/90-alsa-restore.rules.in
> @@ -1,4 +1,4 @@
> -ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", GOTO="alsa_restore_go"
> +ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST=="@sbindir@", TEST=="@datadir@", GOTO="alsa_restore_go"
>  GOTO="alsa_restore_end"

IMO, it's better to use @mydatadir@ instead of @datadir@ here and...

>  
>  LABEL="alsa_restore_go"
> diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am
> index b862412..afbedb3 100644
> --- a/alsactl/Makefile.am
> +++ b/alsactl/Makefile.am
> @@ -44,6 +44,7 @@ endif
>  
>  edit = \
>  	$(SED) -r -e 's,@sbindir\@,$(sbindir),g' \
> +		  -e 's,@datadir\@,$(mydatadir),g' \

... here.  Otherwise it may be confusing.

Other than that, the change looks good to me.

Jaroslav, could you fix up quickly in your side?


thanks,

Takashi

-- 
You received this bug notification because you are a member of AIMS,
which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1289730

Title:
  systemd-udev fails to execute alsactl during start-up if /usr and/or
  /var are separate volumes

Status in “alsa-utils” package in Ubuntu:
  Incomplete

Bug description:
  During system startup systemd-udev will print the following error
  messages:

  [   15.089778] systemd-udevd[683]: failed to execute '/usr/sbin/alsactl' '/usr/sbin/alsactl -E HOME=/var/run/alsa restore 0': No such file or directory
  [   15.090130] systemd-udevd[684]: failed to execute '/usr/sbin/alsactl' '/usr/sbin/alsactl -E HOME=/var/run/alsa restore 1': No such file or directory

  alsactl is present:

  $ which alsactl
  /usr/sbin/alsactl

  but on a separate partition:
  $ df -h /usr/sbin/alsactl 
  Dateisystem            Größe Benutzt Verf. Verw% Eingehängt auf
  /dev/mapper/scaleo-usr   12G    6,6G  4,1G   62% /usr

  $ df -h /var
  Dateisystem            Größe Benutzt Verf. Verw% Eingehängt auf
  /dev/mapper/scaleo-var  7,3G    2,5G  4,4G   37% /var

  This suggests that systemd-udev is called before all local partitions
  have been mounted.

  $ lsb_release -rd
  Description:	Ubuntu Trusty Tahr (development branch)
  Release:	14.04

  $ apt-cache policy udev
  udev:
    Installiert:           204-5ubuntu13
    Installationskandidat: 204-5ubuntu13
    Versionstabelle:
   *** 204-5ubuntu13 0
          500 http://de.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
          100 /var/lib/dpkg/status

  Kind regards,
    Dominik

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/alsa-utils/+bug/1289730/+subscriptions


Follow ups

References