Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH WIP] package/systemd: fix paths to runtime utilities
@ 2017-06-07 22:08 Yann E. MORIN
  2017-06-08 14:34 ` Adam Duskett
  0 siblings, 1 reply; 3+ messages in thread
From: Yann E. MORIN @ 2017-06-07 22:08 UTC (permalink / raw)
  To: buildroot

systemd's configure is looking in $PATH to find utilities that will be
needed at runtime.

Usually, those utilties, when installed on the host, will be found in
the same path they would be present on the target. For example,
/usr/bin/mount on the host would also be /usr/bin/mount on the target,
and all is find.

Except when we need to install a host variant of util-linux, which will
install mount in $(HOST_DIR), in which case systemd's configure would
find that one.

Of course, it is also very well possible that those utilities are not
installed on the host in the same location they would be on the target,
in case a user has manually installed some of those (e.g. in /usr/local/
or in /opt/)

Forcibly set the path to those utilities, as they are expected to be on
the target.

For kexec, we can set it even though we do not depend on it (yet).
systemd will appropriately test it at runtime.

For quota, we point to non-existing files, so as to catch errors at
runtime. It is to be noted that quotacheck is optional, while quotaon
does not seem to be (a service file is always installed, that uses it).

Note: utilties listed in the order they appear in configure.ac

Reported-by: Adam Duskett <aduskett@gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Cc: Adam Duskett <aduskett@gmail.com>
---

This patch is a tentative for Adam to test. I haven't even build it so
far, by lack of time those days...

---
 package/systemd/systemd.mk | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index 0b62cf043e..de155f8098 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -45,10 +45,16 @@ SYSTEMD_CONF_OPTS += \
 
 SYSTEMD_CFLAGS = $(TARGET_CFLAGS) -fno-lto
 
-# Override path to kmod, used in kmod-static-nodes.service
+# Override paths to a few utilities needed at runtime, to
+# avoid finding those we would install in $(HOST_DIR).
 SYSTEMD_CONF_ENV = \
 	CFLAGS="$(SYSTEMD_CFLAGS)" \
-	ac_cv_path_KMOD=/usr/bin/kmod
+	ac_cv_path_KILL=/usr/bin/kill \
+	ac_cv_path_KMOD=/usr/bin/kmod \
+	ac_cv_path_KEXEC=/usr/sbin/kexec \
+	ac_cv_path_SULOGIN=/usr/sbin/sulogin \
+	ac_cv_path_MOUNT=/usr/sbin/mount \
+	ac_cv_path_UMOUNT=/usr/sbin/umount
 
 define SYSTEMD_RUN_INTLTOOLIZE
 	cd $(@D) && $(HOST_DIR)/usr/bin/intltoolize --force --automake
@@ -182,8 +188,14 @@ endif
 
 ifeq ($(BR2_PACKAGE_SYSTEMD_QUOTACHECK),y)
 SYSTEMD_CONF_OPTS += --enable-quotacheck
+SYSTEMD_CONF_ENV += \
+	ac_cv_path_QUOTAON=/usr/sbin/quotaon \
+	ac_cv_path_QUOTACHECK=/usr/sbin/quotacheck
 else
 SYSTEMD_CONF_OPTS += --disable-quotacheck
+SYSTEMD_CONF_ENV += \
+	ac_cv_path_QUOTAON=/.missing \
+	ac_cv_path_QUOTACHECK=/.missing
 endif
 
 ifeq ($(BR2_PACKAGE_SYSTEMD_TMPFILES),y)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH WIP] package/systemd: fix paths to runtime utilities
  2017-06-07 22:08 [Buildroot] [PATCH WIP] package/systemd: fix paths to runtime utilities Yann E. MORIN
@ 2017-06-08 14:34 ` Adam Duskett
  2017-06-08 18:49   ` Yann E. MORIN
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Duskett @ 2017-06-08 14:34 UTC (permalink / raw)
  To: buildroot

Hey Yann!

On Wed, Jun 7, 2017 at 6:08 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> systemd's configure is looking in $PATH to find utilities that will be
> needed at runtime.
>
> Usually, those utilties, when installed on the host, will be found in
> the same path they would be present on the target. For example,
> /usr/bin/mount on the host would also be /usr/bin/mount on the target,
> and all is fine.
>
> Except when we need to install a host variant of util-linux, which will
> install mount in $(HOST_DIR), in which case systemd's configure would
> find that one.
>
I can confirm that I had host-util-linux building before systemd.

> Of course, it is also very well possible that those utilities are not
> installed on the host in the same location they would be on the target,
> in case a user has manually installed some of those (e.g. in /usr/local/
> or in /opt/)
>
> Forcibly set the path to those utilities, as they are expected to be on
> the target.
>
> For kexec, we can set it even though we do not depend on it (yet).
> systemd will appropriately test it at runtime.
>
> For quota, we point to non-existing files, so as to catch errors at
> runtime. It is to be noted that quotacheck is optional, while quotaon
> does not seem to be (a service file is always installed, that uses it).
>
> Note: utilties listed in the order they appear in configure.ac
>
> Reported-by: Adam Duskett <aduskett@gmail.com>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
> Cc: Adam Duskett <aduskett@gmail.com>
> ---
>
> This patch is a tentative for Adam to test. I haven't even build it so
> far, by lack of time those days...
>
> ---
>  package/systemd/systemd.mk | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> index 0b62cf043e..de155f8098 100644
> --- a/package/systemd/systemd.mk
> +++ b/package/systemd/systemd.mk
> @@ -45,10 +45,16 @@ SYSTEMD_CONF_OPTS += \
>
>  SYSTEMD_CFLAGS = $(TARGET_CFLAGS) -fno-lto
>
> -# Override path to kmod, used in kmod-static-nodes.service
> +# Override paths to a few utilities needed at runtime, to
> +# avoid finding those we would install in $(HOST_DIR).
>  SYSTEMD_CONF_ENV = \
>         CFLAGS="$(SYSTEMD_CFLAGS)" \
> -       ac_cv_path_KMOD=/usr/bin/kmod
> +       ac_cv_path_KILL=/usr/bin/kill \
> +       ac_cv_path_KMOD=/usr/bin/kmod \
> +       ac_cv_path_KEXEC=/usr/sbin/kexec \
> +       ac_cv_path_SULOGIN=/usr/sbin/sulogin \
These work fine.

> +       ac_cv_path_MOUNT=/usr/sbin/mount \
> +       ac_cv_path_UMOUNT=/usr/sbin/umount
This should be :
ac_cv_path_MOUNT_PATH=/usr/bin/mount \
ac_cv_path_UMOUNT_PATH=/usr/bin/umount

Why they decided that MOUNT and UMOUNT need to have _PATH
in the variable name is beyond me.

Also /bin/ instead of /sbin.
>
>  define SYSTEMD_RUN_INTLTOOLIZE
>         cd $(@D) && $(HOST_DIR)/usr/bin/intltoolize --force --automake
> @@ -182,8 +188,14 @@ endif
>
>  ifeq ($(BR2_PACKAGE_SYSTEMD_QUOTACHECK),y)
>  SYSTEMD_CONF_OPTS += --enable-quotacheck
> +SYSTEMD_CONF_ENV += \
> +       ac_cv_path_QUOTAON=/usr/sbin/quotaon \
> +       ac_cv_path_QUOTACHECK=/usr/sbin/quotacheck
>  else
>  SYSTEMD_CONF_OPTS += --disable-quotacheck
> +SYSTEMD_CONF_ENV += \
> +       ac_cv_path_QUOTAON=/.missing \
> +       ac_cv_path_QUOTACHECK=/.missing
>  endif
>
>  ifeq ($(BR2_PACKAGE_SYSTEMD_TMPFILES),y)
> --
> 2.11.0
>

After I made the small changes above, the system booted just fine again!
Thanks a ton for your help!

Adam

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH WIP] package/systemd: fix paths to runtime utilities
  2017-06-08 14:34 ` Adam Duskett
@ 2017-06-08 18:49   ` Yann E. MORIN
  0 siblings, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2017-06-08 18:49 UTC (permalink / raw)
  To: buildroot

Adam, All,

On 2017-06-08 10:34 -0400, Adam Duskett spake thusly:
[--SNIP--]
> > -# Override path to kmod, used in kmod-static-nodes.service
> > +# Override paths to a few utilities needed at runtime, to
> > +# avoid finding those we would install in $(HOST_DIR).
> >  SYSTEMD_CONF_ENV = \
> >         CFLAGS="$(SYSTEMD_CFLAGS)" \
> > -       ac_cv_path_KMOD=/usr/bin/kmod
> > +       ac_cv_path_KILL=/usr/bin/kill \
> > +       ac_cv_path_KMOD=/usr/bin/kmod \
> > +       ac_cv_path_KEXEC=/usr/sbin/kexec \
> > +       ac_cv_path_SULOGIN=/usr/sbin/sulogin \
> These work fine.
> 
> > +       ac_cv_path_MOUNT=/usr/sbin/mount \
> > +       ac_cv_path_UMOUNT=/usr/sbin/umount
> This should be :
> ac_cv_path_MOUNT_PATH=/usr/bin/mount \
> ac_cv_path_UMOUNT_PATH=/usr/bin/umount
> 
> Why they decided that MOUNT and UMOUNT need to have _PATH
> in the variable name is beyond me.

Damn, indeed, I did not see it when looking at configure.ac...

> Also /bin/ instead of /sbin.

Yup, right.

> >  define SYSTEMD_RUN_INTLTOOLIZE
> >         cd $(@D) && $(HOST_DIR)/usr/bin/intltoolize --force --automake
> > @@ -182,8 +188,14 @@ endif
> >
> >  ifeq ($(BR2_PACKAGE_SYSTEMD_QUOTACHECK),y)
> >  SYSTEMD_CONF_OPTS += --enable-quotacheck
> > +SYSTEMD_CONF_ENV += \
> > +       ac_cv_path_QUOTAON=/usr/sbin/quotaon \
> > +       ac_cv_path_QUOTACHECK=/usr/sbin/quotacheck
> >  else
> >  SYSTEMD_CONF_OPTS += --disable-quotacheck
> > +SYSTEMD_CONF_ENV += \
> > +       ac_cv_path_QUOTAON=/.missing \
> > +       ac_cv_path_QUOTACHECK=/.missing
> >  endif
> >
> >  ifeq ($(BR2_PACKAGE_SYSTEMD_TMPFILES),y)
> > --
> > 2.11.0
> >
> 
> After I made the small changes above, the system booted just fine again!
> Thanks a ton for your help!

Thanks for testting! :-)

I'll re-spin a v2 with those changes.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-08 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-07 22:08 [Buildroot] [PATCH WIP] package/systemd: fix paths to runtime utilities Yann E. MORIN
2017-06-08 14:34 ` Adam Duskett
2017-06-08 18:49   ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox