summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMingli Yu <mingli.yu@windriver.com>2021-01-21 15:44:49 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-01-23 17:08:49 +0000
commit2e0259931f71701147039bb8e60251892f67dbcd (patch)
tree58b5ef0a945113f51e724cbf4a9aac3da99b1ee2
parent79821d5a185e25384f5b6b5158b238bbee17c79e (diff)
downloadopenembedded-core-contrib-2e0259931f71701147039bb8e60251892f67dbcd.tar.gz
systemd: resolve executable path if it is relative
Backport a patch to fix the below systemd-analyze issue: # systemd-analyze --man=false verify /lib/systemd/system/initrd-cleanup.service initrd-cleanup.service: Command systemctl is not executable: No such file or directory # which systemctl /bin/systemctl # cat /lib/systemd/system/initrd-cleanup.service [snip] [Unit] Description=Cleaning Up and Shutting Down Daemons DefaultDependencies=no AssertPathExists=/etc/initrd-release OnFailure=emergency.target OnFailureJobMode=replace-irreversibly After=initrd-root-fs.target initrd-fs.target initrd.target [Service] Type=oneshot ExecStart=systemctl --no-block isolate initrd-switch-root.target Signed-off-by: Mingli Yu <mingli.yu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch39
-rw-r--r--meta/recipes-core/systemd/systemd_247.2.bb1
2 files changed, 40 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch b/meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch
new file mode 100644
index 0000000000..fd7f94a61d
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch
@@ -0,0 +1,39 @@
+From b9b7a8e3825f0433e120f7a6d7d5d635a839cab9 Mon Sep 17 00:00:00 2001
+From: Mingli Yu <mingli.yu@windriver.com>
+Date: Thu, 21 Jan 2021 06:19:44 +0000
+Subject: [PATCH] analyze: resolve executable path if it is relative
+
+Upstream-Status: Backport [https://github.com/systemd/systemd/commit/f1fb046a985521f7d4a662f02546686ff20b7e5d]
+
+Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
+---
+ src/analyze/analyze-verify.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c
+index a9c89173bf..969523df18 100644
+--- a/src/analyze/analyze-verify.c
++++ b/src/analyze/analyze-verify.c
+@@ -115,14 +115,17 @@ static int verify_socket(Unit *u) {
+ }
+
+ int verify_executable(Unit *u, const ExecCommand *exec) {
++ int r;
++
+ if (!exec)
+ return 0;
+
+ if (exec->flags & EXEC_COMMAND_IGNORE_FAILURE)
+ return 0;
+
+- if (access(exec->path, X_OK) < 0)
+- return log_unit_error_errno(u, errno, "Command %s is not executable: %m", exec->path);
++ r = find_executable_full(exec->path, false, NULL);
++ if (r < 0)
++ return log_unit_error_errno(u, r, "Command %s is not executable: %m", exec->path);
+
+ return 0;
+ }
+--
+2.26.2
+
diff --git a/meta/recipes-core/systemd/systemd_247.2.bb b/meta/recipes-core/systemd/systemd_247.2.bb
index 84d997196c..7ddcb169c3 100644
--- a/meta/recipes-core/systemd/systemd_247.2.bb
+++ b/meta/recipes-core/systemd/systemd_247.2.bb
@@ -24,6 +24,7 @@ SRC_URI += "file://touchscreen.rules \
file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \
file://0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch \
file://0027-proc-dont-trigger-mount-error-with-invalid-options-o.patch \
+ file://0001-analyze-resolve-executable-path-if-it-is-relative.patch \
"
# patches needed by musl