From patchwork Fri Aug 22 18:20:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 69059 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 0976ECA0EED for ; Fri, 22 Aug 2025 18:20:53 +0000 (UTC) Received: from AM0PR83CU005.outbound.protection.outlook.com (AM0PR83CU005.outbound.protection.outlook.com [52.101.69.43]) by mx.groups.io with SMTP id smtpd.web11.1257.1755886848386289118 for ; Fri, 22 Aug 2025 11:20:48 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=NsvxULlG; spf=pass (domain: axis.com, ip: 52.101.69.43, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VvAAKrPGJeWz5odn16Quxk+1U5zRlyvYNlSxhiQ9B2v7dnvNtUw08JPiCAnF4vw0ZBVyb+5ZbmYIbyU8ININ0NwkjB6KOkwqnqZqWYkiU61dBXycpzk1mCHZ+jKNddF7jSpxTbEH2NOo7ZYbVlw68RSfEvw/OEKuzvzay/HFqGm2ZEXmDFnFK2eo2TYBejS1hRIqwg5YT7sIDBVtOW7TwxUZTsfO3e+MVa1ZZ2io6I5wnw1GPT8iY3HnaZV6gDOaXAAqb5gHh5yvbf6samM6on2658bapI1yk7y5SU4iwJwXsUpgvScM5EO1SwWWKCgZsMhieuEMyNYv55NRZD8YjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=owr/n4LEmv6hxzh2YQ8ZW7Ac5jy/E+gaTSTu8cF0DvY=; b=PB4ZaxyYUOSi5a3CqdE85k2xp7NhaTl0t4PE8jynYqBQJJDda41dxDSy1/f/PpCprqCbDohRg1XM58/1QDh8JKB4Cmfn4SgHd4M80m/VTDwojmQIVKzO6AKusfVb1iGz7BsqKYc0xBH6CqotNHkhWoSaBxQdGiFy91foZ/nx0AyiL/ZgXpXX1o1MMfgjdmfyMrZ+teNAABor2YSU2BbkqHpYdWRdgSRvZBl5b5Ez7ejQgzEDbtUaotgqJ7PUd4sDbyaZKyFU11+JNrYA5pcmkbanZ7QAhVxzSH8/M+c9x8cEftSsmZGB1HLZIhoPGRLsuVkazrOEEGEcKQJx0bdjXg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=owr/n4LEmv6hxzh2YQ8ZW7Ac5jy/E+gaTSTu8cF0DvY=; b=NsvxULlGCYofdYhEiVxgD6kbMszneCf5JNpYK6T8m6DOxChR3QeasOGiIICCZC9czhZy5aLJaHij7HpnXADDWuUFgLnGH/ILxSONBPXQ6gG+C6wmfTpus3mcgKgg6GIsOpFmGNNzRvs0/50Xa9zDdzq8UvUOdm4zvb802uBdbtc= Received: from DB8PR03CA0036.eurprd03.prod.outlook.com (2603:10a6:10:be::49) by DB9PR02MB6748.eurprd02.prod.outlook.com (2603:10a6:10:210::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9052.17; Fri, 22 Aug 2025 18:20:42 +0000 Received: from DB5PEPF00014B92.eurprd02.prod.outlook.com (2603:10a6:10:be:cafe::83) by DB8PR03CA0036.outlook.office365.com (2603:10a6:10:be::49) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9052.17 via Frontend Transport; Fri, 22 Aug 2025 18:20:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DB5PEPF00014B92.mail.protection.outlook.com (10.167.8.230) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9052.8 via Frontend Transport; Fri, 22 Aug 2025 18:20:41 +0000 Received: from se-mail01w.axis.com (10.20.40.7) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Fri, 22 Aug 2025 20:20:41 +0200 Received: from se-intmail01x.se.axis.com (10.4.0.28) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2507.44 via Frontend Transport; Fri, 22 Aug 2025 20:20:41 +0200 Received: from pc56063-2339.se.axis.com (pc56063-2339.se.axis.com [10.92.3.2]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 75BC73213 for ; Fri, 22 Aug 2025 20:20:41 +0200 (CEST) Received: by pc56063-2339.se.axis.com (Postfix, from userid 14323) id 61ED4120312; Fri, 22 Aug 2025 20:20:41 +0200 (CEST) From: Peter Kjellerstedt To: Subject: [PATCHv6 1/2] systemd-systemctl-native: Install systemd-sysv-install Date: Fri, 22 Aug 2025 20:20:37 +0200 Message-ID: <20250822182038.1295769-1-pkj@axis.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B92:EE_|DB9PR02MB6748:EE_ X-MS-Office365-Filtering-Correlation-Id: 55735fd6-b033-4fac-2873-08dde1a89a7d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|36860700013|13003099007; X-Microsoft-Antispam-Message-Info: 5aimwhb55ggHqJ1/eQYUCoCwsEL1zG/JyAa6TaNMHAs5Bz7sDThdwh78l708N0d5oY4W/sOc+pV/Y5BKmztr7P4cYmj3DvO2kcZugggrNmBBRmuPLEEX5QJlWcR8i6CXE8fuUhwDJEZqbCDIZC3bPn9Eb6ze8uGx2sMsy7pSVFhxkUZKzXBr0MIYBGBBi3AY1Z910gz90Hlsrx+VVfWdXwl2g5MNXE2meEmcqz0aIwSd0i4PELTVpXgJgrRW1i2JdRekdxatzWjFxF5vUNTQE3LhIlPD7gU8vY60Cpt8Ps/W4/LIc9M1gDBsxV/CV+hZT7toKaOiZrjj0bIjJ01iKc13mCKWST3hb8AlLFDWlg9ScCFlrd6YCHObU1vw0uKLQ8Z+y42JBZ5hJoI9uUzJHb0gTlN2kDtWpwHG37A6rS4UfOdPAVX129huyBJ0qxkyoBbjlPRE+kLWSVsOFvg1uAtaipTXd2F5bNofeNlUjmshOQ8mr9bOPtGAQXIdE1Bzbj54dMiTyhKg3X+o4ElNgWhukri0OOqJ4LNBxaG/WvV5OZgwKSLg8uzI/c6tRr8Iv9qB1HvhFVfjOyLLufVw7QfLLmc7AQebix3NaIiEkTrt9/gkmGwzj6a4nkBdF7ix7a7TaMDNOkEutdsZseOl07b/WPumHDY3bhl8SpXY28z6U3fkoDZWUEdj/UFeA4SP1wqGVIo68z5hpZvnwLAggTD+7ZsGoMzMCX319qLzi8FaDYkXTlbBLn4tunDSJpaj8jx9djO7Q9gtxV50XN4T8OlyvtwzDox2wKpc0Sqd8fx3zbaK0xIQO+dABonNu2CVDheG38CN9/wnkluoAFbdpi0LpBUe9FmKQ/SxOY5pQ88Rf/+jTtljoG19+GN2ED8GZ0mOFJMeS6b8klfMU6jkWy5rCZlzYIOjZ+CclAN8V7jaaAHgMBVJVa9V5HJ5fMVajSFh98RidASmJseDvC5Um7rOVPiYrU5k2bFv9WKlCI5q4c7RBbrFsKR3vM4tRtEV7Li/QjyAUrHwVv7RMZn5yQXCmW+HYQhKZIx6Phq/A5CHHaZeKtSNKPRJaKMLN3ZlFw3hsnk7VLzZ6Tv74pPfkRmYGYqR0N5iT3n5YEsmljX50VIE8HYpA3goetAkWkOol6oVQ6WYlP2GxhhxD+ub2LYP8pwpia0zHuG+duGR6yD3jTVt5m0TdY1lH8CHQ02tfv6gK/mtz6txjf6eLsYV8MX24Zw7EnwQems93vISDP+V4SVONKB29ba0Uy5DG4vLURYPn9GwfbNpblQ6vawO6TYNli2t1OxIYs6QaZHXSLUNKHBBzZsKGpP0azIdANxio+lnw/yhZY+BgdNOU+jqamqLey1U7bgrB5k+rYcciJdE9ywIvZrxpiux6frdProY7Ktns7sh5fXkIUH84XvcXoea2B7bIlM6pi+9OCnMdWp7PGsWP1bF/GdWcmK6ro2KCtg40k0B1Pdcx+9h+Ssg7nvT2HtWts1w21faR/BlzRozHru+cdKyzb+0Mh0UnoX4 X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(82310400026)(36860700013)(13003099007);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2025 18:20:41.8607 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 55735fd6-b033-4fac-2873-08dde1a89a7d X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB5PEPF00014B92.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR02MB6748 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, 22 Aug 2025 18:20:53 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/222341 It is needed when support for both systemd and sysvinit are enabled. This also adds a patch for systemctl to call systemd-sysv-install without a hardcoded path and instead relies on finding it in $PATH. This is needed when calling systemctl from a recipe sysroot. Signed-off-by: Peter Kjellerstedt --- PATCHv2: New. PATCHv3: Change the Upstream-Status to Denied. PATCHv4: Add a Signed-off-by to the new patch. PATCHv5: Always install systemd-sysv-install. PATCHv6: Completely reworked the patch for systemctl. .../systemd/systemd-systemctl-native_257.8.bb | 11 ++++++ ...ll-systemd-sysv-install-without-path.patch | 37 +++++++++++++++++++ ...implment-systemd-sysv-install-for-OE.patch | 13 +++---- 3 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 meta/recipes-core/systemd/systemd/0001-systemctl-Call-systemd-sysv-install-without-path.patch diff --git a/meta/recipes-core/systemd/systemd-systemctl-native_257.8.bb b/meta/recipes-core/systemd/systemd-systemctl-native_257.8.bb index 041a040a26..4486edf651 100644 --- a/meta/recipes-core/systemd/systemd-systemctl-native_257.8.bb +++ b/meta/recipes-core/systemd/systemd-systemctl-native_257.8.bb @@ -1,9 +1,14 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/systemd:" + SUMMARY = "Systemctl executable from systemd" require systemd.inc DEPENDS = "gperf-native libcap-native util-linux-native python3-jinja2-native" +SRC_URI += "file://0001-systemctl-Call-systemd-sysv-install-without-path.patch" +SRC_URI += "file://0002-implment-systemd-sysv-install-for-OE.patch" + inherit pkgconfig meson native MESON_TARGET = "systemctl:executable" @@ -14,3 +19,9 @@ EXTRA_OEMESON += "-Dlink-systemctl-shared=false" # determined at run-time, but rather set during configure # More details are here https://github.com/systemd/systemd/issues/35897#issuecomment-2665405887 EXTRA_OEMESON += "--sysconfdir ${sysconfdir_native}" + +do_install:append() { + # Install systemd-sysv-install in /usr/bin rather than /usr/lib/systemd + # (where it is normally installed) so systemctl can find it in $PATH. + install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${bindir}/systemd-sysv-install +} diff --git a/meta/recipes-core/systemd/systemd/0001-systemctl-Call-systemd-sysv-install-without-path.patch b/meta/recipes-core/systemd/systemd/0001-systemctl-Call-systemd-sysv-install-without-path.patch new file mode 100644 index 0000000000..bf08dbe9b0 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-systemctl-Call-systemd-sysv-install-without-path.patch @@ -0,0 +1,37 @@ +From 34c8551a8b16bf235a1ebe8d9cb1a3474a7c975e Mon Sep 17 00:00:00 2001 +From: Peter Kjellerstedt +Date: Fri, 22 Aug 2025 18:07:28 +0200 +Subject: [PATCH] systemctl: Call systemd-sysv-install without path + +Expect to find systemd-sysv-install in $PATH instead of hardcoding the +path to it, as the latter does not work when running systemctl from a +recipe sysroot. + +Signed-off-by: Peter Kjellerstedt +Upstream-Status: Inappropriate [OE specific] +--- + src/systemctl/systemctl-sysv-compat.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/systemctl/systemctl-sysv-compat.c b/src/systemctl/systemctl-sysv-compat.c +index cb9c43e3dc..e44ef9f64e 100644 +--- a/src/systemctl/systemctl-sysv-compat.c ++++ b/src/systemctl/systemctl-sysv-compat.c +@@ -140,7 +140,7 @@ int enable_sysv_units(const char *verb, char **args) { + while (args[f]) { + + const char *argv[] = { +- LIBEXECDIR "/systemd-sysv-install", ++ "systemd-sysv-install", + NULL, /* --root= */ + NULL, /* verb */ + NULL, /* service */ +@@ -218,7 +218,7 @@ int enable_sysv_units(const char *verb, char **args) { + return j; + if (j == 0) { + /* Child */ +- execv(argv[0], (char**) argv); ++ execvp(argv[0], (char**) argv); + log_error_errno(errno, "Failed to execute %s: %m", argv[0]); + _exit(EXIT_FAILURE); + } diff --git a/meta/recipes-core/systemd/systemd/0002-implment-systemd-sysv-install-for-OE.patch b/meta/recipes-core/systemd/systemd/0002-implment-systemd-sysv-install-for-OE.patch index d8bb572261..98d050ceae 100644 --- a/meta/recipes-core/systemd/systemd/0002-implment-systemd-sysv-install-for-OE.patch +++ b/meta/recipes-core/systemd/systemd/0002-implment-systemd-sysv-install-for-OE.patch @@ -1,7 +1,7 @@ -From fab8c573d06340868f070446118673b1c23584c5 Mon Sep 17 00:00:00 2001 +From 4a5602ede9881fd8e578a3c8bc40dd5df7c4d802 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 5 Sep 2015 06:31:47 +0000 -Subject: [PATCH 02/26] implment systemd-sysv-install for OE +Subject: [PATCH] implement systemd-sysv-install for OE Use update-rc.d for enabling/disabling and status command to check the status of the sysv service @@ -14,7 +14,7 @@ Signed-off-by: Khem Raj 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON -index cb58d8243b..000bdf6165 100755 +index cb58d8243b..eff3f5f579 100755 --- a/src/systemctl/systemd-sysv-install.SKELETON +++ b/src/systemctl/systemd-sysv-install.SKELETON @@ -34,17 +34,17 @@ case "$1" in @@ -22,13 +22,13 @@ index cb58d8243b..000bdf6165 100755 # call the command to enable SysV init script $NAME here # (consider optional $ROOT) - echo "IMPLEMENT ME: enabling SysV init.d script $NAME" -+ update-rc.d -f $NAME defaults ++ update-rc.d ${ROOT:+-r $ROOT} -f $NAME defaults ;; disable) # call the command to disable SysV init script $NAME here # (consider optional $ROOT) - echo "IMPLEMENT ME: disabling SysV init.d script $NAME" -+ update-rc.d -f $NAME remove ++ update-rc.d ${ROOT:+-r $ROOT} -f $NAME remove ;; is-enabled) # exit with 0 if $NAME is enabled, non-zero if it is disabled @@ -38,6 +38,3 @@ index cb58d8243b..000bdf6165 100755 ;; *) usage ;; --- -2.34.1 - From patchwork Fri Aug 22 18:20:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 69058 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 0A533CA0EEB for ; Fri, 22 Aug 2025 18:20:53 +0000 (UTC) Received: from MRWPR03CU001.outbound.protection.outlook.com (MRWPR03CU001.outbound.protection.outlook.com [40.107.130.30]) by mx.groups.io with SMTP id smtpd.web10.1192.1755886847889624856 for ; Fri, 22 Aug 2025 11:20:48 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=eTopu66F; spf=pass (domain: axis.com, ip: 40.107.130.30, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JRg5HpBKhnUexh8AYGcRY9KIjTRUteBkW8825/CxuXMpnu7+Ry39hMhginxXftlPsfkm+hWvAZQtFDaiddE/+w/FxnNGfsPXe+vhgxUBmOh7JKMX9o/IR/qahuu3ZLpnwbNY+krik7d/1YRy60AX12Z9V5KBQMiit3x2zh0fK+/GEsE7esVZWpcZvDZ8pIhrsBeUwcTFtE14bZZHMTPjm51Od4vtIH2GgbaV1t1+8DMAx/hjgNKx4Rn5tiMR8hzMgl/tSNGDQoxD8HahyfSRX4/pMPFaawrSxD1f69y91Sloh1lXi1KRYY6nhf1PY3ke/DpdJ9HNVYZbkYR3Itk30g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7ZZ1tG9G2eftgEzF+JwBSeSDQ2KDKKipf2hhO0OyXwU=; b=rGcr8kk8gEF2XjIH7yDjH8h2W+7NgIqa1GhhaUgloQ5EVXxEdA2sWq3UV0x0pLcBiXxRKMnThJ4nBHJaZrpRJA0MjXUwxlG1CAICHT9HayHxAUbx0OCDSwcAf9eqcF4gCVpuQV/XuXe6L/d12HrBDkJ+pMQlKudMON0CJSglVL2PBcOhmrPfncwmoaG4+Y8Wuz3ylmQBc4vZ193QfYABVgDV0h59HVnesmbnXmt27hXRx1sxkKjfo6b9uOLjWTPb+YXBz+JYuv+8B8KvxXJzudQZ7mqUucK1CMPFWRxX2VSojSjw3f6n32He5rV43eeTJSqomteNrgo7xF7+c6gEsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7ZZ1tG9G2eftgEzF+JwBSeSDQ2KDKKipf2hhO0OyXwU=; b=eTopu66F8DN3fgkMa2NK+WnA14oDk43yNSfvZiCvh9fcXWbfTaDJNQvHSTDOeuCSgkS8HGmaROmvrfkM+IQJ/cuFcyUiwNPFjXC7kcY/pbkWj2IU8qPO4n5MuVJ0Acp+yh8bL3LIn3Uu1EAZmrlC/TJMoR3qAGk/kJ7OeqI6p/8= Received: from DB8PR03CA0021.eurprd03.prod.outlook.com (2603:10a6:10:be::34) by DB9PR02MB7940.eurprd02.prod.outlook.com (2603:10a6:10:33a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9052.17; Fri, 22 Aug 2025 18:20:42 +0000 Received: from DB5PEPF00014B92.eurprd02.prod.outlook.com (2603:10a6:10:be:cafe::6a) by DB8PR03CA0021.outlook.office365.com (2603:10a6:10:be::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9052.19 via Frontend Transport; Fri, 22 Aug 2025 18:20:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DB5PEPF00014B92.mail.protection.outlook.com (10.167.8.230) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9052.8 via Frontend Transport; Fri, 22 Aug 2025 18:20:42 +0000 Received: from se-mail02w.axis.com (10.20.40.8) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Fri, 22 Aug 2025 20:20:41 +0200 Received: from se-intmail02x.se.axis.com (10.4.0.28) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server id 15.1.2507.44 via Frontend Transport; Fri, 22 Aug 2025 20:20:41 +0200 Received: from pc56063-2339.se.axis.com (pc56063-2339.se.axis.com [10.92.3.2]) by se-intmail02x.se.axis.com (Postfix) with ESMTP id 76FCD29B0 for ; Fri, 22 Aug 2025 20:20:41 +0200 (CEST) Received: by pc56063-2339.se.axis.com (Postfix, from userid 14323) id 64273120094; Fri, 22 Aug 2025 20:20:41 +0200 (CEST) From: Peter Kjellerstedt To: Subject: [PATCHv6 2/2] systemd.bbclass: Make systemd_postinst run as intended Date: Fri, 22 Aug 2025 20:20:38 +0200 Message-ID: <20250822182038.1295769-2-pkj@axis.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250822182038.1295769-1-pkj@axis.com> References: <20250822182038.1295769-1-pkj@axis.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B92:EE_|DB9PR02MB7940:EE_ X-MS-Office365-Filtering-Correlation-Id: dbf2260f-492a-4cc0-39c1-08dde1a89af0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024|13003099007; X-Microsoft-Antispam-Message-Info: OQfvl7HD9qe4Pp3gUtpfOX/F5MQM5S7DWCvurvbYd0JOpqlzI2L+ZptrepT3aPJX3JwESsu33jEh8q+rH0JHGzvHqKiqJI/QLfg1gpNev/o2ZPZkk9ZGm2TsDuEFSrtfTS1ruevPVKIOEugjz201NmhOA6nhnfZ6z4+0szJXnYVpBpSzliCtVJynxabZ4ZVCTl75YQB6oyS93PGwPKST5cF7uqD05hcAonyIy45H/QJ12ZAlctKKMAY5E1+j4quV7K1Z/nmfFmfBYkemRGDq7IRSnOoexjci4MLyNGn3zK4VJL8GPLiNGhZu+G2gPyQAIVNEiNCF9kxsn91JjuQ3q8s02g89TS4q4CAcvU/I699UF6yJaNKDITzouSUTuT7t3OzuUDq27n0BGfsLusFKmx5YSZZdw3ILdRc9Rj3vUkEpVDSfDymfjatS8TlyLmWQZefUMzDfiGGQeqhmEwADLjWRBes3PVj0VOAWvrCh+gG0V9aaYaPtsXkDk90hxGM9koz2/Y8ilt1XEVSY2tq6rc3VwktfpKGnLBdW/M9jGRb50h1wNM6pEVx6OWAreavzralODjPGrUy+e24okFxN7HwSeSVAqEHgGU+U8cuZhQqcPDPko9sW1lBDgbNlmInPlhYeiOfEUIKr/IYzviqpqVA05HaWKak1FF9PCI4eU/aw/y1OAKMyVK98c3TwysX7YF8HLqDDeJmBH5SBx212MF7xl07l4KBzJZaDYVYtj4E+lyyL90dAKjPcQ8YLRHwrA1Xw2yJDmirtdSuWA/C2ueV8JQqWzEh0ingWHk7CA5FUNGUTnYo094IDHVr/Cg3TnFFZ8M76LsfWM8qxfo5I8oLkXEb+n2SLDHfeTek2DAeWyRpzUMkasmvs7ZlnoZrRfQiBBaKJLjKvgdLGTD1nUKVOaroBGdy/dLobuEjm4MlCgrxPzvrWKevhqvWXMa/KVuXhl7r/PdkEyeOyWJzsLABQnvM8cGzkxT0IOroFdowise3dIIXvf7Zo2292I0H80Iqb66ruApj/qY7ZCWXvyoVaFeo9OM/VVTnhwB2/IzK8ulY0Ua3RKGAbYyBsPt6VUi5OdKR/XIvkBlioeDNWv2DvIBEu6aasBmxHFaLWLpM2tDZ1UcyCteSglCLm9+cx1QOL9ryzrM7F7YihKgSaJHL+CDQueWK6lIlWsM3e1z8VYJbFfk+t7KmgQt0s9H8dorS+pSKTlAbHO0MbFI9DVUoQeoPlaxfHS4isvrDY5kUDPg+OLfoD4+nM3MOxfwP+UyCUaAu1IgDGF+DeFY6prTJm7gu/rPD2+6tCk5tr6b1hA6w5MAzoB9mDRzew8ogd3kywPPzzU1okty8Z5I+PD33vwKoeSC9BNEJRbZwK1QnfscWZu7POMYLrebfSDtWxaY5x+jWzE/YYHiSjC1iynXNDaqfedntyPaX07ArXmV2WgoH7855q+2oWb0TFt+ZQyaEvo3L7J8gPSdTUfuMDvFjxWwqmfKXmNsvBF903bvdADTmVjwr730UR6Z0mN0Oj X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024)(13003099007);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2025 18:20:42.6151 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dbf2260f-492a-4cc0-39c1-08dde1a89af0 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB5PEPF00014B92.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR02MB7940 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, 22 Aug 2025 18:20:53 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/222340 After the switch from using a systemctl written in Python to using the official version of systemctl from the systemd project, the systemd_postinst function has effectively not been executed during the rootfs creation. The reason is that systemctl provided by systemctl-native fails if run without arguments (as systemd_postinst does): Failed to connect to system scope bus via local transport: Operation not permitted (consider using --machine=@.host --user to connect to bus of other user) This is not seen in the logs since stderr is sent to /dev/null, and the only way to tell that there is a problem is because systemd services that are expected to be enabled aren't running. The reason this has gone unnoticed is because systemd_handle_machine_id in rootfs-postcommands.bbclass will call systemctl preset-all, which in most cases will create the missing links to enable the systemd services. This change effectively reverts commit a52e66762c0c51918b1ba3d4622759637b6e920a (systemd.bbclass: update command to check systemctl available) and instead only runs systemctl without arguments (to determine that it can communicate with systemd) when executed on target. Signed-off-by: Peter Kjellerstedt --- PATCHv2: Add --sysv-install= to $OPTS to instruct systemctl where to look for systemd-sysv-install. PATCHv3: No changes. PATCHv4: No changes. PATCHv5: No changes. PATCHv6: Removed the --sysv-install= parameter again. meta/classes-recipe/systemd.bbclass | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/classes-recipe/systemd.bbclass b/meta/classes-recipe/systemd.bbclass index 0e9f7cfa33..4e687135f1 100644 --- a/meta/classes-recipe/systemd.bbclass +++ b/meta/classes-recipe/systemd.bbclass @@ -29,7 +29,7 @@ python __anonymous() { } systemd_postinst() { -if systemctl >/dev/null 2>/dev/null; then +if type systemctl >/dev/null 2>/dev/null; then OPTS="" if [ -n "$D" ]; then @@ -46,7 +46,7 @@ if systemctl >/dev/null 2>/dev/null; then done fi - if [ -z "$D" ]; then + if [ -z "$D" ] && systemctl >/dev/null 2>/dev/null; then # Reload only system service manager # --global for daemon-reload is not supported: https://github.com/systemd/systemd/issues/19284 systemctl daemon-reload @@ -66,8 +66,8 @@ fi } systemd_prerm() { -if systemctl >/dev/null 2>/dev/null; then - if [ -z "$D" ]; then +if type systemctl >/dev/null 2>/dev/null; then + if [ -z "$D" ] && systemctl >/dev/null 2>/dev/null; then if [ -n "${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", False, d)}" ]; then systemctl stop ${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", False, d)} systemctl disable ${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", False, d)}