public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: opensource@nabladev.com
To: openembedded-core@lists.openembedded.org
Cc: Stefano Babic <sbabic@nabladev.com>
Subject: [PATCH] udev-extraconf: detect init manager from pid
Date: Sun, 15 Mar 2026 13:44:01 +0100	[thread overview]
Message-ID: <20260315124401.53744-1-opensource@nabladev.com> (raw)

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



                 reply	other threads:[~2026-03-15 12:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260315124401.53744-1-opensource@nabladev.com \
    --to=opensource@nabladev.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=sbabic@nabladev.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox