All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] systemd: use the absolute path in service file
@ 2021-01-07  9:56 Yu, Mingli
  2021-01-07 11:29 ` [OE-core] " Richard Purdie
  0 siblings, 1 reply; 8+ messages in thread
From: Yu, Mingli @ 2021-01-07  9:56 UTC (permalink / raw)
  To: openembedded-core

From: Mingli Yu <mingli.yu@windriver.com>

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

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 .../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

diff --git a/meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch b/meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch
new file mode 100644
index 0000000000..dc8e8b3052
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch
@@ -0,0 +1,253 @@
+From 98a60faaca7f1a6b753f73556705cc68aa19e383 Mon Sep 17 00:00:00 2001
+From: Mingli Yu <mingli.yu@windriver.com>
+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 <mingli.yu@windriver.com>
+---
+ 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
+
diff --git a/meta/recipes-core/systemd/systemd_247.2.bb b/meta/recipes-core/systemd/systemd_247.2.bb
index 8416a522c6..8f8d461924 100644
--- a/meta/recipes-core/systemd/systemd_247.2.bb
+++ b/meta/recipes-core/systemd/systemd_247.2.bb
@@ -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 (){
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [OE-core] [PATCH] systemd: use the absolute path in service file
  2021-01-07  9:56 [PATCH] systemd: use the absolute path in service file Yu, Mingli
@ 2021-01-07 11:29 ` Richard Purdie
  2021-01-08  8:40   ` Yu, Mingli
  2021-01-08  8:43   ` [PATCH v2] systemd: use the absolute path in service file Yu, Mingli
  0 siblings, 2 replies; 8+ messages in thread
From: Richard Purdie @ 2021-01-07 11:29 UTC (permalink / raw)
  To: Yu, Mingli, openembedded-core

On Thu, 2021-01-07 at 17:56 +0800, Yu, Mingli wrote:
> From: Mingli Yu <mingli.yu@windriver.com>
> 
> 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
> 
> Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
> ---
>  .../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
> 
> diff --git a/meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch b/meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch
> new file mode 100644
> index 0000000000..dc8e8b3052
> --- /dev/null
> +++ b/meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch
> @@ -0,0 +1,253 @@
> +From 98a60faaca7f1a6b753f73556705cc68aa19e383 Mon Sep 17 00:00:00 2001
> +From: Mingli Yu <mingli.yu@windriver.com>
> +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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-core] [PATCH] systemd: use the absolute path in service file
  2021-01-07 11:29 ` [OE-core] " Richard Purdie
@ 2021-01-08  8:40   ` Yu, Mingli
  2021-01-08  8:52     ` Richard Purdie
  2021-01-08  8:43   ` [PATCH v2] systemd: use the absolute path in service file Yu, Mingli
  1 sibling, 1 reply; 8+ messages in thread
From: Yu, Mingli @ 2021-01-08  8:40 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 2314 bytes --]

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 <richard.purdie@linuxfoundation.org>
Sent: Thursday, January 7, 2021 19:29
To: Yu, Mingli <Mingli.Yu@windriver.com>; openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] systemd: use the absolute path in service file

On Thu, 2021-01-07 at 17:56 +0800, Yu, Mingli wrote:
> From: Mingli Yu <mingli.yu@windriver.com>
>
> 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
>
> Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
> ---
>  .../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
>
> diff --git a/meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch b/meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch
> new file mode 100644
> index 0000000000..dc8e8b3052
> --- /dev/null
> +++ b/meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch
> @@ -0,0 +1,253 @@
> +From 98a60faaca7f1a6b753f73556705cc68aa19e383 Mon Sep 17 00:00:00 2001
> +From: Mingli Yu <mingli.yu@windriver.com>
> +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


[-- Attachment #2: Type: text/html, Size: 3809 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] systemd: use the absolute path in service file
  2021-01-07 11:29 ` [OE-core] " Richard Purdie
  2021-01-08  8:40   ` Yu, Mingli
@ 2021-01-08  8:43   ` Yu, Mingli
  1 sibling, 0 replies; 8+ messages in thread
From: Yu, Mingli @ 2021-01-08  8:43 UTC (permalink / raw)
  To: openembedded-core

From: Mingli Yu <mingli.yu@windriver.com>

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

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 .../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

diff --git a/meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch b/meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch
new file mode 100644
index 0000000000..db89be3a26
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-service-use-the-abosolute-path.patch
@@ -0,0 +1,253 @@
+From 98a60faaca7f1a6b753f73556705cc68aa19e383 Mon Sep 17 00:00:00 2001
+From: Mingli Yu <mingli.yu@windriver.com>
+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 <mingli.yu@windriver.com>
+---
+ 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
+
diff --git a/meta/recipes-core/systemd/systemd_247.2.bb b/meta/recipes-core/systemd/systemd_247.2.bb
index 8416a522c6..8f8d461924 100644
--- a/meta/recipes-core/systemd/systemd_247.2.bb
+++ b/meta/recipes-core/systemd/systemd_247.2.bb
@@ -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 (){
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [OE-core] [PATCH] systemd: use the absolute path in service file
  2021-01-08  8:40   ` Yu, Mingli
@ 2021-01-08  8:52     ` Richard Purdie
  2021-01-12  7:42       ` Yu, Mingli
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Purdie @ 2021-01-08  8:52 UTC (permalink / raw)
  To: Yu, Mingli, openembedded-core

On Fri, 2021-01-08 at 08:40 +0000, Yu, Mingli wrote:
> 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-core] [PATCH] systemd: use the absolute path in service file
  2021-01-08  8:52     ` Richard Purdie
@ 2021-01-12  7:42       ` Yu, Mingli
  2021-01-12  9:29         ` Richard Purdie
  0 siblings, 1 reply; 8+ messages in thread
From: Yu, Mingli @ 2021-01-12  7:42 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core

Hi RP,

On 1/8/21 4:52 PM, Richard Purdie wrote:
> On Fri, 2021-01-08 at 08:40 +0000, Yu, Mingli wrote:
>> 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,

> 
> Cheers,
> 
> Richard
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-core] [PATCH] systemd: use the absolute path in service file
  2021-01-12  7:42       ` Yu, Mingli
@ 2021-01-12  9:29         ` Richard Purdie
  2021-01-21  7:44           ` [PATCH v3] systemd: resolve executable path if it is relative Yu, Mingli
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Purdie @ 2021-01-12  9:29 UTC (permalink / raw)
  To: Yu, Mingli, openembedded-core

On Tue, 2021-01-12 at 15:42 +0800, Yu, Mingli wrote:
> Hi RP,
> 
> On 1/8/21 4:52 PM, Richard Purdie wrote:
> > On Fri, 2021-01-08 at 08:40 +0000, Yu, Mingli wrote:
> > > 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.

Do they carry patches to systemd to do that?

Cheers,

Richard


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3] systemd: resolve executable path if it is relative
  2021-01-12  9:29         ` Richard Purdie
@ 2021-01-21  7:44           ` Yu, Mingli
  0 siblings, 0 replies; 8+ messages in thread
From: Yu, Mingli @ 2021-01-21  7:44 UTC (permalink / raw)
  To: openembedded-core

From: Mingli Yu <mingli.yu@windriver.com>

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>
---
 ...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

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 455a29affc..6abb27747a 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
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-01-21  7:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07  9:56 [PATCH] systemd: use the absolute path in service file Yu, Mingli
2021-01-07 11:29 ` [OE-core] " Richard Purdie
2021-01-08  8:40   ` Yu, Mingli
2021-01-08  8:52     ` Richard Purdie
2021-01-12  7:42       ` Yu, Mingli
2021-01-12  9:29         ` Richard Purdie
2021-01-21  7:44           ` [PATCH v3] systemd: resolve executable path if it is relative Yu, Mingli
2021-01-08  8:43   ` [PATCH v2] systemd: use the absolute path in service file Yu, Mingli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.