public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2 0/1] installer: fix race condition with multiple consoles running unattended
@ 2026-02-19  4:12 'Badrikesh Prusty' via isar-users
  2026-02-19  4:12 ` [PATCH v2 1/1] " 'Badrikesh Prusty' via isar-users
  0 siblings, 1 reply; 2+ messages in thread
From: 'Badrikesh Prusty' via isar-users @ 2026-02-19  4:12 UTC (permalink / raw)
  To: isar-users; +Cc: Badrikesh Prusty

Changes in v2:
* Use /run/installer.fifo for progress_pipe instead of /tmp/progress
* Use /run/installer.lock for lockfile instead of /tmp/installer.lock

Badrikesh Prusty (1):
  installer: fix race condition with multiple consoles running
    unattended

 .../files/usr/bin/deploy-image-wic.sh         | 43 ++++++++++++++-----
 1 file changed, 32 insertions(+), 11 deletions(-)

--
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/20260219041235.441664-1-badrikesh.prusty%40siemens.com.

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

* [PATCH v2 1/1] installer: fix race condition with multiple consoles running unattended
  2026-02-19  4:12 [PATCH v2 0/1] installer: fix race condition with multiple consoles running unattended 'Badrikesh Prusty' via isar-users
@ 2026-02-19  4:12 ` 'Badrikesh Prusty' via isar-users
  0 siblings, 0 replies; 2+ messages in thread
From: 'Badrikesh Prusty' via isar-users @ 2026-02-19  4:12 UTC (permalink / raw)
  To: isar-users; +Cc: Badrikesh Prusty

* Add lockfile `/run/installer.lock` to prevent simultaneous unattended
  installs across multiple consoles.
* Add progress monitoring for installations started in another console
  via progress pipe.
* Periodically check if bmaptool is still running when progress pipe is
  unavailable and continue once bmaptool completes.
* Use /run/installer.fifo for progress_pipe instead of /tmp/progress

This resolves the race condition between consoles and prevents issues
with long-running or partially completed installations.

Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
---
 .../files/usr/bin/deploy-image-wic.sh         | 43 ++++++++++++++-----
 1 file changed, 32 insertions(+), 11 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 9c041a50..9a69fde5 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
@@ -231,13 +231,15 @@ version_ge() {
     fi
 }
 
-if ! $installer_unattended; then
+lockfile="/run/installer.lock"
+progress_pipe="/run/installer.fifo"
+
+exec 9>"$lockfile"
+if flock -n 9; then
     # Get bmap-tools version
     bmap_version=$(bmaptool --version | awk '{ print $NF }')
 
     if version_ge "$bmap_version" "3.6"; then
-        # Create a named pipe for progress communication
-        progress_pipe="/tmp/progress"
         if ! mkfifo "$progress_pipe"; then
             echo "Error: Failed to create named pipe $progress_pipe"
             exit 1
@@ -259,16 +261,35 @@ if ! $installer_unattended; then
 
         gauge_pid=$!
     fi
-fi
 
-if ! bmaptool $quiet_flag copy $bmap_options "$installer_image_uri" "$installer_target_dev"; then
-    kill "$gauge_pid"
-    exit 1
-fi
+    if ! bmaptool $quiet_flag copy $bmap_options "$installer_image_uri" "$installer_target_dev"; then
+        kill "$gauge_pid"
+        exit 1
+    fi
+
+    # Attempt to terminate the gauge process if still running.
+    # Errors are ignored since the process may already have exited.
+    kill "$gauge_pid" 2>/dev/null
+else
+    echo "Installation already running in another console."
+
+    # Wait for running console to create the progress pipe
+    sleep 2
 
-# Attempt to terminate the gauge process if still running.
-# Errors are ignored since the process may already have exited.
-kill "$gauge_pid" 2>/dev/null
+    # Check if progress pipe exists and has content
+    if [ -e "$progress_pipe" ]; then
+        echo "Installation progress..."
+        tail -f "$progress_pipe" | while read line; do
+            printf "\r%s%%" "$line"
+        done
+    else
+        # Periodically check if bmaptool is still running every 5 seconds
+        echo "Waiting for installation to finish..."
+        while pgrep -x "bmaptool" > /dev/null; do
+            sleep 5
+        done
+    fi
+fi
 
 if ! $installer_unattended; then
     dialog --title "Reboot" \
-- 
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/20260219041235.441664-2-badrikesh.prusty%40siemens.com.

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

end of thread, other threads:[~2026-02-19  4:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-19  4:12 [PATCH v2 0/1] installer: fix race condition with multiple consoles running unattended 'Badrikesh Prusty' via isar-users
2026-02-19  4:12 ` [PATCH v2 1/1] " 'Badrikesh Prusty' via isar-users

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