public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH] udev-extraconf: detect init manager from pid
@ 2026-03-15 12:44 opensource
  0 siblings, 0 replies; only message in thread
From: opensource @ 2026-03-15 12:44 UTC (permalink / raw)
  To: openembedded-core; +Cc: Stefano Babic

From: Stefano Babic <sbabic@nabladev.com>

Detecting the init manager from /sbin/init does not always work and it
fails when etc-overlayfs is used, because first the
pre-init script is called and init is renamed as init.orig.. Read the
process name with pid = 1 from /proc, and use it to detect the init manager.

Signed-off-by: Stefano Babic <sbabic@nabladev.com>
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index 4827779e2f..3ddee84b78 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,7 +4,8 @@
 #
 # Attempt to mount any added block devices and umount any removed devices
 
-BASE_INIT="`readlink -f "@base_sbindir@/init"`"
+INITNAME=`cat /proc/1/cmdline`
+BASE_INIT="`readlink -f ${INITNAME}`"
 INIT_SYSTEMD="@systemd_unitdir@/systemd"
 MOUNT_BASE="@MOUNT_BASE@"
 
@@ -165,7 +166,7 @@ automount() {
 		echo "$name" > "/tmp/.automount-$name"
 	fi
 }
-	
+
 rm_dir() {
 	# We do not want to rm -r populated directories
 	if test "`find "$1" | wc -l | tr -d " "`" -lt 2 -a -d "$1"
-- 
2.43.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-03-15 12:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-15 12:44 [PATCH] udev-extraconf: detect init manager from pid opensource

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox