On Fri, Jul 26, 2024 at 5:24 AM Zoltán Böszörményi <[email protected]> wrote:
>
> With commits 90bc1810 ("bitbake.conf: Add runtimedir") and
> 561e853e ("rpcbind: Specify state directory under /run") rpcbind
> still can fail during startup.
>
> It has two problems:
> * The lockfile is still hardcoded as "/var/run/rpcbind.lock".
>   It needs to use the same internal define for RPCBIND_STATEDIR
>   as the paths for rpcbind.xdr and portmap.xdr.
> * Using --with-statedir=/run/rpcbind doesn't guarantee that this
>   directory exists when rpcbind.service starts. Add this guarantee
>   by running rpcbind.service with After=systemd-tmpfiles-setup.service
>   and add the tmpfiles.d entry for /run/rpcbind.

The original patches have been working for me on nanbield (and
kirkstone), so I'm a little confused as to why this is not working for
you; I'd like to avoid patching the source code if at all possible as
carrying patches like this is a burden

>
> Signed-off-by: Zoltán Böszörményi <[email protected]>
> ---
>  ...ke-the-lockfile-follow-with-statedir.patch | 31 ++++++++++++++++++
>  ...ice-after-etc-tmpfiles.d-is-processe.patch | 32 +++++++++++++++++++
>  .../rpcbind/rpcbind/rpcbind.tmpfiles          |  1 +
>  .../recipes-extended/rpcbind/rpcbind_1.2.6.bb |  6 ++++
>  4 files changed, 70 insertions(+)
>  create mode 100644 
> meta/recipes-extended/rpcbind/rpcbind/0001-Make-the-lockfile-follow-with-statedir.patch
>  create mode 100644 
> meta/recipes-extended/rpcbind/rpcbind/0002-Run-rpcbind.service-after-etc-tmpfiles.d-is-processe.patch
>  create mode 100644 meta/recipes-extended/rpcbind/rpcbind/rpcbind.tmpfiles
>
> diff --git 
> a/meta/recipes-extended/rpcbind/rpcbind/0001-Make-the-lockfile-follow-with-statedir.patch
>  
> b/meta/recipes-extended/rpcbind/rpcbind/0001-Make-the-lockfile-follow-with-statedir.patch
> new file mode 100644
> index 0000000000..d487312d22
> --- /dev/null
> +++ 
> b/meta/recipes-extended/rpcbind/rpcbind/0001-Make-the-lockfile-follow-with-statedir.patch
> @@ -0,0 +1,31 @@
> +From f10db88174e73c78c028561715f16ed38148ebde Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
> + <[email protected]>
> +Date: Fri, 26 Jul 2024 12:36:06 +0200
> +Subject: [PATCH 1/2] Make the lockfile follow --with-statedir=
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +Upstream-Status: Inactive-Upstream [lastrelease: 2021-05-10]
> +Signed-off-by: Zoltán Böszörményi <[email protected]>
> +---
> + src/rpcbind.c | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/src/rpcbind.c b/src/rpcbind.c
> +index 36a95b9..948a284 100644
> +--- a/src/rpcbind.c
> ++++ b/src/rpcbind.c
> +@@ -105,7 +105,7 @@ char *nss_modules = "files";
> + /* who to suid to if -s is given */
> + #define RUN_AS  "daemon"
> +
> +-#define RPCBINDDLOCK "/var/run/rpcbind.lock"
> ++#define RPCBINDDLOCK RPCBIND_STATEDIR "/rpcbind.lock"

/var/run should be a symlink to /run, so I really don't think this
should be necessary (at least with the default value for $runtimedir)

> +
> + int runasdaemon = 0;
> + int insecure = 0;
> +--
> +2.45.2
> +
> diff --git 
> a/meta/recipes-extended/rpcbind/rpcbind/0002-Run-rpcbind.service-after-etc-tmpfiles.d-is-processe.patch
>  
> b/meta/recipes-extended/rpcbind/rpcbind/0002-Run-rpcbind.service-after-etc-tmpfiles.d-is-processe.patch
> new file mode 100644
> index 0000000000..f454fdbb3b
> --- /dev/null
> +++ 
> b/meta/recipes-extended/rpcbind/rpcbind/0002-Run-rpcbind.service-after-etc-tmpfiles.d-is-processe.patch
> @@ -0,0 +1,32 @@
> +From 408b18c77c254baaa9111b3e7031ebf12149db38 Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
> + <[email protected]>
> +Date: Fri, 26 Jul 2024 12:54:38 +0200
> +Subject: [PATCH 2/2] Run rpcbind.service after /etc/tmpfiles.d is processed
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +Upstream-Status: Inactive-Upstream [lastrelease: 2021-05-10]
> +Signed-off-by: Zoltán Böszörményi <[email protected]>
> +---
> + systemd/rpcbind.service.in | 3 +++
> + 1 file changed, 3 insertions(+)
> +
> +diff --git a/systemd/rpcbind.service.in b/systemd/rpcbind.service.in
> +index f45ee1e..e9d94ce 100644
> +--- a/systemd/rpcbind.service.in
> ++++ b/systemd/rpcbind.service.in
> +@@ -9,6 +9,9 @@ RequiresMountsFor=@statedir@
> + Requires=rpcbind.socket
> + Wants=rpcbind.target
> +
> ++# Make sure the runtime directory exists
> ++After=systemd-tmpfiles-setup.service

I'd rather have the recipe provide a drop file for this instead of
patching the source

> ++
> + [Service]
> + Type=notify
> + EnvironmentFile=-@_sysconfdir@/rpcbind.conf
> +--
> +2.45.2
> +
> diff --git a/meta/recipes-extended/rpcbind/rpcbind/rpcbind.tmpfiles 
> b/meta/recipes-extended/rpcbind/rpcbind/rpcbind.tmpfiles
> new file mode 100644
> index 0000000000..fecee72c09
> --- /dev/null
> +++ b/meta/recipes-extended/rpcbind/rpcbind/rpcbind.tmpfiles
> @@ -0,0 +1 @@
> +d /run/rpcbind 0755 root root -
> diff --git a/meta/recipes-extended/rpcbind/rpcbind_1.2.6.bb 
> b/meta/recipes-extended/rpcbind/rpcbind_1.2.6.bb
> index e751eb631c..477092b37d 100644
> --- a/meta/recipes-extended/rpcbind/rpcbind_1.2.6.bb
> +++ b/meta/recipes-extended/rpcbind/rpcbind_1.2.6.bb
> @@ -13,8 +13,11 @@ LIC_FILES_CHKSUM = 
> "file://COPYING;md5=b46486e4c4a416602693a711bb5bfa39 \
>  SRC_URI = "${SOURCEFORGE_MIRROR}/rpcbind/rpcbind-${PV}.tar.bz2 \
>             file://init.d \
>             file://rpcbind.conf \
> +           file://rpcbind.tmpfiles \
>             file://rpcbind_add_option_to_fix_port_number.patch \
>             file://0001-systemd-use-EnvironmentFile.patch \
> +           file://0001-Make-the-lockfile-follow-with-statedir.patch \
> +           
> file://0002-Run-rpcbind.service-after-etc-tmpfiles.d-is-processe.patch \
>            "
>  SRC_URI[sha256sum] = 
> "5613746489cae5ae23a443bb85c05a11741a5f12c8f55d2bb5e83b9defeee8de"
>
> @@ -49,6 +52,9 @@ do_install:append () {
>                 ${UNPACKDIR}/init.d > ${D}${sysconfdir}/init.d/rpcbind
>         chmod 0755 ${D}${sysconfdir}/init.d/rpcbind
>         install -m 0644 ${UNPACKDIR}/rpcbind.conf 
> ${D}${sysconfdir}/rpcbind.conf
> +
> +       install -d ${D}${sysconfdir}/tmpfiles.d
> +       install -m 0644 ${UNPACKDIR}/rpcbind.tmpfiles 
> ${D}${sysconfdir}/tmpfiles.d/rpcbind.conf
>  }
>
>  ALTERNATIVE:${PN} = "rpcinfo"
> --
> 2.45.2
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#202542): 
https://lists.openembedded.org/g/openembedded-core/message/202542
Mute This Topic: https://lists.openembedded.org/mt/107559508/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to