systemd: use the absolute path in service file
PATCH 1/1 systemd: use the absolute path in service file
From: Mingli Yu <[email protected]>
Fixes:
# systemd-analyze --man=false verify /lib/systemd/system/systemd-kexec.service systemd-kexec.service: Command systemctl is not executable: No such file or directory
--- .../0001-service-use-the-abosolute-path.patch | 253 ++++++++++++++++++ meta/recipes-core/systemd/systemd_247.2.bb | 5 + 2 files changed, 258 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch
meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch new file +253 -0
@@ -0,0 +1,253 @@ +From 98a60faaca7f1a6b753f73556705cc68aa19e383 Mon Sep 17 00:00:00 2001 +From: Mingli Yu <[email protected]> +Date: Thu, 7 Jan 2021 06:40:29 +0000 +Subject: [PATCH] service: use the abosolute path + +Fixes: + # systemd-analyze --man=false verify /lib/systemd/system/systemd-kexec.service + systemd-kexec.service: Command systemctl is not executable: No such file or directory + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Mingli Yu <[email protected]> +--- + units/initrd-cleanup.service | 2 +- + units/initrd-switch-root.service | 2 +- + units/systemd-ask-password-console.service | 2 +- + units/systemd-ask-password-wall.service | 2 +- + units/systemd-halt.service | 2 +- + units/systemd-hwdb-update.service.in | 2 +- + units/systemd-journal-catalog-update.service | 2 +- + units/systemd-journal-flush.service | 4 ++-- + units/systemd-kexec.service | 2 +- + units/systemd-machine-id-commit.service | 2 +- + units/systemd-sysusers.service | 2 +- + units/systemd-tmpfiles-clean.service | 2 +- + units/systemd-tmpfiles-setup-dev.service | 2 +- + units/systemd-tmpfiles-setup.service | 2 +- + units/systemd-udev-settle.service | 2 +- + units/systemd-udev-trigger.service | 4 ++-- + units/systemd-udevd.service.in | 2 +- + units/user/systemd-tmpfiles-clean.service | 2 +- + units/user/systemd-tmpfiles-setup.service | 2 +- + 19 files changed, 21 insertions(+), 21 deletions(-) + +diff --git a/units/initrd-cleanup.service b/units/initrd-cleanup.service +index 08ab503962..231dbda0c0 100644 +--- a/units/initrd-cleanup.service ++++ b/units/initrd-cleanup.service +@@ -17,4 +17,4 @@ After=initrd-root-fs.target initrd-fs.target initrd.target + + [Service] + Type=oneshot +-ExecStart=systemctl --no-block isolate initrd-switch-root.target ++ExecStart=#BASE_BINDIR#/systemctl --no-block isolate initrd-switch-root.target +diff --git a/units/initrd-switch-root.service b/units/initrd-switch-root.service +index e3d6926711..a18b94df2d 100644 +--- a/units/initrd-switch-root.service ++++ b/units/initrd-switch-root.service +@@ -17,4 +17,4 @@ AllowIsolate=yes + + [Service] + Type=oneshot +-ExecStart=systemctl --no-block switch-root /sysroot ++ExecStart=#BASE_BINDIR#/systemctl --no-block switch-root /sysroot +diff --git a/units/systemd-ask-password-console.service b/units/systemd-ask-password-console.service +index d31f3fa70f..16abf1af1f 100644 +--- a/units/systemd-ask-password-console.service ++++ b/units/systemd-ask-password-console.service +@@ -17,5 +17,5 @@ Before=shutdown.target + ConditionPathExists=!/run/plymouth/pid + + [Service] +-ExecStart=systemd-tty-ask-password-agent --watch --console ++ExecStart=#BASE_BINDIR#/systemd-tty-ask-password-agent --watch --console + SystemCallArchitectures=native +diff --git a/units/systemd-ask-password-wall.service b/units/systemd-ask-password-wall.service +index 6a70b58cef..b30da07865 100644 +--- a/units/systemd-ask-password-wall.service ++++ b/units/systemd-ask-password-wall.service +@@ -14,5 +14,5 @@ After=systemd-user-sessions.service + + [Service] + ExecStartPre=-systemctl stop systemd-ask-password-console.path systemd-ask-password-console.service systemd-ask-password-plymouth.path systemd-ask-password-plymouth.service +-ExecStart=systemd-tty-ask-password-agent --wall ++ExecStart=#BASE_BINDIR#/systemd-tty-ask-password-agent --wall + SystemCallArchitectures=native +diff --git a/units/systemd-halt.service b/units/systemd-halt.service +index 37bfe285c0..f5b27f9bba 100644 +--- a/units/systemd-halt.service ++++ b/units/systemd-halt.service +@@ -16,4 +16,4 @@ After=shutdown.target umount.target final.target + + [Service] + Type=oneshot +-ExecStart=systemctl --force halt ++ExecStart=#BASE_BINDIR#/systemctl --force halt +diff --git a/units/systemd-hwdb-update.service.in b/units/systemd-hwdb-update.service.in +index 57398e5214..2b6a523598 100644 +--- a/units/systemd-hwdb-update.service.in ++++ b/units/systemd-hwdb-update.service.in +@@ -22,5 +22,5 @@ ConditionDirectoryNotEmpty=|/etc/udev/hwdb.d/ + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=systemd-hwdb update ++ExecStart=#BASE_BINDIR#/systemd-hwdb update + TimeoutSec=90s +diff --git a/units/systemd-journal-catalog-update.service b/units/systemd-journal-catalog-update.service +index 477925685a..2a29e4e910 100644 +--- a/units/systemd-journal-catalog-update.service ++++ b/units/systemd-journal-catalog-update.service +@@ -19,5 +19,5 @@ ConditionNeedsUpdate=/var + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=journalctl --update-catalog ++ExecStart=#BASE_BINDIR#/journalctl --update-catalog + TimeoutSec=90s +diff --git a/units/systemd-journal-flush.service b/units/systemd-journal-flush.service +index 1a71592b93..1a4d189b51 100644 +--- a/units/systemd-journal-flush.service ++++ b/units/systemd-journal-flush.service +@@ -17,8 +17,8 @@ Before=systemd-tmpfiles-setup.service + RequiresMountsFor=/var/log/journal + + [Service] +-ExecStart=journalctl --flush +-ExecStop=journalctl --smart-relinquish-var ++ExecStart=#BASE_BINDIR#/journalctl --flush ++ExecStop=#BASE_BINDIR#/journalctl --smart-relinquish-var + Type=oneshot + RemainAfterExit=yes + TimeoutSec=90s +diff --git a/units/systemd-kexec.service b/units/systemd-kexec.service +index 0aa7933be4..6977b6faf4 100644 +--- a/units/systemd-kexec.service ++++ b/units/systemd-kexec.service +@@ -16,4 +16,4 @@ After=shutdown.target umount.target final.target + + [Service] + Type=oneshot +-ExecStart=systemctl --force kexec ++ExecStart=#BASE_BINDIR#/systemctl --force kexec +diff --git a/units/systemd-machine-id-commit.service b/units/systemd-machine-id-commit.service +index 89e0613955..8ae8f59c69 100644 +--- a/units/systemd-machine-id-commit.service ++++ b/units/systemd-machine-id-commit.service +@@ -20,5 +20,5 @@ ConditionPathIsMountPoint=/etc/machine-id + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=systemd-machine-id-setup --commit ++ExecStart=#BASE_BINDIR#/systemd-machine-id-setup --commit + TimeoutSec=30s +diff --git a/units/systemd-sysusers.service b/units/systemd-sysusers.service +index ff5b3db821..735be55094 100644 +--- a/units/systemd-sysusers.service ++++ b/units/systemd-sysusers.service +@@ -19,5 +19,5 @@ ConditionNeedsUpdate=/etc + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=systemd-sysusers ++ExecStart=#BASE_BINDIR#/systemd-sysusers + TimeoutSec=90s +diff --git a/units/systemd-tmpfiles-clean.service b/units/systemd-tmpfiles-clean.service +index e962954f06..071d8492b2 100644 +--- a/units/systemd-tmpfiles-clean.service ++++ b/units/systemd-tmpfiles-clean.service +@@ -17,6 +17,6 @@ Before=shutdown.target + + [Service] + Type=oneshot +-ExecStart=systemd-tmpfiles --clean ++ExecStart=#BASE_BINDIR#/systemd-tmpfiles --clean + SuccessExitStatus=DATAERR + IOSchedulingClass=idle +diff --git a/units/systemd-tmpfiles-setup-dev.service b/units/systemd-tmpfiles-setup-dev.service +index 0babe78767..f531f175d5 100644 +--- a/units/systemd-tmpfiles-setup-dev.service ++++ b/units/systemd-tmpfiles-setup-dev.service +@@ -18,5 +18,5 @@ Before=sysinit.target local-fs-pre.target systemd-udevd.service shutdown.target + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=systemd-tmpfiles --prefix=/dev --create --boot ++ExecStart=#BASE_BINDIR#/systemd-tmpfiles --prefix=/dev --create --boot + SuccessExitStatus=DATAERR CANTCREAT +diff --git a/units/systemd-tmpfiles-setup.service b/units/systemd-tmpfiles-setup.service +index 3f028d2533..93bb7a2775 100644 +--- a/units/systemd-tmpfiles-setup.service ++++ b/units/systemd-tmpfiles-setup.service +@@ -19,5 +19,5 @@ RefuseManualStop=yes + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev ++ExecStart=#BASE_BINDIR#/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev + SuccessExitStatus=DATAERR CANTCREAT +diff --git a/units/systemd-udev-settle.service b/units/systemd-udev-settle.service +index 994c47fce4..3a4f03ed1b 100644 +--- a/units/systemd-udev-settle.service ++++ b/units/systemd-udev-settle.service +@@ -24,4 +24,4 @@ ConditionPathIsReadWrite=/sys + Type=oneshot + TimeoutSec=180 + RemainAfterExit=yes +-ExecStart=udevadm settle ++ExecStart=#BASE_BINDIR#/udevadm settle +diff --git a/units/systemd-udev-trigger.service b/units/systemd-udev-trigger.service +index 8b2d88e185..b4012af5c7 100644 +--- a/units/systemd-udev-trigger.service ++++ b/units/systemd-udev-trigger.service +@@ -19,5 +19,5 @@ ConditionPathIsReadWrite=/sys + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=udevadm trigger --type=subsystems --action=add +-ExecStart=udevadm trigger --type=devices --action=add ++ExecStart=#BASE_BINDIR#/udevadm trigger --type=subsystems --action=add ++ExecStart=#BASE_BINDIR#/udevadm trigger --type=devices --action=add +diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in +index f3458d98e6..c36ddbf843 100644 +--- a/units/systemd-udevd.service.in ++++ b/units/systemd-udevd.service.in +@@ -25,7 +25,7 @@ Sockets=systemd-udevd-control.socket systemd-udevd-kernel.socket + Restart=always + RestartSec=0 + ExecStart=@rootlibexecdir@/systemd-udevd +-ExecReload=udevadm control --reload --timeout 0 ++ExecReload=#BASE_BINDIR#/udevadm control --reload --timeout 0 + KillMode=mixed + TasksMax=infinity + PrivateMounts=yes +diff --git a/units/user/systemd-tmpfiles-clean.service b/units/user/systemd-tmpfiles-clean.service +index 6a937071f7..004f1ca1d9 100644 +--- a/units/user/systemd-tmpfiles-clean.service ++++ b/units/user/systemd-tmpfiles-clean.service +@@ -16,7 +16,7 @@ Before=basic.target shutdown.target + + [Service] + Type=oneshot +-ExecStart=systemd-tmpfiles --user --clean ++ExecStart=#BASE_BINDIR#/systemd-tmpfiles --user --clean + SuccessExitStatus=DATAERR + IOSchedulingClass=idle + Slice=background.slice +diff --git a/units/user/systemd-tmpfiles-setup.service b/units/user/systemd-tmpfiles-setup.service +index 156689edcd..bda5a3d22f 100644 +--- a/units/user/systemd-tmpfiles-setup.service ++++ b/units/user/systemd-tmpfiles-setup.service +@@ -18,7 +18,7 @@ RefuseManualStop=yes + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=systemd-tmpfiles --user --create --remove --boot ++ExecStart=#BASE_BINDIR#/systemd-tmpfiles --user --create --remove --boot + SuccessExitStatus=DATAERR + + [Install] +-- +2.26.2 +
meta/recipes-core/systemd/systemd_247.2.bb +5 -0
@@ -23,6 +23,7 @@ SRC_URI += "file://touchscreen.rules \ file://0003-implment-systemd-sysv-install-for-OE.patch \ file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \ file://0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch \ + file://0001-service-use-the-abosolute-path.patch \ " # patches needed by musl
@@ -321,6 +322,10 @@ do_install() { # add a profile fragment to disable systemd pager with busybox less install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh + + # use the absolute path for the command in the service file + files=$(ls ${D}${systemd_unitdir}/system/*.service) + for i in ${files}; do sed -i -e 's:#BASE_BINDIR#:${base_bindir}:g' $i; done } python populate_packages_prepend (){
Signature · 1 line
2.17.1
Quoted 19 lines · Mingli
From: Mingli Yu <[email protected]>
Fixes:
# systemd-analyze --man=false verify /lib/systemd/system/systemd-kexec.service systemd-kexec.service: Command systemctl is not executable: No such file or directorySigned-off-by Mingli Yu <[email protected]>---
.../0001-service-use-the-abosolute-path.patch | 253 ++++++++++++++++++
meta/recipes-core/systemd/systemd_247.2.bb | 5 +2 files changed, 258 insertions(+)create mode 100644
meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patchmeta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch new file +0
-0
meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch line 10
Quoted 10 lines
meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch new file +10
-0@@ -0,0 +1,253 @@ +From 98a60faaca7f1a6b753f73556705cc68aa19e383 Mon Sep 17 00:00:00 2001 +From: Mingli Yu <[email protected]> +Date: Thu, 7 Jan 2021 06:40:29 +0000 +Subject: [PATCH] service: use the abosolute path + +Fixes: + # systemd-analyze --man=false verify /lib/systemd/system/systemd-kexec.service + systemd-kexec.service: Command systemctl is not executable: No such file or directory + +Upstream-Status: Inappropriate [OE specific]
At the very least you need to explain why this is OE specific and doesn't affect upstream. I strongly suspect there is a different issue at work here and it should be fixed differently.
Cheers,
Richard
Hi RP,
This is just configuration change which defines the absolute path for the command to silence the warning when systemd-analyze verify the unit files and the command may be installed in different place between OE and non-OE, so it should be OE specific, will resend v2 to mark it is configuration specific.
Thanks,
________________________________
From: Richard Purdie <[email protected]>
Sent: Thursday, January 7, 2021 19:29
To: Yu, Mingli <[email protected]>; [email protected] <[email protected]>
Subject: Re: [OE-core] [PATCH] systemd: use the absolute path in service file
Quoted 19 lines · Mingli
From: Mingli Yu <[email protected]>
Fixes:
# systemd-analyze --man=false verify /lib/systemd/system/systemd-kexec.service systemd-kexec.service: Command systemctl is not executable: No such file or directorySigned-off-by Mingli Yu <[email protected]>--- .../0001-service-use-the-abosolute-path.patch | 253 ++++++++++++++++++ meta/recipes-core/systemd/systemd_247.2.bb | 5 + 2 files changed, 258 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patchmeta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch new file +0
-0
meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch line 10
Quoted 10 lines
meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch new file +10
-0@@ -0,0 +1,253 @@ +From 98a60faaca7f1a6b753f73556705cc68aa19e383 Mon Sep 17 00:00:00 2001 +From: Mingli Yu <[email protected]> +Date: Thu, 7 Jan 2021 06:40:29 +0000 +Subject: [PATCH] service: use the abosolute path + +Fixes: + # systemd-analyze --man=false verify /lib/systemd/system/systemd-kexec.service + systemd-kexec.service: Command systemctl is not executable: No such file or directory + +Upstream-Status: Inappropriate [OE specific]
At the very least you need to explain why this is OE specific and doesn't affect upstream. I strongly suspect there is a different issue at work here and it should be fixed differently.
Cheers,
Richard
PATCH v2 1/1 systemd: use the absolute path in service file
In reply to Richard PurdieFrom: Mingli Yu <[email protected]>
Fixes:
# systemd-analyze --man=false verify /lib/systemd/system/systemd-kexec.service systemd-kexec.service: Command systemctl is not executable: No such file or directory
--- .../0001-service-use-the-abosolute-path.patch | 253 ++++++++++++++++++ meta/recipes-core/systemd/systemd_247.2.bb | 5 + 2 files changed, 258 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch
meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch new file +253 -0
@@ -0,0 +1,253 @@ +From 98a60faaca7f1a6b753f73556705cc68aa19e383 Mon Sep 17 00:00:00 2001 +From: Mingli Yu <[email protected]> +Date: Thu, 7 Jan 2021 06:40:29 +0000 +Subject: [PATCH] service: use the abosolute path + +Fixes: + # systemd-analyze --man=false verify /lib/systemd/system/systemd-kexec.service + systemd-kexec.service: Command systemctl is not executable: No such file or directory + +Upstream-Status: Inappropriate [configuration specific] + +Signed-off-by: Mingli Yu <[email protected]> +--- + units/initrd-cleanup.service | 2 +- + units/initrd-switch-root.service | 2 +- + units/systemd-ask-password-console.service | 2 +- + units/systemd-ask-password-wall.service | 2 +- + units/systemd-halt.service | 2 +- + units/systemd-hwdb-update.service.in | 2 +- + units/systemd-journal-catalog-update.service | 2 +- + units/systemd-journal-flush.service | 4 ++-- + units/systemd-kexec.service | 2 +- + units/systemd-machine-id-commit.service | 2 +- + units/systemd-sysusers.service | 2 +- + units/systemd-tmpfiles-clean.service | 2 +- + units/systemd-tmpfiles-setup-dev.service | 2 +- + units/systemd-tmpfiles-setup.service | 2 +- + units/systemd-udev-settle.service | 2 +- + units/systemd-udev-trigger.service | 4 ++-- + units/systemd-udevd.service.in | 2 +- + units/user/systemd-tmpfiles-clean.service | 2 +- + units/user/systemd-tmpfiles-setup.service | 2 +- + 19 files changed, 21 insertions(+), 21 deletions(-) + +diff --git a/units/initrd-cleanup.service b/units/initrd-cleanup.service +index 08ab503962..231dbda0c0 100644 +--- a/units/initrd-cleanup.service ++++ b/units/initrd-cleanup.service +@@ -17,4 +17,4 @@ After=initrd-root-fs.target initrd-fs.target initrd.target + + [Service] + Type=oneshot +-ExecStart=systemctl --no-block isolate initrd-switch-root.target ++ExecStart=#BASE_BINDIR#/systemctl --no-block isolate initrd-switch-root.target +diff --git a/units/initrd-switch-root.service b/units/initrd-switch-root.service +index e3d6926711..a18b94df2d 100644 +--- a/units/initrd-switch-root.service ++++ b/units/initrd-switch-root.service +@@ -17,4 +17,4 @@ AllowIsolate=yes + + [Service] + Type=oneshot +-ExecStart=systemctl --no-block switch-root /sysroot ++ExecStart=#BASE_BINDIR#/systemctl --no-block switch-root /sysroot +diff --git a/units/systemd-ask-password-console.service b/units/systemd-ask-password-console.service +index d31f3fa70f..16abf1af1f 100644 +--- a/units/systemd-ask-password-console.service ++++ b/units/systemd-ask-password-console.service +@@ -17,5 +17,5 @@ Before=shutdown.target + ConditionPathExists=!/run/plymouth/pid + + [Service] +-ExecStart=systemd-tty-ask-password-agent --watch --console ++ExecStart=#BASE_BINDIR#/systemd-tty-ask-password-agent --watch --console + SystemCallArchitectures=native +diff --git a/units/systemd-ask-password-wall.service b/units/systemd-ask-password-wall.service +index 6a70b58cef..b30da07865 100644 +--- a/units/systemd-ask-password-wall.service ++++ b/units/systemd-ask-password-wall.service +@@ -14,5 +14,5 @@ After=systemd-user-sessions.service + + [Service] + ExecStartPre=-systemctl stop systemd-ask-password-console.path systemd-ask-password-console.service systemd-ask-password-plymouth.path systemd-ask-password-plymouth.service +-ExecStart=systemd-tty-ask-password-agent --wall ++ExecStart=#BASE_BINDIR#/systemd-tty-ask-password-agent --wall + SystemCallArchitectures=native +diff --git a/units/systemd-halt.service b/units/systemd-halt.service +index 37bfe285c0..f5b27f9bba 100644 +--- a/units/systemd-halt.service ++++ b/units/systemd-halt.service +@@ -16,4 +16,4 @@ After=shutdown.target umount.target final.target + + [Service] + Type=oneshot +-ExecStart=systemctl --force halt ++ExecStart=#BASE_BINDIR#/systemctl --force halt +diff --git a/units/systemd-hwdb-update.service.in b/units/systemd-hwdb-update.service.in +index 57398e5214..2b6a523598 100644 +--- a/units/systemd-hwdb-update.service.in ++++ b/units/systemd-hwdb-update.service.in +@@ -22,5 +22,5 @@ ConditionDirectoryNotEmpty=|/etc/udev/hwdb.d/ + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=systemd-hwdb update ++ExecStart=#BASE_BINDIR#/systemd-hwdb update + TimeoutSec=90s +diff --git a/units/systemd-journal-catalog-update.service b/units/systemd-journal-catalog-update.service +index 477925685a..2a29e4e910 100644 +--- a/units/systemd-journal-catalog-update.service ++++ b/units/systemd-journal-catalog-update.service +@@ -19,5 +19,5 @@ ConditionNeedsUpdate=/var + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=journalctl --update-catalog ++ExecStart=#BASE_BINDIR#/journalctl --update-catalog + TimeoutSec=90s +diff --git a/units/systemd-journal-flush.service b/units/systemd-journal-flush.service +index 1a71592b93..1a4d189b51 100644 +--- a/units/systemd-journal-flush.service ++++ b/units/systemd-journal-flush.service +@@ -17,8 +17,8 @@ Before=systemd-tmpfiles-setup.service + RequiresMountsFor=/var/log/journal + + [Service] +-ExecStart=journalctl --flush +-ExecStop=journalctl --smart-relinquish-var ++ExecStart=#BASE_BINDIR#/journalctl --flush ++ExecStop=#BASE_BINDIR#/journalctl --smart-relinquish-var + Type=oneshot + RemainAfterExit=yes + TimeoutSec=90s +diff --git a/units/systemd-kexec.service b/units/systemd-kexec.service +index 0aa7933be4..6977b6faf4 100644 +--- a/units/systemd-kexec.service ++++ b/units/systemd-kexec.service +@@ -16,4 +16,4 @@ After=shutdown.target umount.target final.target + + [Service] + Type=oneshot +-ExecStart=systemctl --force kexec ++ExecStart=#BASE_BINDIR#/systemctl --force kexec +diff --git a/units/systemd-machine-id-commit.service b/units/systemd-machine-id-commit.service +index 89e0613955..8ae8f59c69 100644 +--- a/units/systemd-machine-id-commit.service ++++ b/units/systemd-machine-id-commit.service +@@ -20,5 +20,5 @@ ConditionPathIsMountPoint=/etc/machine-id + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=systemd-machine-id-setup --commit ++ExecStart=#BASE_BINDIR#/systemd-machine-id-setup --commit + TimeoutSec=30s +diff --git a/units/systemd-sysusers.service b/units/systemd-sysusers.service +index ff5b3db821..735be55094 100644 +--- a/units/systemd-sysusers.service ++++ b/units/systemd-sysusers.service +@@ -19,5 +19,5 @@ ConditionNeedsUpdate=/etc + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=systemd-sysusers ++ExecStart=#BASE_BINDIR#/systemd-sysusers + TimeoutSec=90s +diff --git a/units/systemd-tmpfiles-clean.service b/units/systemd-tmpfiles-clean.service +index e962954f06..071d8492b2 100644 +--- a/units/systemd-tmpfiles-clean.service ++++ b/units/systemd-tmpfiles-clean.service +@@ -17,6 +17,6 @@ Before=shutdown.target + + [Service] + Type=oneshot +-ExecStart=systemd-tmpfiles --clean ++ExecStart=#BASE_BINDIR#/systemd-tmpfiles --clean + SuccessExitStatus=DATAERR + IOSchedulingClass=idle +diff --git a/units/systemd-tmpfiles-setup-dev.service b/units/systemd-tmpfiles-setup-dev.service +index 0babe78767..f531f175d5 100644 +--- a/units/systemd-tmpfiles-setup-dev.service ++++ b/units/systemd-tmpfiles-setup-dev.service +@@ -18,5 +18,5 @@ Before=sysinit.target local-fs-pre.target systemd-udevd.service shutdown.target + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=systemd-tmpfiles --prefix=/dev --create --boot ++ExecStart=#BASE_BINDIR#/systemd-tmpfiles --prefix=/dev --create --boot + SuccessExitStatus=DATAERR CANTCREAT +diff --git a/units/systemd-tmpfiles-setup.service b/units/systemd-tmpfiles-setup.service +index 3f028d2533..93bb7a2775 100644 +--- a/units/systemd-tmpfiles-setup.service ++++ b/units/systemd-tmpfiles-setup.service +@@ -19,5 +19,5 @@ RefuseManualStop=yes + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev ++ExecStart=#BASE_BINDIR#/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev + SuccessExitStatus=DATAERR CANTCREAT +diff --git a/units/systemd-udev-settle.service b/units/systemd-udev-settle.service +index 994c47fce4..3a4f03ed1b 100644 +--- a/units/systemd-udev-settle.service ++++ b/units/systemd-udev-settle.service +@@ -24,4 +24,4 @@ ConditionPathIsReadWrite=/sys + Type=oneshot + TimeoutSec=180 + RemainAfterExit=yes +-ExecStart=udevadm settle ++ExecStart=#BASE_BINDIR#/udevadm settle +diff --git a/units/systemd-udev-trigger.service b/units/systemd-udev-trigger.service +index 8b2d88e185..b4012af5c7 100644 +--- a/units/systemd-udev-trigger.service ++++ b/units/systemd-udev-trigger.service +@@ -19,5 +19,5 @@ ConditionPathIsReadWrite=/sys + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=udevadm trigger --type=subsystems --action=add +-ExecStart=udevadm trigger --type=devices --action=add ++ExecStart=#BASE_BINDIR#/udevadm trigger --type=subsystems --action=add ++ExecStart=#BASE_BINDIR#/udevadm trigger --type=devices --action=add +diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in +index f3458d98e6..c36ddbf843 100644 +--- a/units/systemd-udevd.service.in ++++ b/units/systemd-udevd.service.in +@@ -25,7 +25,7 @@ Sockets=systemd-udevd-control.socket systemd-udevd-kernel.socket + Restart=always + RestartSec=0 + ExecStart=@rootlibexecdir@/systemd-udevd +-ExecReload=udevadm control --reload --timeout 0 ++ExecReload=#BASE_BINDIR#/udevadm control --reload --timeout 0 + KillMode=mixed + TasksMax=infinity + PrivateMounts=yes +diff --git a/units/user/systemd-tmpfiles-clean.service b/units/user/systemd-tmpfiles-clean.service +index 6a937071f7..004f1ca1d9 100644 +--- a/units/user/systemd-tmpfiles-clean.service ++++ b/units/user/systemd-tmpfiles-clean.service +@@ -16,7 +16,7 @@ Before=basic.target shutdown.target + + [Service] + Type=oneshot +-ExecStart=systemd-tmpfiles --user --clean ++ExecStart=#BASE_BINDIR#/systemd-tmpfiles --user --clean + SuccessExitStatus=DATAERR + IOSchedulingClass=idle + Slice=background.slice +diff --git a/units/user/systemd-tmpfiles-setup.service b/units/user/systemd-tmpfiles-setup.service +index 156689edcd..bda5a3d22f 100644 +--- a/units/user/systemd-tmpfiles-setup.service ++++ b/units/user/systemd-tmpfiles-setup.service +@@ -18,7 +18,7 @@ RefuseManualStop=yes + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=systemd-tmpfiles --user --create --remove --boot ++ExecStart=#BASE_BINDIR#/systemd-tmpfiles --user --create --remove --boot + SuccessExitStatus=DATAERR + + [Install] +-- +2.26.2 +
meta/recipes-core/systemd/systemd_247.2.bb +5 -0
@@ -23,6 +23,7 @@ SRC_URI += "file://touchscreen.rules \ file://0003-implment-systemd-sysv-install-for-OE.patch \ file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \ file://0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch \ + file://0001-service-use-the-abosolute-path.patch \ " # patches needed by musl
@@ -321,6 +322,10 @@ do_install() { # add a profile fragment to disable systemd pager with busybox less install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh + + # use the absolute path for the command in the service file + files=$(ls ${D}${systemd_unitdir}/system/*.service) + for i in ${files}; do sed -i -e 's:#BASE_BINDIR#:${base_bindir}:g' $i; done } python populate_packages_prepend (){
Signature · 1 line
2.17.1
Quoted 5 lines · Mingli
This is just configuration change which defines the absolute path for the command to silence the warning when systemd-analyze verify the unit files and the command may be installed in different place between OE and non-OE, so it should be OE specific, will resend v2 to mark it is configuration specific.
Why wouldn't systemd-analyze show warnings for upstream too though?
Cheers,
Richard
Hi RP,
Quoted 8 lines · Richard Purdie
Quoted 5 lines · Mingli
This is just configuration change which defines the absolute path for the command to silence the warning when systemd-analyze verify the unit files and the command may be installed in different place between OE and non-OE, so it should be OE specific, will resend v2 to mark it is configuration specific.
Why wouldn't systemd-analyze show warnings for upstream too though?
I also checked the service file on other linux distribution such as Ubuntu and it also use the absolute path.
Thanks,
Quoted 9 lines
Cheers,
Richard
Quoted 10 lines · Mingli
Hi RP,
Quoted 7 lines · Richard Purdie
Quoted 5 lines · Mingli
This is just configuration change which defines the absolute path for the command to silence the warning when systemd-analyze verify the unit files and the command may be installed in different place between OE and non-OE, so it should be OE specific, will resend v2 to mark it is configuration specific.
Quoted 4 lines
Quoted 1 line
Why wouldn't systemd-analyze show warnings for upstream too though?
I also checked the service file on other linux distribution such as Ubuntu and it also use the absolute path.
Do they carry patches to systemd to do that?
Cheers,
Richard
PATCH v3 1/1 systemd: resolve executable path if it is relative
From: Mingli Yu <[email protected]>
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
--- ...ve-executable-path-if-it-is-relative.patch | 39 +++++++++++++++++++ meta/recipes-core/systemd/systemd_247.2.bb | 1 + 2 files changed, 40 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch
meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch new file +39 -0
@@ -0,0 +1,39 @@ +From b9b7a8e3825f0433e120f7a6d7d5d635a839cab9 Mon Sep 17 00:00:00 2001 +From: Mingli Yu <[email protected]> +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 <[email protected]> +--- + 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 +
meta/recipes-core/systemd/systemd_247.2.bb +1 -0
@@ -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
Signature · 1 line
2.17.1