From patchwork Fri Jul 26 11:24:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Wm9sdMOhbiBCw7ZzesO2cm3DqW55aQ==?= X-Patchwork-Id: 46871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2BF7C3DA49 for ; Fri, 26 Jul 2024 11:24:48 +0000 (UTC) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mx.groups.io with SMTP id smtpd.web10.58658.1721993079379844469 for ; Fri, 26 Jul 2024 04:24:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KOe//Uq0; spf=pass (domain: gmail.com, ip: 209.85.128.51, mailfrom: zboszor@gmail.com) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4280854e236so10865275e9.2 for ; Fri, 26 Jul 2024 04:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721993077; x=1722597877; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=P/a53LalKR+A9P+RQAJxTJRQkI9hvIeCXoUY3r5QXVs=; b=KOe//Uq0Fm89KNEks9LnZlYTL6bah1T2FLZwuiwcK4dCBlyY6oxJ0B4eDxWOeNsImZ wjeCO23wYRo/ebjnohAINe8OAA5wExtfOQD9o+ODddIT9L2Gthbrg/+4utAV7b12rkZz TWyEXqPkeeFCGDuASmbVsUh0DDeq/oRpxTbD1yxiPaPJKF9RhuAEJcZpOrveOw0eAxx5 yCWP4ihdHN7LUhJlO/QKI+MAAV1c2nxkdRQXP5p0+eoe2eaLYMG7kkI3rVHqyCnjNh3t CrMQxahfuHunnNVh6rguCZs9RizSv+s/C8+PLfh6QiCmh/arUTJxdhSMHSjTddzzHJAK jJWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721993077; x=1722597877; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=P/a53LalKR+A9P+RQAJxTJRQkI9hvIeCXoUY3r5QXVs=; b=cseZ6c1uE4o+SNGZx4AzR4im/rzORDFACmH4AId/be9BCqnm0eEdX/0AyM5cioke2V fY9glychSOryEvOQ42kzq4T22yhu4jxSA+hqa5cuIMBaQ1FuL/wD69i5p91dyBwUOkuW pHuL0wXxhGjIVgqWfMlKXxYL0Jp1YTvTV+T+1IFDcNJyj+FppPBvxZwhF700Kww0xWqG lYvZ9eERUwkqJf/yP7sjDm6ocllw1OEubciV4ceBigT+HkYCJeooCb1QP5DY9/YKoikc xhZkQDx4fIafWEugdw65jJkBz0wH1X/BIBrCreiDn4a+e4D1+JIl+giesyRYe62q02Eg V35Q== X-Gm-Message-State: AOJu0Yw1O0mEb9NIgdDVdLyUXdW1B/rdglUM/0iWoZRUAWoOC5Z65xGj DgIFbunRoI4q9l0kRQ4ivhvAt8Akmrccw2CUbtiAJuhUn5N/r7Xxu1n27Q== X-Google-Smtp-Source: AGHT+IH1QAVDers4kTqpAOgmQ9/jxKpDt67dFPKu8AHWBe9eMi90aN7aNJvla4EEtdN+0lPPF+bfZg== X-Received: by 2002:a05:6000:1faf:b0:367:95d2:4ec0 with SMTP id ffacd0b85a97d-36b31a7bebemr4778334f8f.62.1721993076509; Fri, 26 Jul 2024 04:24:36 -0700 (PDT) Received: from localhost.lan (dsl51B7D2F9.fixip.t-online.hu. [81.183.210.249]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b367e515fsm4886403f8f.45.2024.07.26.04.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 04:24:36 -0700 (PDT) From: =?utf-8?b?Wm9sdMOhbiBCw7ZzesO2cm3DqW55aQ==?= To: openembedded-core@lists.openembedded.org Cc: Joshua Watt , Richard Purdie , Steve Sakoman , =?utf-8?b?Wm9sdMOhbiBCw7ZzesO2cm3DqW55?= =?utf-8?b?aQ==?= Subject: [PATCH] rpcbind: Fix boot time start failure Date: Fri, 26 Jul 2024 13:24:31 +0200 Message-ID: <20240726112431.698884-1-zboszor@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 26 Jul 2024 11:24:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/202524 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. Signed-off-by: Zoltán Böszörményi --- ...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?= + +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 +--- + 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" + + 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?= + +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 +--- + 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 ++ + [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"