From patchwork Sun Aug 17 20:14:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 68686 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 DE2BACA0EE4 for ; Sun, 17 Aug 2025 20:15:12 +0000 (UTC) Received: from PA4PR04CU001.outbound.protection.outlook.com (PA4PR04CU001.outbound.protection.outlook.com [40.107.162.27]) by mx.groups.io with SMTP id smtpd.web10.60140.1755461707244815663 for ; Sun, 17 Aug 2025 13:15:07 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=ekpSeZ4f; spf=pass (domain: axis.com, ip: 40.107.162.27, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PHebN8fWd4PkM4CusdWNXkVfKRuXB06Fr1ZQxyn7/0LuXnKuJle2rXLjZBYeWaoqBC9OZMdL9nMMP8urwou0WbUGDAycRAwYFbf4RfYihc10NVVT0AbGu+C5kD/6aFGXvfVFMtgNsBNpa/TISrlSp2MYfSS02dQMmScDEGLrSS4DYf10HmnHJ2Ow+2s017BHXbDJK/5MERfzUXmzlzd1N1S12rCmtCBJyNTVAMJEtkMpH2yX/M2O2dn5cUZGvvdheo42IoskeiE59Rl2Wqxn5QumVlCZuhL/5jO6RwWtdabx6PvEnOHxtOBc1XCqhx0zqatPmrZv9JPHaiqs8U/jbg== 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=5/WlRvx2t+sNxAr3j4t4PN/qWNcJO37agaNuZktS3zA=; b=mcFrcdXJ7sc7XAAzDjcBijvxOGTm5g/vrGhWWSo8Kyyo97heTLavmcWabBEXGfh1pYU1jkZBfupEmqtO3up/DHmgIE599y/KQw3Op9igS1K9lgal5KCaso9Ve1eGmr8+3/2JTudhGCY/vRqLcAVxGozFzLd5MsMqwPf9mIp4y5yh0/Dcut5wXPvAR/Qs+iP04evx5xYpr5D4K0MJeRjbWFmTjaRy1MsS9N5yzsIS2kMLSE8/LPJa7Q3N41gEAJyXGXoMa/HUpu6Fe7dJJykzjxmsa9jp+2bC7fIkQ9NDnDppvEFhWJ9/aJCWUN20C5TFQrA32FNYauxWfX5Le2Qc4w== 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=5/WlRvx2t+sNxAr3j4t4PN/qWNcJO37agaNuZktS3zA=; b=ekpSeZ4fMBqsDnxKw/Mwyn+xA0qelF04TJbsgHLrs0ucThnM5gmjPukf158kw9GQVjZL249cMx+PLTQL6tLFFQi1//MthA58l3leGjXY3C2qXadR9aVQzRiJQYOTpt6TlLrRN6QSmseY12WL0gLYnChyGOgtiYI6NHlkmlSdbFM= Received: from DU2PR04CA0269.eurprd04.prod.outlook.com (2603:10a6:10:28e::34) by DU7PPFDE370A5BB.eurprd02.prod.outlook.com (2603:10a6:18:3::ce0) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9031.24; Sun, 17 Aug 2025 20:15:00 +0000 Received: from DB1PEPF000509E5.eurprd03.prod.outlook.com (2603:10a6:10:28e:cafe::b5) by DU2PR04CA0269.outlook.office365.com (2603:10a6:10:28e::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9031.19 via Frontend Transport; Sun, 17 Aug 2025 20:15:00 +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 DB1PEPF000509E5.mail.protection.outlook.com (10.167.242.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9052.8 via Frontend Transport; Sun, 17 Aug 2025 20:15:00 +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; Sun, 17 Aug 2025 22:14:59 +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; Sun, 17 Aug 2025 22:14:59 +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 CA92823BB for ; Sun, 17 Aug 2025 22:14:59 +0200 (CEST) Received: by pc56063-2339.se.axis.com (Postfix, from userid 14323) id BBA6C1203B4; Sun, 17 Aug 2025 22:14:59 +0200 (CEST) From: Peter Kjellerstedt To: Subject: [PATCHv3 1/2] systemd-systemctl-native: Install systemd-sysv-install Date: Sun, 17 Aug 2025 22:14:57 +0200 Message-ID: <20250817201458.2461468-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: DB1PEPF000509E5:EE_|DU7PPFDE370A5BB:EE_ X-MS-Office365-Filtering-Correlation-Id: cca96702-bd3a-426e-751e-08ddddcabe59 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013|13003099007; X-Microsoft-Antispam-Message-Info: AWVrJWAZyNyZTDfjar7TiGzXUQEl49Zh1+YpCfjwO/Wxxn9/fsNPvKCy5gFna+mMZK5FYZlZpAsAU6TQtMgfsUEfxkpSJYZKCywsnznIi/xd5SnyMVi+C3hbUR0JX6Hsx9wkDfxduiW4dFJJ/3+CDVGOm35HX7YLPQWXdthXyVVJEJnV1bQL4QtfBXZxLuJgTJOcHAKxMs3D78CLhsobY6pqNTxl+7q8mU8B53/UIRn8SHjYMhVj3H2dddWM59nO4RVEmr0PydZR+4hADevrwLegqVQR7bVYCXfI5MsMOBJeYy/wb4Xf6NDvJI+0o+xADa/c8cYTztBSsWi1LZliW5e5dVWPJ3AcKE4z4blWSm+3ULcIRCvjopaOjYB215FPshss4jki/QAQChJz2uIXEQWSgDdB9JVq4fNlwq0QfFYSH9wbF6WVoPoB7W6T/G4K0iqCYSqvXswPKOTp+WVGkLp2/NArNJzvdGaiO3CfP2JCQB2HWvzMTBBlf3Al2FZXv16SVKmWhJACbI+7fJ8diyaSbFUjzbcSbj51R6DAj2k0EfU8I+YYEIbh9yAeEqn3aDLwKizHyDkl28R5O9RfHbdGCxOm1NU16N/04RXNjsXjt+2ylB/AVhUoJEoR9kS4smf69z+Os5TSUEl18o9MEtBKn6RX/BZWttu+JylS1wew9xSoXTcEFbRaWM0qfFt2tUO7lBjvhnmexX56mvwROOVj6uHUwtlO7bFQVInoWM7Ud/kl9QjD5MHpN3qAsvc6ovoIu5jJKNcSnTXdXOtFvOwVs/5kcefiKLNnqq6JpohsRzB5FuDrHBgu7iDwJuGofYDGJNML9iAmdiUzltqmz3JZRCab/E/QwFKeERNz6magBSHTfbPNGd8gR121grsPONAkRu0chLOb8cnGXwNvm/dmVf+20U+VKXvZJsXRdQwAMPt4/xpxJITG6ZuqXoR1c4OrYK1UGkkYfJgE83xQwsGlJRKV7a/ycs1zIm/wvHJi3Hqiz5DlrLTuqSI2fiG9N3OddcLMdoKHJlruaCYSdsEgWUIq2ogtrrLUb/sanxEqk2mEr3f9T6DO6HW926VUUdHoldxZNtanwxR/Ex1whmz67XbueFAaN1N9407BgMleWZPepi89NJFAacRq/PoDh8T4pao6D4GalM7/uY7XimHHoNZtsQPaqLRqnTx3/otAaoiWyC8KTgAMfHvGtF47Nv55KO6lXNY1BM30tsYHk+JRiP9IsNdu86vHFx01K4lD21drTeIGtmQdZfnJT4rcjNbwX8vdLn2ZeTk1vmQVKPZwA/NcUsUrmjP652XFj6AIrtqo9Ii1Bwqi4iRgKK2ExmFfQDJ1YvOV5gzmo0xYLxHlwPN1MmNcbBxhwQ0cfKgVEMlXAoW7EVUqqX01w4+BAI/5018GfkcVquWtHfK/XCyUkm17TbtlF+B3mFCaQUNpdyvS+c5fymwqCEDXOTy5AR3IBnZebEjiTZ/NMxaZhw== 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)(82310400026)(1800799024)(376014)(36860700013)(13003099007);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2025 20:15:00.2583 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cca96702-bd3a-426e-751e-08ddddcabe59 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: DB1PEPF000509E5.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU7PPFDE370A5BB 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 ; Sun, 17 Aug 2025 20:15:12 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/222014 It is needed when support for both systemd and sysvinit are enabled. This also adds a patch for systemctl to allow the path to systemd-sysv-install to be specified in runtime. This is needed because the hardcoded path that is built into systemctl does not match the path to where it will eventually be executed. Signed-off-by: Peter Kjellerstedt --- PATCHv2: New. PATCHv3: Change the Upstream-Status to Denied. .../systemd/systemd-systemctl-native_257.8.bb | 16 ++ ...sv-install-to-specify-path-to-system.patch | 144 ++++++++++++++++++ ...implment-systemd-sysv-install-for-OE.patch | 13 +- 3 files changed, 165 insertions(+), 8 deletions(-) create mode 100644 meta/recipes-core/systemd/systemd/0001-systemctl-Add-sysv-install-to-specify-path-to-system.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..6030ab7acf 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-Add-sysv-install-to-specify-path-to-system.patch" +SRC_URI += "file://0002-implment-systemd-sysv-install-for-OE.patch" + inherit pkgconfig meson native MESON_TARGET = "systemctl:executable" @@ -14,3 +19,14 @@ 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() { + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + # Use ${libdir}/systemd rather than ${systemd_unitdir} here + # because the latter is affected by whether the usrmerge distro + # feature is set _for native_ (which it typically isn't), and we + # need to know the path to systemd-sysv-install in the + # systemd.bbclass when building _for target_. + install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${libdir}/systemd/systemd-sysv-install + fi +} diff --git a/meta/recipes-core/systemd/systemd/0001-systemctl-Add-sysv-install-to-specify-path-to-system.patch b/meta/recipes-core/systemd/systemd/0001-systemctl-Add-sysv-install-to-specify-path-to-system.patch new file mode 100644 index 0000000000..fb79ceecc6 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-systemctl-Add-sysv-install-to-specify-path-to-system.patch @@ -0,0 +1,144 @@ +From eb02a1bf3bfcc73302c7849cedfa756799168c5d Mon Sep 17 00:00:00 2001 +From: Peter Kjellerstedt +Date: Thu, 14 Aug 2025 22:48:00 +0200 +Subject: [PATCH] systemctl: Add --sysv-install to specify the path to + systemd-sysv-install + +This allows the path to systemd-sysv-install to be specified in runtime. + +The hardcoded path to systemd-sysv-install in systemctl causes problems +when they need to be run from some other location than the expected, +e.g., when used in a sysroot. + +Upstream-Status: Denied [https://github.com/systemd/systemd/pull/38614] +--- + man/systemctl.xml | 13 +++++++++++++ + src/systemctl/systemctl-sysv-compat.c | 6 +++++- + src/systemctl/systemctl.c | 11 +++++++++++ + src/systemctl/systemctl.h | 1 + + 4 files changed, 30 insertions(+), 1 deletion(-) + +diff --git a/man/systemctl.xml b/man/systemctl.xml +index be9fa4803c..ad1bbaf1a1 100644 +--- a/man/systemctl.xml ++++ b/man/systemctl.xml +@@ -2885,6 +2885,19 @@ EOF + + + ++ ++ ++ ++ ++ When used with ++ enable/disable/is-enabled ++ on a unit that is a SysV init.d script, use the specified path instead of ++ /usr/lib/systemd/systemd-sysv-install to call the ++ distribution's mechanism for enabling/disabling it. ++ ++ ++ ++ + + + +diff --git a/src/systemctl/systemctl-sysv-compat.c b/src/systemctl/systemctl-sysv-compat.c +index cb9c43e3dc..96b3c451f0 100644 +--- a/src/systemctl/systemctl-sysv-compat.c ++++ b/src/systemctl/systemctl-sysv-compat.c +@@ -3,6 +3,7 @@ + #include + #include + #include ++#include + + #include "env-util.h" + #include "fd-util.h" +@@ -132,6 +133,9 @@ int enable_sysv_units(const char *verb, char **args) { + "is-enabled")) + return 0; + ++ if (arg_sysv_install && access(arg_sysv_install, X_OK) < 0) ++ return log_error_errno(errno, "%s is not executable: %m", arg_sysv_install); ++ + r = lookup_paths_init_or_warn(&paths, arg_runtime_scope, LOOKUP_PATHS_EXCLUDE_GENERATED, arg_root); + if (r < 0) + return r; +@@ -140,7 +144,7 @@ int enable_sysv_units(const char *verb, char **args) { + while (args[f]) { + + const char *argv[] = { +- LIBEXECDIR "/systemd-sysv-install", ++ arg_sysv_install ?: LIBEXECDIR "/systemd-sysv-install", + NULL, /* --root= */ + NULL, /* verb */ + NULL, /* service */ +diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c +index 8c9fcb69f2..1e718e7d87 100644 +--- a/src/systemctl/systemctl.c ++++ b/src/systemctl/systemctl.c +@@ -126,6 +126,7 @@ bool arg_mkdir = false; + bool arg_marked = false; + const char *arg_drop_in = NULL; + ImagePolicy *arg_image_policy = NULL; ++char *arg_sysv_install = NULL; + + STATIC_DESTRUCTOR_REGISTER(arg_types, strv_freep); + STATIC_DESTRUCTOR_REGISTER(arg_states, strv_freep); +@@ -141,6 +142,7 @@ STATIC_DESTRUCTOR_REGISTER(arg_boot_loader_entry, unsetp); + STATIC_DESTRUCTOR_REGISTER(arg_clean_what, strv_freep); + STATIC_DESTRUCTOR_REGISTER(arg_drop_in, unsetp); + STATIC_DESTRUCTOR_REGISTER(arg_image_policy, image_policy_freep); ++STATIC_DESTRUCTOR_REGISTER(arg_sysv_install, freep); + + static int systemctl_help(void) { + _cleanup_free_ char *link = NULL; +@@ -348,6 +350,7 @@ static int systemctl_help(void) { + " --when=TIME Schedule halt/power-off/reboot/kexec action after\n" + " a certain timestamp\n" + " --stdin Read new contents of edited file from stdin\n" ++ " --sysv-install=PATH The path to systemd-sysv-install\n" + "\nSee the %2$s for details.\n", + program_invocation_short_name, + link, +@@ -475,6 +478,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) { + ARG_DROP_IN, + ARG_WHEN, + ARG_STDIN, ++ ARG_SYSV_INSTALL, + }; + + static const struct option options[] = { +@@ -543,6 +547,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) { + { "drop-in", required_argument, NULL, ARG_DROP_IN }, + { "when", required_argument, NULL, ARG_WHEN }, + { "stdin", no_argument, NULL, ARG_STDIN }, ++ { "sysv-install", required_argument, NULL, ARG_SYSV_INSTALL }, + {} + }; + +@@ -1052,6 +1057,12 @@ static int systemctl_parse_argv(int argc, char *argv[]) { + arg_stdin = true; + break; + ++ case ARG_SYSV_INSTALL: ++ r = parse_path_argument(optarg, false, &arg_sysv_install); ++ if (r < 0) ++ return r; ++ break; ++ + case '.': + /* Output an error mimicking getopt, and print a hint afterwards */ + log_error("%s: invalid option -- '.'", program_invocation_name); +diff --git a/src/systemctl/systemctl.h b/src/systemctl/systemctl.h +index 00405f4705..1db16d0183 100644 +--- a/src/systemctl/systemctl.h ++++ b/src/systemctl/systemctl.h +@@ -105,6 +105,7 @@ extern bool arg_mkdir; + extern bool arg_marked; + extern const char *arg_drop_in; + extern ImagePolicy *arg_image_policy; ++extern char *arg_sysv_install; + + static inline const char* arg_job_mode(void) { + return _arg_job_mode ?: "replace"; 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..20a2f01317 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 b9fb0368fa54655eccb086b4152f3a2824d2ad53 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 Sun Aug 17 20:14:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 68685 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 E2637CA0EE9 for ; Sun, 17 Aug 2025 20:15:12 +0000 (UTC) Received: from MRWPR03CU001.outbound.protection.outlook.com (MRWPR03CU001.outbound.protection.outlook.com [40.107.130.0]) by mx.groups.io with SMTP id smtpd.web11.59863.1755461707088381459 for ; Sun, 17 Aug 2025 13:15:07 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=Vtlf/cBb; spf=pass (domain: axis.com, ip: 40.107.130.0, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BXyk66KQNUOyvqgZdXAGZCHer2pDwybZbUnTRkNF5wgPzpvM9RhDHQzobAqRrQmD3Aj9SA1xUajQxOPzRSQPNK2D2v33LYb1YYFmqZfZcDbTySThK7Jqx4AGZNTLA/J65dRwM/QrxJcB172WRi9rXYQuK5Eo769vJEz7OQsT/+ftmCt8J2B/W54/fv6y4lA3QM+dqN29rS2QUo0I8BeTNlO6hlLm84A13J7WjjFinPAYlS27/XYDQeZPo0waOAnWyldCsWFSx0MVqNuQHcpkRXI8/a21HRglYfyyJ1Kzflxjl1NQ13nFTKLbHCaSW0Ba0W/CJE9wnwEA1sxgzFJoNA== 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=7RNK8/ImyZZ7R9qgmRniV8UatVAo7eKNdnEVMHLqmMc=; b=pKX2uX2R9XStqV1Kn3FRGtn04tSezWK+1JNn80hAh8+Ov+qRYmRj/xgB3kBaqLNLrSOHRm6+mA2L8sJOV5ZqFXCkIoShKhLE9h+D8RnEL8yqYpce6n0Ch2tk3ES+Z3cnK2qGhWODOnoPRUgeRIvIBQdko9nU7NN4vvLOgIW7f2fSQo9Y/VFVho+WZxIGLuH8QCaKS1kOzG+VKADeCLgnSFvQlK1YYk16tpLqErVVB85UgYLu8gOIjc6D6FZ7932rsnbC8ArUeGFnyPGUPwZmkrJBqFkBigpabHob1+oBtF8RBf2TQGhiZqB8veG2MMNSUK6Qgv4sGP+XEScDReep/g== 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=7RNK8/ImyZZ7R9qgmRniV8UatVAo7eKNdnEVMHLqmMc=; b=Vtlf/cBbNjvQiTYffSgq3JzEfasehF0diyGTFoMo5f1Yh9FnqBsuxUsyeWpjB9YDb+nsLt+ettUMqKVECdkMbLFdzvdX4Gbv55n2vJZ+2p1JIPUB36IkDAq7K34jZKSVoAygyzbw0tut+a/WQCXO8dfc9hj+2ndLxq3g4Pt0WhI= Received: from DU2PR04CA0242.eurprd04.prod.outlook.com (2603:10a6:10:28e::7) by PA3PR02MB11163.eurprd02.prod.outlook.com (2603:10a6:102:4b4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9031.18; Sun, 17 Aug 2025 20:15:01 +0000 Received: from DB1PEPF000509E5.eurprd03.prod.outlook.com (2603:10a6:10:28e:cafe::ef) by DU2PR04CA0242.outlook.office365.com (2603:10a6:10:28e::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9031.20 via Frontend Transport; Sun, 17 Aug 2025 20:15:01 +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 DB1PEPF000509E5.mail.protection.outlook.com (10.167.242.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9052.8 via Frontend Transport; Sun, 17 Aug 2025 20:15:01 +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; Sun, 17 Aug 2025 22:14:59 +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; Sun, 17 Aug 2025 22:14:59 +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 CDCED2976 for ; Sun, 17 Aug 2025 22:14:59 +0200 (CEST) Received: by pc56063-2339.se.axis.com (Postfix, from userid 14323) id BE2BB12006E; Sun, 17 Aug 2025 22:14:59 +0200 (CEST) From: Peter Kjellerstedt To: Subject: [PATCHv3 2/2] systemd.bbclass: Make systemd_postinst run as intended Date: Sun, 17 Aug 2025 22:14:58 +0200 Message-ID: <20250817201458.2461468-2-pkj@axis.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250817201458.2461468-1-pkj@axis.com> References: <20250817201458.2461468-1-pkj@axis.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509E5:EE_|PA3PR02MB11163:EE_ X-MS-Office365-Filtering-Correlation-Id: 847b9346-d057-4ed6-791e-08ddddcabef2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013|13003099007; X-Microsoft-Antispam-Message-Info: iDt5Fog5T3PcTvQtjLgtmcwq4zXyHTnouz3haaYhsnBUOYwJKzvgz8fTHojtay4s/NKFCYimP1FwCUXj0Rq7kf5AeHiKGrI4GE0xmkyzYz27Nl3sYvwU75VztWo8zlcavXnIbdakkRXWoDdb46mrJAX0N+6IkBcN2eyz2BWqiLUGXXPWWUbMlE/HU/fBNZMKpZnQyzUc6/qbsEsBWnKwt2SVSbUnxXTYYgQtDsFWS7b54mJnj4dIHdj+8qDR9vFG7hKGvISnIbd+0bqK57hs8Au8uFGmB91DOkll+VJkzEJqHjOtCGZYosOlvcQNVPbgCWvyk28zlwi+FEtF6qVEf9U+p2fsH5c+2KQFBfV45hlh8T7eXqRQHgzKr6K8qA7HyoujaSV+Xj+ObBgLTZ8c546PlrSkzV/tDBvnjZjwo7rwh2AiJepP2wxlBnPXpaIh6sJOCRtOJ2yhzqM+4pI5DqgiyEPFJIhZu0A1Yd9wtJ1oL7Kk0ymW4QBaPM2GDOkpj4Q+3OUhxy9uz9TbNB+52ozbvtp6WxxLmNDFNmi4vUuWWkajL9RoLUmfyCoa1i2xg9LdrCwdSrTaHvDRlpvzQ/AHY10casOtesqLzOq796HFfMhQk9YRo2aiq+rH2vCOeIFw7hVBy0t8lE9UCojKmLgJ9dAh6sATATbFKy3dpqI90aux5x0XOW9mPvxdRkwvmOKCh+bB703oD92yKyCU0bvy5i32uBePd6nMHDhHMC/Rbt8dN9s47EUEth/dn8DQBxVP4MU3IcaAco61SDtlWWe8M8j2BQN6bze+uITvAPPr532fau9AO1bMdGLZQfYl4J8mISDmhSY/piqQcJh/pbifHLMXGfRZ+UzpeMvUrYqqVmWijTje/NVVXvBtpVXwzD94crKV7YkcGpsigNyAW/mFdga8tut+WTB7V/YJ3zca5WRl94YP9ln805ZNBMNSJybZjEdxj1r0snzMQe3GA3pF6goS5PZPLX3V2deKS21J7xurzFckAFxEkP2LiG7P6iQJiivt8EMWZ34FMrOs8iyfPQbpHSQZNAF08aiPcD+Dt3pvS5kA8pUeWuyuQvLkkd050VnvgPiX9Z9fJwQWrgYifDXqxje0YtYThzOLeeYXiiC7m5nyQvgu3N3ylYFZepwbHmh/VvfAmGuaGiZTUdQC5mizgsmOjKKj12fxIs0OaZSHu9iGU+J22shMXcN0iDLM6lFHQwSP13Gx2RhuJtFy3SSMhd/gfJAwNJs0ArEyOeT7GBFp1ZjfjpWaKUkKnw/DT7EZHWOKxSKNAnlfWvYGHzQq5XKOSs30dd0gd7cD8B2tfqwQj2MZCr5nxYKoE+yJJNy4NHPT7ZyJ8uEERYewKs+5fiSVdSQ2kyVEPLe99RhSJ6hjg+roiDnPC2sgbprm3qQQ3NDB+b8kuCHBZ1UdJ00E0xDLYJWWibpOXEYp4FSdClNCZJ2F8kBTXYQzqEzgulB4c8ulYC6G7aqxlA== 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)(82310400026)(1800799024)(376014)(36860700013)(13003099007);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2025 20:15:01.2622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 847b9346-d057-4ed6-791e-08ddddcabef2 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: DB1PEPF000509E5.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA3PR02MB11163 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 ; Sun, 17 Aug 2025 20:15:12 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/222013 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 argument (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. meta/classes-recipe/systemd.bbclass | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/meta/classes-recipe/systemd.bbclass b/meta/classes-recipe/systemd.bbclass index 12c59647be..0a7de208e8 100644 --- a/meta/classes-recipe/systemd.bbclass +++ b/meta/classes-recipe/systemd.bbclass @@ -29,11 +29,16 @@ 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 - OPTS="--root=$D" + # Use ${STAGING_LIBDIR_NATIVE}/systemd rather than + # ${STAGING_DIR_NATIVE}${systemd_unitdir} because the latter is + # affected by whether the usrmerge distro feature is set _for + # target_, and we need to know the path to systemd-sysv-install + # where it was installed _for native_. + OPTS="--root=$D --sysv-install=${STAGING_LIBDIR_NATIVE}/systemd/systemd-sysv-install" fi if [ "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then @@ -46,7 +51,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 +71,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)}