From: "'Kasturi Shekar' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Kasturi Shekar <kasturi.shekar@siemens.com>
Subject: [PATCH] installer: hide device-mapper root partitions from target device list
Date: Thu, 20 Nov 2025 09:52:17 +0530 [thread overview]
Message-ID: <20251120042217.1759272-1-kasturi.shekar@siemens.com> (raw)
Root filesystems exposed through device-mapper paths (e.g.,
/dev/mapper/verityroot or /dev/dm-0) were being included in the list of
installable block devices. Since these mapper devices represent the
active root filesystem, they must not appear as installation targets.
This change resolves the issue by detecting the underlying physical
device of the current root and skipping it during block device enumeration.
Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
---
.../files/usr/bin/deploy-image-wic.sh | 61 +++++++++++++------
1 file changed, 41 insertions(+), 20 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
index b5ea8119..a4e38876 100755
--- a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
@@ -36,22 +36,39 @@ if ! $installer_unattended; then
# inspired by poky/meta/recipes-core/initrdscripts/files/install-efi.sh
target_device_list=""
current_root_dev_type=$(findmnt / -o fstype -n)
+ exclude_list=()
+
if [ "$current_root_dev_type" = "nfs" ]; then
current_root_dev="nfs"
+ exclude_list+=("nfs")
else
- current_root_dev=$(readlink -f "$(findmnt / -o source -n)")
- current_root_dev=${current_root_dev#\/dev/}
- fi
+ # For normal or immutable systems, get the backing device of '/'
+ root_source=$(findmnt / -o source -n)
+ root_source_resolved=$(readlink -f "$root_source" 2>/dev/null || echo "$root_source")
+ current_root_dev=${root_source_resolved#/dev/}
+
+ # Always exclude the exact device mounted as /
+ exclude_list+=("$current_root_dev")
- case $current_root_dev in
- mmcblk*)
- ;;
- nvme*)
- ;;
- *)
- current_root_dev=${current_root_dev%%[0-9]*}
- ;;
- esac
+ base_no_part=${current_root_dev%%[0-9]*}
+ if [ -n "$base_no_part" ]; then
+ exclude_list+=("$base_no_part")
+ fi
+
+ # If root is coming through a dm-* device (e.g., dm-verity),
+ # the actual physical devices appear under /sys/block/<dm>/slaves/.
+ # We must exclude those slaves as well, otherwise the installer
+ # might show the live USB stick as a valid target.
+ if [ -d "/sys/block/$current_root_dev/slaves" ]; then
+ for slave in /sys/block/"$current_root_dev"/slaves/*; do
+ [ -e "$slave" ] || continue
+ slave_dev=$(basename "$slave")
+ exclude_list+=("$slave_dev")
+ slave_base=${slave_dev%%[0-9]*}
+ [ -n "$slave_base" ] && exclude_list+=("$slave_base")
+ done
+ fi
+ fi
echo "Searching for target device..."
@@ -102,14 +119,18 @@ if ! $installer_unattended; then
# skip ram device
;;
*)
- case $device in
- $current_root_dev*)
- # skip the device we are running from
- ;;
- *)
- target_device_list="$target_device_list $device"
- ;;
- esac
+ #skip any excluded devices (root and its slaves)
+ skip_device=0
+ for ex in "${exclude_list[@]}"; do
+ if [[ "$device" == "$ex"* ]]; then
+ skip_device=1
+ break
+ fi
+ done
+
+ if [ "$skip_device" -eq 0 ]; then
+ target_device_list="$target_device_list $device"
+ fi
;;
esac
done
--
2.39.5
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20251120042217.1759272-1-kasturi.shekar%40siemens.com.
next reply other threads:[~2025-11-20 4:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 4:22 'Kasturi Shekar' via isar-users [this message]
2025-11-26 9:46 ` Zhihang Wei
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=20251120042217.1759272-1-kasturi.shekar@siemens.com \
--to=isar-users@googlegroups.com \
--cc=kasturi.shekar@siemens.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