* [PATCH 00/17] Reworks, fixes and unattended mode for image installer
@ 2024-07-02 13:38 Jan Kiszka
2024-07-02 13:38 ` [PATCH 01/17] Kconfig: Rework installer image submenu Jan Kiszka
` (17 more replies)
0 siblings, 18 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
Address several issues of the image installer, specifically the script.
It also brings some simplistic way to make the installer operate without
user interaction.
What is still missing, though, is documentation of how to integrate all
that in own projects. Also, I would like to make hooking into the script
possible so that certain interactions with the user can be customized
without having to fork the recipe. Still needs to be designed, and would
have only made this queue even longer.
Jan
Jan Kiszka (17):
Kconfig: Rework installer image submenu
installer: Do not show systemd boot menu
meta-isar: deploy-image: Change reboot logic
meta-isar: deploy-image: Drop umount attempt after installation
meta-isar: deploy-image: Fix bmap support
meta-isar: deploy-image: Improve root mountpoint discovery
meta-isar: deploy-image: Make TARGET_DEVICE a complete path
meta-isar: deploy-image: Drop pointless --clear options from dialog
meta-isar: deploy-image: Allow to cancel installation
meta-isar: deploy-image: Warn if overwriting a non-empty disk
meta-isar: deploy-image: Fix and enhance image selection dialog
meta-isar: deploy-image: Improve target device list dialog
meta-isar: deploy-image: Polish some dialogs
meta-isar: deploy-image: Re-indent
meta-isar: deploy-image: Prepare for auto-installation mode
meta-isar: deploy-image: Introduce auto-installation mode
meta-isar: deploy-image: Polish recipe
kas/image/Kconfig | 43 +++-
.../deploy-image/deploy-image_0.1.bb | 9 +-
.../deploy-image/files/deploy-image-wic.sh | 188 +++++++++++-------
.../deploy-image/files/install.override.conf | 2 +-
.../lib/wic/canned-wks/installer-efi.wks.in | 2 +-
5 files changed, 150 insertions(+), 94 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 01/17] Kconfig: Rework installer image submenu
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 02/17] installer: Do not show systemd boot menu Jan Kiszka
` (16 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
Even though kas processes it, "menuconfig" is not a valid entry for a
choice. While fixing this, also make the installer payload a choice,
rather than a string input, to make it easier for users.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
kas/image/Kconfig | 43 ++++++++++++++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 11 deletions(-)
diff --git a/kas/image/Kconfig b/kas/image/Kconfig
index 45611c4e..e4f64dcc 100644
--- a/kas/image/Kconfig
+++ b/kas/image/Kconfig
@@ -30,24 +30,45 @@ config IMAGE_CI
This image includes is for running CI. Via isar-ci-ssh-setup recipe.
It creates ci user with non-interactive ssh access to the board.
-menuconfig IMAGE_INSTALLER
+config IMAGE_INSTALLER
bool "Installer image"
help
This image contains a target image and scripts to install the target image on a device.
-config INSTALLER_TARGET_IMAGE
- string "Install Base or Debug image"
- default "isar-image-base"
+endchoice
+
+if IMAGE_INSTALLER
+
+choice
+ prompt "Image to install"
+ default INSTALL_IMAGE_BASE
+
+config INSTALL_IMAGE_BASE
+ bool "Base image"
help
- This selects the target image of the installer:
- - isar-image-base
- - isar-image-debug
- If left empty it will generate a installer image without payload.
- The user of that image needs then to copy a image to the partition
- labeled INSTALLDATA.
- depends on IMAGE_INSTALLER
+ Embed the basic Isar image into the installer image.
+
+config INSTALL_IMAGE_DEBUG
+ bool "Debug image"
+ help
+ Embed the Isar debug image into the installer image.
+
+config INSTALL_EMPTY
+ bool "No installer payload"
+ help
+ This will generate a installer image without payload. The user of
+ that image needs then to copy a image to the partition labeled
+ INSTALLDATA.
+
endchoice
+config INSTALLER_TARGET_IMAGE
+ string
+ default "isar-image-base" if INSTALL_IMAGE_BASE
+ default "isar-image-base" if INSTALL_IMAGE_DEBUG
+
+endif
+
config KAS_INCLUDE_IMAGE
string
default "kas/image/isar-image-base.yaml" if IMAGE_BASE
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 02/17] installer: Do not show systemd boot menu
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
2024-07-02 13:38 ` [PATCH 01/17] Kconfig: Rework installer image submenu Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 03/17] meta-isar: deploy-image: Change reboot logic Jan Kiszka
` (15 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
We only have a single target to boot.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in b/meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in
index 62c045b6..be8127cb 100644
--- a/meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in
+++ b/meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in
@@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT
-bootloader --ptable gpt --timeout 3 --append "rootwait console=ttyS0,115200 console=tty0 earlyprintk"
+bootloader --ptable gpt --timeout 0 --append "rootwait console=ttyS0,115200 console=tty0 earlyprintk"
part /boot --source bootimg-efi-isar --sourceparams "loader=systemd-boot" --label efi --part-type EF00 --align 1024 --use-uuid
part / --source rootfs --fstype ext4 --exclude-path=install --label installroot --align 1024 --use-uuid
part /install --source rootfs --change-directory=install --label INSTALLDATA --size 4G --fstype=vfat --use-uuid --align 1024
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 03/17] meta-isar: deploy-image: Change reboot logic
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
2024-07-02 13:38 ` [PATCH 01/17] Kconfig: Rework installer image submenu Jan Kiszka
2024-07-02 13:38 ` [PATCH 02/17] installer: Do not show systemd boot menu Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2025-03-13 13:10 ` Uladzimir Bely
2024-07-02 13:38 ` [PATCH 04/17] meta-isar: deploy-image: Drop umount attempt after installation Jan Kiszka
` (14 subsequent siblings)
17 siblings, 1 reply; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
Pull the reboot out of the script. This allows for cleaner integration
with different calling environment, may they be a systemd unit, an
initramfs script or simply a shell for testing purposes.
And if the script exits with an error, wait a minute before rebooting
the system, rather than just trying to re-execute it. This permits to
inspect potential error as well.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../recipes-installer/deploy-image/files/deploy-image-wic.sh | 2 +-
.../recipes-installer/deploy-image/files/install.override.conf | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 8043aff1..12c1eea2 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -105,4 +105,4 @@ fi
umount "$installdata"
sync
dialog --title "Reboot" --msgbox "Installation is successful. System will be rebooted. Please remove the USB stick." 7 60
-reboot
+exit 0
diff --git a/meta-isar/recipes-installer/deploy-image/files/install.override.conf b/meta-isar/recipes-installer/deploy-image/files/install.override.conf
index 73874caa..357d8662 100644
--- a/meta-isar/recipes-installer/deploy-image/files/install.override.conf
+++ b/meta-isar/recipes-installer/deploy-image/files/install.override.conf
@@ -1,5 +1,5 @@
[Service]
ExecStart=
-ExecStart=/usr/bin/deploy-image-wic.sh
+ExecStart=/bin/sh -c "deploy-image-wic.sh || (echo 'Rebooting in 60 s'; sleep 60); reboot"
StandardInput=tty
StandardOutput=tty
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 04/17] meta-isar: deploy-image: Drop umount attempt after installation
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (2 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 03/17] meta-isar: deploy-image: Change reboot logic Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 05/17] meta-isar: deploy-image: Fix bmap support Jan Kiszka
` (13 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
Under systemd, this fails because /install is still busy. In that setup,
systemd will take care of properly unmounting this partition anyway on
reboot. In other setups, the caller should take care.
This also obsoletes the "set -e" because no commands are left that can
produce errors and are not checked explicitly.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../recipes-installer/deploy-image/files/deploy-image-wic.sh | 5 -----
1 file changed, 5 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 12c1eea2..9a1fa651 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -90,7 +90,6 @@ fi
TARGET_DEVICE_SIZE=$(lsblk --nodeps --noheadings -o SIZE /dev/"$TARGET_DEVICE")
dialog --msgbox "Start installing '$DISK_IMAGE' to '$TARGET_DEVICE'(Size: '$TARGET_DEVICE_SIZE' )." 7 60
-set -e
bmap_options=""
if [ -z "$DISK_BMAP" ]; then
bmap_options="--nobmap"
@@ -100,9 +99,5 @@ if ! bmaptool copy "${bmap_options}" "$DISK_IMAGE" "/dev/${TARGET_DEVICE}"; then
exit 1
fi
-# we need to umount before reboot to avoid
-# data corruption due to the use of vfat.
-umount "$installdata"
-sync
dialog --title "Reboot" --msgbox "Installation is successful. System will be rebooted. Please remove the USB stick." 7 60
exit 0
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 05/17] meta-isar: deploy-image: Fix bmap support
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (3 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 04/17] meta-isar: deploy-image: Drop umount attempt after installation Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 06/17] meta-isar: deploy-image: Improve root mountpoint discovery Jan Kiszka
` (12 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
If the to-be-installed image was compressed, its corresponding .bmap
file was not found. Fix that and also ensure that bmaptool is correctly
invoked if --nobmap does not have to be inserted.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../deploy-image/files/deploy-image-wic.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 9a1fa651..d27a0189 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -6,7 +6,7 @@
installdata=${INSTALL_DATA:-/install}
-DISK_IMAGE=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap")
+DISK_IMAGE=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;)
if [ -z "$DISK_IMAGE" ]; then
pushd "$installdata"
shopt -s nullglob
@@ -17,11 +17,11 @@ if [ -z "$DISK_IMAGE" ]; then
"${array[@]}" --output-fd 1)
popd
fi
-if [ ! -f "$DISK_IMAGE" ]; then
+if [ ! -f "$installdata/$DISK_IMAGE" ]; then
dialog --msgbox "Could not find an image to install. Installation aborted." 7 60
exit 1
fi
-DISK_BMAP=$(find "$installdata" -type f -iname "$DISK_IMAGE.bmap")
+DISK_BMAP=$(find "$installdata" -type f -iname "${DISK_IMAGE%.wic*}.wic.bmap")
# inspired by poky/meta/recipes-core/initrdscripts/files/install-efi.sh
target_device_list=""
@@ -95,7 +95,7 @@ if [ -z "$DISK_BMAP" ]; then
bmap_options="--nobmap"
fi
clear
-if ! bmaptool copy "${bmap_options}" "$DISK_IMAGE" "/dev/${TARGET_DEVICE}"; then
+if ! bmaptool copy ${bmap_options} "$installdata/$DISK_IMAGE" "/dev/${TARGET_DEVICE}"; then
exit 1
fi
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 06/17] meta-isar: deploy-image: Improve root mountpoint discovery
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (4 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 05/17] meta-isar: deploy-image: Fix bmap support Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 07/17] meta-isar: deploy-image: Make TARGET_DEVICE a complete path Jan Kiszka
` (11 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
The rootfs mountpoint may only appear as /dev/root in /proc/mounts.
Therefore, reuse the pattern we have in expand-on-first-boot already and
switch to findmnt.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../recipes-installer/deploy-image/files/deploy-image-wic.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index d27a0189..f73a48a9 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -25,7 +25,7 @@ DISK_BMAP=$(find "$installdata" -type f -iname "${DISK_IMAGE%.wic*}.wic.bmap")
# inspired by poky/meta/recipes-core/initrdscripts/files/install-efi.sh
target_device_list=""
-current_root_dev=$(grep "[[:blank:]]/[[:blank:]]" /proc/mounts | awk '{print $1}')
+current_root_dev=$(readlink -f "$(findmnt / -o source -n)")
current_root_dev=${current_root_dev#\/dev/}
case $current_root_dev in
mmcblk*)
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 07/17] meta-isar: deploy-image: Make TARGET_DEVICE a complete path
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (5 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 06/17] meta-isar: deploy-image: Improve root mountpoint discovery Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 08/17] meta-isar: deploy-image: Drop pointless --clear options from dialog Jan Kiszka
` (10 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
Avoids having to prepend /dev/ at every user.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../deploy-image/files/deploy-image-wic.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index f73a48a9..5c362bcf 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -78,16 +78,16 @@ if [ "$(echo "$target_device_list" | wc -w)" -gt 1 ]; then
array=()
for target in $target_device_list; do
target_size=$(lsblk --nodeps --noheadings -o SIZE /dev/"$target")
- array+=("$target" "/dev/$target $target_size")
+ array+=("/dev/$target" "/dev/$target $target_size")
done
TARGET_DEVICE=$(dialog --clear \
--no-tags --menu "Select device to install $DISK_IMAGE" 10 60 3 \
"${array[@]}" --output-fd 1)
else
- TARGET_DEVICE=$(echo "$target_device_list" | tr -d " ")
+ TARGET_DEVICE=/dev/$(echo "$target_device_list" | tr -d " ")
fi
-TARGET_DEVICE_SIZE=$(lsblk --nodeps --noheadings -o SIZE /dev/"$TARGET_DEVICE")
+TARGET_DEVICE_SIZE=$(lsblk --nodeps --noheadings -o SIZE "$TARGET_DEVICE")
dialog --msgbox "Start installing '$DISK_IMAGE' to '$TARGET_DEVICE'(Size: '$TARGET_DEVICE_SIZE' )." 7 60
bmap_options=""
@@ -95,7 +95,7 @@ if [ -z "$DISK_BMAP" ]; then
bmap_options="--nobmap"
fi
clear
-if ! bmaptool copy ${bmap_options} "$installdata/$DISK_IMAGE" "/dev/${TARGET_DEVICE}"; then
+if ! bmaptool copy ${bmap_options} "$installdata/$DISK_IMAGE" "${TARGET_DEVICE}"; then
exit 1
fi
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 08/17] meta-isar: deploy-image: Drop pointless --clear options from dialog
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (6 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 07/17] meta-isar: deploy-image: Make TARGET_DEVICE a complete path Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 09/17] meta-isar: deploy-image: Allow to cancel installation Jan Kiszka
` (9 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
We are not using --and-widget.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../deploy-image/files/deploy-image-wic.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 5c362bcf..284252fb 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -12,9 +12,9 @@ if [ -z "$DISK_IMAGE" ]; then
shopt -s nullglob
array=(*)
shopt -u nullglob
- DISK_IMAGE=$(dialog --clear \
- --no-tags --menu "Select image to be installed" 10 60 3 \
- "${array[@]}" --output-fd 1)
+ DISK_IMAGE=$(dialog --no-tags \
+ --menu "Select image to be installed" 10 60 3 \
+ "${array[@]}" --output-fd 1)
popd
fi
if [ ! -f "$installdata/$DISK_IMAGE" ]; then
@@ -80,9 +80,9 @@ if [ "$(echo "$target_device_list" | wc -w)" -gt 1 ]; then
target_size=$(lsblk --nodeps --noheadings -o SIZE /dev/"$target")
array+=("/dev/$target" "/dev/$target $target_size")
done
- TARGET_DEVICE=$(dialog --clear \
- --no-tags --menu "Select device to install $DISK_IMAGE" 10 60 3 \
- "${array[@]}" --output-fd 1)
+ TARGET_DEVICE=$(dialog --no-tags \
+ --menu "Select device to install $DISK_IMAGE" 10 60 3 \
+ "${array[@]}" --output-fd 1)
else
TARGET_DEVICE=/dev/$(echo "$target_device_list" | tr -d " ")
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 09/17] meta-isar: deploy-image: Allow to cancel installation
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (7 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 08/17] meta-isar: deploy-image: Drop pointless --clear options from dialog Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 10/17] meta-isar: deploy-image: Warn if overwriting a non-empty disk Jan Kiszka
` (8 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
Terminate if the users chooses to cancel. Offer this option also on the
final message box before the start.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../deploy-image/files/deploy-image-wic.sh | 22 ++++++++++++-------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 284252fb..09d6cc11 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -12,10 +12,12 @@ if [ -z "$DISK_IMAGE" ]; then
shopt -s nullglob
array=(*)
shopt -u nullglob
- DISK_IMAGE=$(dialog --no-tags \
- --menu "Select image to be installed" 10 60 3 \
- "${array[@]}" --output-fd 1)
popd
+ if ! DISK_IMAGE=$(dialog --no-tags \
+ --menu "Select image to be installed" 10 60 3 \
+ "${array[@]}" --output-fd 1)
+ exit 0
+ fi
fi
if [ ! -f "$installdata/$DISK_IMAGE" ]; then
dialog --msgbox "Could not find an image to install. Installation aborted." 7 60
@@ -80,15 +82,19 @@ if [ "$(echo "$target_device_list" | wc -w)" -gt 1 ]; then
target_size=$(lsblk --nodeps --noheadings -o SIZE /dev/"$target")
array+=("/dev/$target" "/dev/$target $target_size")
done
- TARGET_DEVICE=$(dialog --no-tags \
- --menu "Select device to install $DISK_IMAGE" 10 60 3 \
- "${array[@]}" --output-fd 1)
-
+ if ! TARGET_DEVICE=$(dialog --no-tags \
+ --menu "Select device to install image to" 10 60 3 \
+ "${array[@]}" --output-fd 1); then
+ exit 0
+ fi
else
TARGET_DEVICE=/dev/$(echo "$target_device_list" | tr -d " ")
fi
TARGET_DEVICE_SIZE=$(lsblk --nodeps --noheadings -o SIZE "$TARGET_DEVICE")
-dialog --msgbox "Start installing '$DISK_IMAGE' to '$TARGET_DEVICE'(Size: '$TARGET_DEVICE_SIZE' )." 7 60
+if ! dialog --yes-label Ok --no-label Cancel \
+ --yesno "Start installing '$DISK_IMAGE' to '$TARGET_DEVICE'(Size: '$TARGET_DEVICE_SIZE' )." 7 60; then
+ exit 0
+fi
bmap_options=""
if [ -z "$DISK_BMAP" ]; then
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 10/17] meta-isar: deploy-image: Warn if overwriting a non-empty disk
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (8 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 09/17] meta-isar: deploy-image: Allow to cancel installation Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-03 15:53 ` 'MOESSBAUER, Felix' via isar-users
2024-07-02 13:38 ` [PATCH 11/17] meta-isar: deploy-image: Fix and enhance image selection dialog Jan Kiszka
` (7 subsequent siblings)
17 siblings, 1 reply; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
Check of the first MB of the target device is only containing zero and
warn otherwise before overwriting potentially valuable data. Looking
at the first MB should cover enough partition table and file system
structures to detect a valid disk.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../deploy-image/files/deploy-image-wic.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 09d6cc11..81a006ce 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -96,6 +96,12 @@ if ! dialog --yes-label Ok --no-label Cancel \
exit 0
fi
+if ! cmp /dev/zero "$TARGET_DEVICE" -n 1M && \
+ ! dialog --defaultno \
+ --yesno "WARNING: Target device is not empty! Continue anyway?" 5 60; then
+ exit 0
+fi
+
bmap_options=""
if [ -z "$DISK_BMAP" ]; then
bmap_options="--nobmap"
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 11/17] meta-isar: deploy-image: Fix and enhance image selection dialog
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (9 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 10/17] meta-isar: deploy-image: Warn if overwriting a non-empty disk Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 12/17] meta-isar: deploy-image: Improve target device list dialog Jan Kiszka
` (6 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
The dialog was broken because an array of tag/value tuples had to be
provided, not just a list of files.
Use the chance an also fall back to the dialog if the search for
DISK_IMAGE does deliver a result but not a clear one. But only open the
dialog if there are entries.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../deploy-image/files/deploy-image-wic.sh | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 81a006ce..35029728 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -7,16 +7,18 @@
installdata=${INSTALL_DATA:-/install}
DISK_IMAGE=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;)
-if [ -z "$DISK_IMAGE" ]; then
+if [ -z "$DISK_IMAGE" ] || [ ! -f "$installdata/$DISK_IMAGE" ]; then
pushd "$installdata"
- shopt -s nullglob
- array=(*)
- shopt -u nullglob
+ for f in $(find . -type f); do
+ array+=("$f" "$f")
+ done
popd
- if ! DISK_IMAGE=$(dialog --no-tags \
- --menu "Select image to be installed" 10 60 3 \
- "${array[@]}" --output-fd 1)
- exit 0
+ if [ ${#array[@]} -gt 0 ]; then
+ if ! DISK_IMAGE=$(dialog --no-tags \
+ --menu "Select image to be installed" 10 60 3 \
+ "${array[@]}" --output-fd 1); then
+ exit 0
+ fi
fi
fi
if [ ! -f "$installdata/$DISK_IMAGE" ]; then
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 12/17] meta-isar: deploy-image: Improve target device list dialog
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (10 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 11/17] meta-isar: deploy-image: Fix and enhance image selection dialog Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 13/17] meta-isar: deploy-image: Polish some dialogs Jan Kiszka
` (5 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
Sort the list by device name to make navigation easier. Show also if a
device probably still contains data.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../deploy-image/files/deploy-image-wic.sh | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 35029728..673b2eb3 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -80,9 +80,14 @@ fi
if [ "$(echo "$target_device_list" | wc -w)" -gt 1 ]; then
array=()
- for target in $target_device_list; do
- target_size=$(lsblk --nodeps --noheadings -o SIZE /dev/"$target")
- array+=("/dev/$target" "/dev/$target $target_size")
+ for target in $(echo "$target_device_list" | xargs -n1 | sort); do
+ target_size=$(lsblk --nodeps --noheadings -o SIZE /dev/"$target" | tr -d " ")
+ if cmp /dev/zero /dev/"$target" -n 1M; then
+ state="empty"
+ else
+ state="contains data"
+ fi
+ array+=("/dev/$target" "/dev/$target ($target_size, $state)")
done
if ! TARGET_DEVICE=$(dialog --no-tags \
--menu "Select device to install image to" 10 60 3 \
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 13/17] meta-isar: deploy-image: Polish some dialogs
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (11 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 12/17] meta-isar: deploy-image: Improve target device list dialog Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 14/17] meta-isar: deploy-image: Re-indent Jan Kiszka
` (4 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
Add linewraps at defined points to the start dialog, strip spaces from
device size output, adjust formattings. Some other message boxes can be
shrunk in height.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../deploy-image/files/deploy-image-wic.sh | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 673b2eb3..5ae62a55 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -22,7 +22,7 @@ if [ -z "$DISK_IMAGE" ] || [ ! -f "$installdata/$DISK_IMAGE" ]; then
fi
fi
if [ ! -f "$installdata/$DISK_IMAGE" ]; then
- dialog --msgbox "Could not find an image to install. Installation aborted." 7 60
+ dialog --msgbox "Could not find an image to install. Installation aborted." 6 60
exit 1
fi
DISK_BMAP=$(find "$installdata" -type f -iname "${DISK_IMAGE%.wic*}.wic.bmap")
@@ -97,9 +97,9 @@ if [ "$(echo "$target_device_list" | wc -w)" -gt 1 ]; then
else
TARGET_DEVICE=/dev/$(echo "$target_device_list" | tr -d " ")
fi
-TARGET_DEVICE_SIZE=$(lsblk --nodeps --noheadings -o SIZE "$TARGET_DEVICE")
+TARGET_DEVICE_SIZE=$(lsblk --nodeps --noheadings -o SIZE "$TARGET_DEVICE" | tr -d " ")
if ! dialog --yes-label Ok --no-label Cancel \
- --yesno "Start installing '$DISK_IMAGE' to '$TARGET_DEVICE'(Size: '$TARGET_DEVICE_SIZE' )." 7 60; then
+ --yesno "Start installing\n'$DISK_IMAGE'\nto $TARGET_DEVICE (capacity: $TARGET_DEVICE_SIZE)" 7 60; then
exit 0
fi
@@ -118,5 +118,6 @@ if ! bmaptool copy ${bmap_options} "$installdata/$DISK_IMAGE" "${TARGET_DEVICE}"
exit 1
fi
-dialog --title "Reboot" --msgbox "Installation is successful. System will be rebooted. Please remove the USB stick." 7 60
+dialog --title "Reboot" \
+ --msgbox "Installation is successful. System will be rebooted. Please remove the USB stick." 6 60
exit 0
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 14/17] meta-isar: deploy-image: Re-indent
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (12 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 13/17] meta-isar: deploy-image: Polish some dialogs Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 15/17] meta-isar: deploy-image: Prepare for auto-installation mode Jan Kiszka
` (3 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
No functional changes, just style improvements.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../deploy-image/files/deploy-image-wic.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 5ae62a55..77eebe18 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -33,12 +33,12 @@ current_root_dev=$(readlink -f "$(findmnt / -o source -n)")
current_root_dev=${current_root_dev#\/dev/}
case $current_root_dev in
mmcblk*)
- ;;
+ ;;
nvme*)
- ;;
+ ;;
*)
current_root_dev=${current_root_dev%%[0-9]*}
- ;;
+ ;;
esac
echo "Searching for target device..."
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 15/17] meta-isar: deploy-image: Prepare for auto-installation mode
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (13 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 14/17] meta-isar: deploy-image: Re-indent Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-02 13:38 ` [PATCH 16/17] meta-isar: deploy-image: Introduce " Jan Kiszka
` (2 subsequent siblings)
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
Wrap the code blocks that will be skipped in auto-installation mode
separately to ease review. As the controlling variable remains false for
now, there are effectively no functional changes.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../deploy-image/files/deploy-image-wic.sh | 163 +++++++++---------
1 file changed, 86 insertions(+), 77 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 77eebe18..9df93fe7 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -6,21 +6,26 @@
installdata=${INSTALL_DATA:-/install}
-DISK_IMAGE=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;)
-if [ -z "$DISK_IMAGE" ] || [ ! -f "$installdata/$DISK_IMAGE" ]; then
- pushd "$installdata"
- for f in $(find . -type f); do
- array+=("$f" "$f")
- done
- popd
- if [ ${#array[@]} -gt 0 ]; then
- if ! DISK_IMAGE=$(dialog --no-tags \
- --menu "Select image to be installed" 10 60 3 \
- "${array[@]}" --output-fd 1); then
- exit 0
+AUTO_INSTALL=false
+
+if ! $AUTO_INSTALL; then
+ DISK_IMAGE=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;)
+ if [ -z "$DISK_IMAGE" ] || [ ! -f "$installdata/$DISK_IMAGE" ]; then
+ pushd "$installdata"
+ for f in $(find . -type f); do
+ array+=("$f" "$f")
+ done
+ popd
+ if [ ${#array[@]} -gt 0 ]; then
+ if ! DISK_IMAGE=$(dialog --no-tags \
+ --menu "Select image to be installed" 10 60 3 \
+ "${array[@]}" --output-fd 1); then
+ exit 0
+ fi
fi
fi
fi
+
if [ ! -f "$installdata/$DISK_IMAGE" ]; then
dialog --msgbox "Could not find an image to install. Installation aborted." 6 60
exit 1
@@ -28,79 +33,81 @@ fi
DISK_BMAP=$(find "$installdata" -type f -iname "${DISK_IMAGE%.wic*}.wic.bmap")
# inspired by poky/meta/recipes-core/initrdscripts/files/install-efi.sh
-target_device_list=""
-current_root_dev=$(readlink -f "$(findmnt / -o source -n)")
-current_root_dev=${current_root_dev#\/dev/}
-case $current_root_dev in
- mmcblk*)
- ;;
- nvme*)
- ;;
- *)
- current_root_dev=${current_root_dev%%[0-9]*}
- ;;
-esac
-
-echo "Searching for target device..."
-
-devices=$(find /sys/block/ -type b,c,f,l -not -iname "mmcblk*" -printf "%f\n") || true
-mmc_devices=$(find /sys/block/ -type b,c,f,l -iname "mmcblk[0-9]" -printf "%f\n") || true
-devices="$devices $mmc_devices"
-
-for device in $devices; do
- case $device in
- loop*)
- # skip loop device
- ;;
- mtd*)
+if ! $AUTO_INSTALL; then
+ target_device_list=""
+ current_root_dev=$(readlink -f "$(findmnt / -o source -n)")
+ current_root_dev=${current_root_dev#\/dev/}
+ case $current_root_dev in
+ mmcblk*)
;;
- sr*)
- # skip CDROM device
- ;;
- ram*)
- # skip ram device
+ nvme*)
;;
*)
- case $device in
- $current_root_dev*)
- # skip the device we are running from
- ;;
- *)
- target_device_list="$target_device_list $device"
- ;;
- esac
+ current_root_dev=${current_root_dev%%[0-9]*}
;;
esac
-done
-if [ -z "${target_device_list}" ]; then
- dialog --msgbox "You need another device (besides the live device /dev/${current_root_dev}) to install the image. Installation aborted." 7 60
- exit 1
-fi
+ echo "Searching for target device..."
-if [ "$(echo "$target_device_list" | wc -w)" -gt 1 ]; then
- array=()
- for target in $(echo "$target_device_list" | xargs -n1 | sort); do
- target_size=$(lsblk --nodeps --noheadings -o SIZE /dev/"$target" | tr -d " ")
- if cmp /dev/zero /dev/"$target" -n 1M; then
- state="empty"
- else
- state="contains data"
- fi
- array+=("/dev/$target" "/dev/$target ($target_size, $state)")
+ devices=$(find /sys/block/ -type b,c,f,l -not -iname "mmcblk*" -printf "%f\n") || true
+ mmc_devices=$(find /sys/block/ -type b,c,f,l -iname "mmcblk[0-9]" -printf "%f\n") || true
+ devices="$devices $mmc_devices"
+
+ for device in $devices; do
+ case $device in
+ loop*)
+ # skip loop device
+ ;;
+ mtd*)
+ ;;
+ sr*)
+ # skip CDROM device
+ ;;
+ ram*)
+ # skip ram device
+ ;;
+ *)
+ case $device in
+ $current_root_dev*)
+ # skip the device we are running from
+ ;;
+ *)
+ target_device_list="$target_device_list $device"
+ ;;
+ esac
+ ;;
+ esac
done
- if ! TARGET_DEVICE=$(dialog --no-tags \
- --menu "Select device to install image to" 10 60 3 \
- "${array[@]}" --output-fd 1); then
+
+ if [ -z "${target_device_list}" ]; then
+ dialog --msgbox "You need another device (besides the live device /dev/${current_root_dev}) to install the image. Installation aborted." 7 60
+ exit 1
+ fi
+
+ if [ "$(echo "$target_device_list" | wc -w)" -gt 1 ]; then
+ array=()
+ for target in $(echo "$target_device_list" | xargs -n1 | sort); do
+ target_size=$(lsblk --nodeps --noheadings -o SIZE /dev/"$target" | tr -d " ")
+ if cmp /dev/zero /dev/"$target" -n 1M; then
+ state="empty"
+ else
+ state="contains data"
+ fi
+ array+=("/dev/$target" "/dev/$target ($target_size, $state)")
+ done
+ if ! TARGET_DEVICE=$(dialog --no-tags \
+ --menu "Select device to install image to" 10 60 3 \
+ "${array[@]}" --output-fd 1); then
+ exit 0
+ fi
+ else
+ TARGET_DEVICE=/dev/$(echo "$target_device_list" | tr -d " ")
+ fi
+ TARGET_DEVICE_SIZE=$(lsblk --nodeps --noheadings -o SIZE "$TARGET_DEVICE" | tr -d " ")
+ if ! dialog --yes-label Ok --no-label Cancel \
+ --yesno "Start installing\n'$DISK_IMAGE'\nto $TARGET_DEVICE (capacity: $TARGET_DEVICE_SIZE)" 7 60; then
exit 0
fi
-else
- TARGET_DEVICE=/dev/$(echo "$target_device_list" | tr -d " ")
-fi
-TARGET_DEVICE_SIZE=$(lsblk --nodeps --noheadings -o SIZE "$TARGET_DEVICE" | tr -d " ")
-if ! dialog --yes-label Ok --no-label Cancel \
- --yesno "Start installing\n'$DISK_IMAGE'\nto $TARGET_DEVICE (capacity: $TARGET_DEVICE_SIZE)" 7 60; then
- exit 0
fi
if ! cmp /dev/zero "$TARGET_DEVICE" -n 1M && \
@@ -118,6 +125,8 @@ if ! bmaptool copy ${bmap_options} "$installdata/$DISK_IMAGE" "${TARGET_DEVICE}"
exit 1
fi
-dialog --title "Reboot" \
- --msgbox "Installation is successful. System will be rebooted. Please remove the USB stick." 6 60
+if ! $AUTO_INSTALL; then
+ dialog --title "Reboot" \
+ --msgbox "Installation is successful. System will be rebooted. Please remove the USB stick." 6 60
+fi
exit 0
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 16/17] meta-isar: deploy-image: Introduce auto-installation mode
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (14 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 15/17] meta-isar: deploy-image: Prepare for auto-installation mode Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-03 15:56 ` 'MOESSBAUER, Felix' via isar-users
2024-07-02 13:38 ` [PATCH 17/17] meta-isar: deploy-image: Polish recipe Jan Kiszka
2024-07-23 7:40 ` [PATCH 00/17] Reworks, fixes and unattended mode for image installer Uladzimir Bely
17 siblings, 1 reply; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
If a special file called auto.install is found in the installation data
directory, parse this and attempt an unattended installation. The file
consists of 2 to 3 lines:
- source file name
- target device path
- optionally, "OVERWRITE" to ignore if the target device is non-empty
e.g.:
$ cat /install/auto.install
isar-image-base-debian-bookworm-qemuamd64.wic.zst
/dev/vda
OVERWRITE
Errors are still stopping the process, switching it back to interactive
mode.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../deploy-image/files/deploy-image-wic.sh | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 9df93fe7..8b25b1d2 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -7,8 +7,20 @@
installdata=${INSTALL_DATA:-/install}
AUTO_INSTALL=false
+OVERWRITE=
-if ! $AUTO_INSTALL; then
+if [ -f "$installdata/auto.install" ]; then
+ exec 3<"$installdata/auto.install"
+ read -r DISK_IMAGE <&3
+ read -r TARGET_DEVICE <&3
+ read -r OVERWRITE <&3
+ exec 3>&-
+ if [ ! -b ${TARGET_DEVICE} ]; then
+ dialog --msgbox "Target device is not a valid block device. Installation aborted." 6 60
+ exit 1
+ fi
+ AUTO_INSTALL=true
+else
DISK_IMAGE=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;)
if [ -z "$DISK_IMAGE" ] || [ ! -f "$installdata/$DISK_IMAGE" ]; then
pushd "$installdata"
@@ -110,7 +122,7 @@ if ! $AUTO_INSTALL; then
fi
fi
-if ! cmp /dev/zero "$TARGET_DEVICE" -n 1M && \
+if [ "$OVERWRITE" != "OVERWRITE" ] && ! cmp /dev/zero "$TARGET_DEVICE" -n 1M && \
! dialog --defaultno \
--yesno "WARNING: Target device is not empty! Continue anyway?" 5 60; then
exit 0
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 17/17] meta-isar: deploy-image: Polish recipe
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (15 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 16/17] meta-isar: deploy-image: Introduce " Jan Kiszka
@ 2024-07-02 13:38 ` Jan Kiszka
2024-07-23 7:40 ` [PATCH 00/17] Reworks, fixes and unattended mode for image installer Uladzimir Bely
17 siblings, 0 replies; 30+ messages in thread
From: Jan Kiszka @ 2024-07-02 13:38 UTC (permalink / raw)
To: isar-users; +Cc: Quirin Gylstorff
From: Jan Kiszka <jan.kiszka@siemens.com>
Adjust description to what the tool actually does. Reindent.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../recipes-installer/deploy-image/deploy-image_0.1.bb | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb b/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
index 0e61de03..3f34424f 100644
--- a/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
+++ b/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
@@ -3,8 +3,7 @@
#
# SPDX-License-Identifier: MIT
-DESCRIPTION = "add target image to rootfs"
-
+DESCRIPTION = "Install image to device"
inherit dpkg-raw
@@ -16,7 +15,7 @@ do_install[cleandirs] = "${D}/usr/bin/ \
${D}/usr/lib/systemd/system/getty@tty1.service.d/ \
${D}/usr/lib/systemd/system/serial-getty@ttyS0.service.d/"
do_install() {
- install -m 0755 ${WORKDIR}/deploy-image-wic.sh ${D}/usr/bin/deploy-image-wic.sh
- install -m 0600 ${WORKDIR}/install.override.conf ${D}/usr/lib/systemd/system/getty@tty1.service.d/override.conf
- install -m 0600 ${WORKDIR}/install.override.conf ${D}/usr/lib/systemd/system/serial-getty@ttyS0.service.d/override.conf
+ install -m 0755 ${WORKDIR}/deploy-image-wic.sh ${D}/usr/bin/deploy-image-wic.sh
+ install -m 0600 ${WORKDIR}/install.override.conf ${D}/usr/lib/systemd/system/getty@tty1.service.d/override.conf
+ install -m 0600 ${WORKDIR}/install.override.conf ${D}/usr/lib/systemd/system/serial-getty@ttyS0.service.d/override.conf
}
--
2.43.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 10/17] meta-isar: deploy-image: Warn if overwriting a non-empty disk
2024-07-02 13:38 ` [PATCH 10/17] meta-isar: deploy-image: Warn if overwriting a non-empty disk Jan Kiszka
@ 2024-07-03 15:53 ` 'MOESSBAUER, Felix' via isar-users
2024-07-03 15:55 ` 'Jan Kiszka' via isar-users
0 siblings, 1 reply; 30+ messages in thread
From: 'MOESSBAUER, Felix' via isar-users @ 2024-07-03 15:53 UTC (permalink / raw)
To: isar-users, Kiszka, Jan; +Cc: quirin.gylstorff
On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> Check of the first MB of the target device is only containing zero
-------^ typo: if
> and
> warn otherwise before overwriting potentially valuable data. Looking
> at the first MB should cover enough partition table and file system
> structures to detect a valid disk.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> .../deploy-image/files/deploy-image-wic.sh | 6
> ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-
> image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-
> image-wic.sh
> index 09d6cc11..81a006ce 100644
> --- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-
> wic.sh
> +++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-
> wic.sh
> @@ -96,6 +96,12 @@ if ! dialog --yes-label Ok --no-label Cancel \
> exit 0
> fi
>
> +if ! cmp /dev/zero "$TARGET_DEVICE" -n 1M && \
> + ! dialog --defaultno \
> + --yesno "WARNING: Target device is not empty! Continue
Ok, but I'm sure this will almost always fire.
Even fresh devices are not necessarily zeroed.
Felix
> anyway?" 5 60; then
> + exit 0
> +fi
> +
> bmap_options=""
> if [ -z "$DISK_BMAP" ]; then
> bmap_options="--nobmap"
> --
> 2.43.0
>
--
Siemens AG, Technology
Linux Expert Center
--
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 on the web visit https://groups.google.com/d/msgid/isar-users/18a05844c67acbd77941605336ce6e3a1a9f5326.camel%40siemens.com.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 10/17] meta-isar: deploy-image: Warn if overwriting a non-empty disk
2024-07-03 15:53 ` 'MOESSBAUER, Felix' via isar-users
@ 2024-07-03 15:55 ` 'Jan Kiszka' via isar-users
2024-07-19 5:33 ` Uladzimir Bely
0 siblings, 1 reply; 30+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2024-07-03 15:55 UTC (permalink / raw)
To: Moessbauer, Felix (T CED OES-DE), isar-users
Cc: Gylstorff, Quirin (T CED OES-DE)
On 03.07.24 17:53, Moessbauer, Felix (T CED OES-DE) wrote:
> On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> Check of the first MB of the target device is only containing zero
> -------^ typo: if
>
>> and
>> warn otherwise before overwriting potentially valuable data. Looking
>> at the first MB should cover enough partition table and file system
>> structures to detect a valid disk.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>> .../deploy-image/files/deploy-image-wic.sh | 6
>> ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-
>> image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-
>> image-wic.sh
>> index 09d6cc11..81a006ce 100644
>> --- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-
>> wic.sh
>> +++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-
>> wic.sh
>> @@ -96,6 +96,12 @@ if ! dialog --yes-label Ok --no-label Cancel \
>> exit 0
>> fi
>>
>> +if ! cmp /dev/zero "$TARGET_DEVICE" -n 1M && \
>> + ! dialog --defaultno \
>> + --yesno "WARNING: Target device is not empty! Continue
>
> Ok, but I'm sure this will almost always fire.
> Even fresh devices are not necessarily zeroed.
Flash drives are generally by design. But if you have a concrete
proposal how to improve the heuristics, I'm all ears.
Jan
--
Siemens AG, Technology
Linux Expert Center
--
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 on the web visit https://groups.google.com/d/msgid/isar-users/c3454520-1334-450f-a6f8-c1d7d8c5de5b%40siemens.com.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 16/17] meta-isar: deploy-image: Introduce auto-installation mode
2024-07-02 13:38 ` [PATCH 16/17] meta-isar: deploy-image: Introduce " Jan Kiszka
@ 2024-07-03 15:56 ` 'MOESSBAUER, Felix' via isar-users
2024-07-03 16:08 ` 'Jan Kiszka' via isar-users
0 siblings, 1 reply; 30+ messages in thread
From: 'MOESSBAUER, Felix' via isar-users @ 2024-07-03 15:56 UTC (permalink / raw)
To: isar-users, Kiszka, Jan; +Cc: quirin.gylstorff
On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> If a special file called auto.install is found in the installation
> data
> directory, parse this and attempt an unattended installation. The
> file
> consists of 2 to 3 lines:
>
> - source file name
> - target device path
> - optionally, "OVERWRITE" to ignore if the target device is non-empty
Ehm... did you forget to include a documentation update for this?
Felix
>
> e.g.:
> $ cat /install/auto.install
> isar-image-base-debian-bookworm-qemuamd64.wic.zst
> /dev/vda
> OVERWRITE
>
> Errors are still stopping the process, switching it back to
> interactive
> mode.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> .../deploy-image/files/deploy-image-wic.sh | 16
> ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-
> image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-
> image-wic.sh
> index 9df93fe7..8b25b1d2 100644
> --- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-
> wic.sh
> +++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-
> wic.sh
> @@ -7,8 +7,20 @@
> installdata=${INSTALL_DATA:-/install}
>
> AUTO_INSTALL=false
> +OVERWRITE=
>
> -if ! $AUTO_INSTALL; then
> +if [ -f "$installdata/auto.install" ]; then
> + exec 3<"$installdata/auto.install"
> + read -r DISK_IMAGE <&3
> + read -r TARGET_DEVICE <&3
> + read -r OVERWRITE <&3
> + exec 3>&-
> + if [ ! -b ${TARGET_DEVICE} ]; then
> + dialog --msgbox "Target device is not a valid block device.
> Installation aborted." 6 60
> + exit 1
> + fi
> + AUTO_INSTALL=true
> +else
> DISK_IMAGE=$(find "$installdata" -type f -iname "*.wic*" -a -not
> -iname "*.wic.bmap" -exec basename {} \;)
> if [ -z "$DISK_IMAGE" ] || [ ! -f "$installdata/$DISK_IMAGE" ];
> then
> pushd "$installdata"
> @@ -110,7 +122,7 @@ if ! $AUTO_INSTALL; then
> fi
> fi
>
> -if ! cmp /dev/zero "$TARGET_DEVICE" -n 1M && \
> +if [ "$OVERWRITE" != "OVERWRITE" ] && ! cmp /dev/zero
> "$TARGET_DEVICE" -n 1M && \
> ! dialog --defaultno \
> --yesno "WARNING: Target device is not empty! Continue
> anyway?" 5 60; then
> exit 0
> --
> 2.43.0
>
--
Siemens AG, Technology
Linux Expert Center
--
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 on the web visit https://groups.google.com/d/msgid/isar-users/89d285bb77e470433e35f98867f4253fd7892025.camel%40siemens.com.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 16/17] meta-isar: deploy-image: Introduce auto-installation mode
2024-07-03 15:56 ` 'MOESSBAUER, Felix' via isar-users
@ 2024-07-03 16:08 ` 'Jan Kiszka' via isar-users
0 siblings, 0 replies; 30+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2024-07-03 16:08 UTC (permalink / raw)
To: Moessbauer, Felix (T CED OES-DE), isar-users
Cc: Gylstorff, Quirin (T CED OES-DE)
On 03.07.24 17:56, Moessbauer, Felix (T CED OES-DE) wrote:
> On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> If a special file called auto.install is found in the installation
>> data
>> directory, parse this and attempt an unattended installation. The
>> file
>> consists of 2 to 3 lines:
>>
>> - source file name
>> - target device path
>> - optionally, "OVERWRITE" to ignore if the target device is non-empty
>
> Ehm... did you forget to include a documentation update for this?
>
Not forgotten - not yet done. At some point I first wanted to send out
the longer and longer queue.
Jan
> Felix
>
>>
>> e.g.:
>> $ cat /install/auto.install
>> isar-image-base-debian-bookworm-qemuamd64.wic.zst
>> /dev/vda
>> OVERWRITE
>>
>> Errors are still stopping the process, switching it back to
>> interactive
>> mode.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>> .../deploy-image/files/deploy-image-wic.sh | 16
>> ++++++++++++++--
>> 1 file changed, 14 insertions(+), 2 deletions(-)
>>
>> diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-
>> image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-
>> image-wic.sh
>> index 9df93fe7..8b25b1d2 100644
>> --- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-
>> wic.sh
>> +++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-
>> wic.sh
>> @@ -7,8 +7,20 @@
>> installdata=${INSTALL_DATA:-/install}
>>
>> AUTO_INSTALL=false
>> +OVERWRITE=
>>
>> -if ! $AUTO_INSTALL; then
>> +if [ -f "$installdata/auto.install" ]; then
>> + exec 3<"$installdata/auto.install"
>> + read -r DISK_IMAGE <&3
>> + read -r TARGET_DEVICE <&3
>> + read -r OVERWRITE <&3
>> + exec 3>&-
>> + if [ ! -b ${TARGET_DEVICE} ]; then
>> + dialog --msgbox "Target device is not a valid block device.
>> Installation aborted." 6 60
>> + exit 1
>> + fi
>> + AUTO_INSTALL=true
>> +else
>> DISK_IMAGE=$(find "$installdata" -type f -iname "*.wic*" -a -not
>> -iname "*.wic.bmap" -exec basename {} \;)
>> if [ -z "$DISK_IMAGE" ] || [ ! -f "$installdata/$DISK_IMAGE" ];
>> then
>> pushd "$installdata"
>> @@ -110,7 +122,7 @@ if ! $AUTO_INSTALL; then
>> fi
>> fi
>>
>> -if ! cmp /dev/zero "$TARGET_DEVICE" -n 1M && \
>> +if [ "$OVERWRITE" != "OVERWRITE" ] && ! cmp /dev/zero
>> "$TARGET_DEVICE" -n 1M && \
>> ! dialog --defaultno \
>> --yesno "WARNING: Target device is not empty! Continue
>> anyway?" 5 60; then
>> exit 0
>> --
>> 2.43.0
>>
>
--
Siemens AG, Technology
Linux Expert Center
--
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 on the web visit https://groups.google.com/d/msgid/isar-users/e68cfa04-eb66-422b-b6a1-61cb2624048b%40siemens.com.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 10/17] meta-isar: deploy-image: Warn if overwriting a non-empty disk
2024-07-03 15:55 ` 'Jan Kiszka' via isar-users
@ 2024-07-19 5:33 ` Uladzimir Bely
2024-07-19 5:44 ` 'Jan Kiszka' via isar-users
0 siblings, 1 reply; 30+ messages in thread
From: Uladzimir Bely @ 2024-07-19 5:33 UTC (permalink / raw)
To: Jan Kiszka, Moessbauer, Felix (T CED OES-DE), isar-users
Cc: Gylstorff, Quirin (T CED OES-DE)
On Wed, 2024-07-03 at 17:55 +0200, 'Jan Kiszka' via isar-users wrote:
> On 03.07.24 17:53, Moessbauer, Felix (T CED OES-DE) wrote:
> > On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users
> > wrote:
> > > From: Jan Kiszka <jan.kiszka@siemens.com>
> > >
> > > Check of the first MB of the target device is only containing
> > > zero
> > -------^ typo: if
> >
> > > and
> > > warn otherwise before overwriting potentially valuable data.
> > > Looking
> > > at the first MB should cover enough partition table and file
> > > system
> > > structures to detect a valid disk.
> > >
> > > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> > > ---
> > > .../deploy-image/files/deploy-image-wic.sh | 6
> > > ++++++
> > > 1 file changed, 6 insertions(+)
> > >
> > > diff --git a/meta-isar/recipes-installer/deploy-
> > > image/files/deploy-
> > > image-wic.sh b/meta-isar/recipes-installer/deploy-
> > > image/files/deploy-
> > > image-wic.sh
> > > index 09d6cc11..81a006ce 100644
> > > --- a/meta-isar/recipes-installer/deploy-image/files/deploy-
> > > image-
> > > wic.sh
> > > +++ b/meta-isar/recipes-installer/deploy-image/files/deploy-
> > > image-
> > > wic.sh
> > > @@ -96,6 +96,12 @@ if ! dialog --yes-label Ok --no-label Cancel \
> > > exit 0
> > > fi
> > >
> > > +if ! cmp /dev/zero "$TARGET_DEVICE" -n 1M && \
> > > + ! dialog --defaultno \
> > > + --yesno "WARNING: Target device is not empty!
> > > Continue
> >
> > Ok, but I'm sure this will almost always fire.
> > Even fresh devices are not necessarily zeroed.
>
> Flash drives are generally by design. But if you have a concrete
> proposal how to improve the heuristics, I'm all ears.
>
> Jan
>
What about simply checking the device for partitions?
`lsblk -n "$TARGET_DEVICE" -o TYPE | grep part >/dev/null`
This should fit our needs.
> --
> Siemens AG, Technology
> Linux Expert Center
>
--
Best regards,
Uladzimir.
--
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 on the web visit https://groups.google.com/d/msgid/isar-users/8ee5a7a2efc86e7b733c52fb28ccc3586ebf0132.camel%40ilbers.de.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 10/17] meta-isar: deploy-image: Warn if overwriting a non-empty disk
2024-07-19 5:33 ` Uladzimir Bely
@ 2024-07-19 5:44 ` 'Jan Kiszka' via isar-users
0 siblings, 0 replies; 30+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2024-07-19 5:44 UTC (permalink / raw)
To: Uladzimir Bely, Moessbauer, Felix (T CED OES-DE), isar-users
Cc: Gylstorff, Quirin (T CED OES-DE)
On 19.07.24 07:33, Uladzimir Bely wrote:
> On Wed, 2024-07-03 at 17:55 +0200, 'Jan Kiszka' via isar-users wrote:
>> On 03.07.24 17:53, Moessbauer, Felix (T CED OES-DE) wrote:
>>> On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users
>>> wrote:
>>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>>
>>>> Check of the first MB of the target device is only containing
>>>> zero
>>> -------^ typo: if
>>>
>>>> and
>>>> warn otherwise before overwriting potentially valuable data.
>>>> Looking
>>>> at the first MB should cover enough partition table and file
>>>> system
>>>> structures to detect a valid disk.
>>>>
>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>> ---
>>>> .../deploy-image/files/deploy-image-wic.sh | 6
>>>> ++++++
>>>> 1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/meta-isar/recipes-installer/deploy-
>>>> image/files/deploy-
>>>> image-wic.sh b/meta-isar/recipes-installer/deploy-
>>>> image/files/deploy-
>>>> image-wic.sh
>>>> index 09d6cc11..81a006ce 100644
>>>> --- a/meta-isar/recipes-installer/deploy-image/files/deploy-
>>>> image-
>>>> wic.sh
>>>> +++ b/meta-isar/recipes-installer/deploy-image/files/deploy-
>>>> image-
>>>> wic.sh
>>>> @@ -96,6 +96,12 @@ if ! dialog --yes-label Ok --no-label Cancel \
>>>> exit 0
>>>> fi
>>>>
>>>> +if ! cmp /dev/zero "$TARGET_DEVICE" -n 1M && \
>>>> + ! dialog --defaultno \
>>>> + --yesno "WARNING: Target device is not empty!
>>>> Continue
>>>
>>> Ok, but I'm sure this will almost always fire.
>>> Even fresh devices are not necessarily zeroed.
>>
>> Flash drives are generally by design. But if you have a concrete
>> proposal how to improve the heuristics, I'm all ears.
>>
>> Jan
>>
>
> What about simply checking the device for partitions?
>
> `lsblk -n "$TARGET_DEVICE" -o TYPE | grep part >/dev/null`
>
> This should fit our needs.
Could still select an unpartitioned device with a valid filesystem.
Jan
--
Siemens AG, Technology
Linux Expert Center
--
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 on the web visit https://groups.google.com/d/msgid/isar-users/1afe40ab-4028-426b-8494-03c8302ecd3f%40siemens.com.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 00/17] Reworks, fixes and unattended mode for image installer
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
` (16 preceding siblings ...)
2024-07-02 13:38 ` [PATCH 17/17] meta-isar: deploy-image: Polish recipe Jan Kiszka
@ 2024-07-23 7:40 ` Uladzimir Bely
17 siblings, 0 replies; 30+ messages in thread
From: Uladzimir Bely @ 2024-07-23 7:40 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users wrote:
> Address several issues of the image installer, specifically the
> script.
> It also brings some simplistic way to make the installer operate
> without
> user interaction.
>
> What is still missing, though, is documentation of how to integrate
> all
> that in own projects. Also, I would like to make hooking into the
> script
> possible so that certain interactions with the user can be customized
> without having to fork the recipe. Still needs to be designed, and
> would
> have only made this queue even longer.
>
> Jan
>
> Jan Kiszka (17):
> Kconfig: Rework installer image submenu
> installer: Do not show systemd boot menu
> meta-isar: deploy-image: Change reboot logic
> meta-isar: deploy-image: Drop umount attempt after installation
> meta-isar: deploy-image: Fix bmap support
> meta-isar: deploy-image: Improve root mountpoint discovery
> meta-isar: deploy-image: Make TARGET_DEVICE a complete path
> meta-isar: deploy-image: Drop pointless --clear options from dialog
> meta-isar: deploy-image: Allow to cancel installation
> meta-isar: deploy-image: Warn if overwriting a non-empty disk
> meta-isar: deploy-image: Fix and enhance image selection dialog
> meta-isar: deploy-image: Improve target device list dialog
> meta-isar: deploy-image: Polish some dialogs
> meta-isar: deploy-image: Re-indent
> meta-isar: deploy-image: Prepare for auto-installation mode
> meta-isar: deploy-image: Introduce auto-installation mode
> meta-isar: deploy-image: Polish recipe
>
> kas/image/Kconfig | 43 +++-
> .../deploy-image/deploy-image_0.1.bb | 9 +-
> .../deploy-image/files/deploy-image-wic.sh | 188 +++++++++++-----
> --
> .../deploy-image/files/install.override.conf | 2 +-
> .../lib/wic/canned-wks/installer-efi.wks.in | 2 +-
> 5 files changed, 150 insertions(+), 94 deletions(-)
>
> --
> 2.43.0
>
Applied to next, thanks.
--
Best regards,
Uladzimir.
--
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 on the web visit https://groups.google.com/d/msgid/isar-users/bc7d3e04d238eb6817c9262d4ff12db93db25cdb.camel%40ilbers.de.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 03/17] meta-isar: deploy-image: Change reboot logic
2024-07-02 13:38 ` [PATCH 03/17] meta-isar: deploy-image: Change reboot logic Jan Kiszka
@ 2025-03-13 13:10 ` Uladzimir Bely
2025-03-14 5:54 ` 'Jan Kiszka' via isar-users
0 siblings, 1 reply; 30+ messages in thread
From: Uladzimir Bely @ 2025-03-13 13:10 UTC (permalink / raw)
To: Jan Kiszka, isar-users; +Cc: Quirin Gylstorff, Shekar Kasturi
On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> Pull the reboot out of the script. This allows for cleaner
> integration
> with different calling environment, may they be a systemd unit, an
> initramfs script or simply a shell for testing purposes.
>
> And if the script exits with an error, wait a minute before rebooting
> the system, rather than just trying to re-execute it. This permits to
> inspect potential error as well.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> .../recipes-installer/deploy-image/files/deploy-image-wic.sh | 2
> +-
> .../recipes-installer/deploy-image/files/install.override.conf | 2
> +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-
> image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-
> image-wic.sh
> index 8043aff1..12c1eea2 100644
> --- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-
> wic.sh
> +++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-
> wic.sh
> @@ -105,4 +105,4 @@ fi
> umount "$installdata"
> sync
> dialog --title "Reboot" --msgbox "Installation is successful. System
> will be rebooted. Please remove the USB stick." 7 60
> -reboot
> +exit 0
> diff --git a/meta-isar/recipes-installer/deploy-
> image/files/install.override.conf b/meta-isar/recipes-
> installer/deploy-image/files/install.override.conf
> index 73874caa..357d8662 100644
> --- a/meta-isar/recipes-installer/deploy-
> image/files/install.override.conf
> +++ b/meta-isar/recipes-installer/deploy-
> image/files/install.override.conf
> @@ -1,5 +1,5 @@
> [Service]
> ExecStart=
> -ExecStart=/usr/bin/deploy-image-wic.sh
> +ExecStart=/bin/sh -c "deploy-image-wic.sh || (echo 'Rebooting in 60
> s'; sleep 60); reboot"
Hello Jan.
This change seems to cause a sort of race issue.
Few days ago "[PATCH v3 0/2] Cover installer image with tests" was
merged. Tests were OK (and "next" is still OK) on two jenkins and one
gitlab instances. But on the third jenkins instance, they were failing.
Boot log:
```
Got config:
installer_unattended=true
installer_image_uri=/install/isar-image-ci-debian-bookworm-
qemuamd64.wic.zst
installer_target_dev=/dev/sda
installer_target_overwrite=OVERWRITE
bmaptool: ERROR: An error occurred, here is the traceback:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/bmaptools/CLI.py", line 116, in
open_block_device
descriptor = os.open(path, os.O_WRONLY | os.O_EXCL)
bmaptool: ERROR: cannot open block device '/dev/sda' in exclusive mode:
[Errno 16] Device or resource busy: '/dev/sda'
Rebooting in 60 s
```
But either machine is not booted, or there are some "ext4" errors
happen.
I couldn't understand few things:
- why this happens (unable to get exclusive access to block device)$
- why device is written even if there is such error in logs$
- why sometimes we don't see this error in logs$
- why this doesn't happen when "unattended mode" is off.
The reason is that we have these two "getty" instances overriden by
custom one having the race. While "serial-getty@ttyS0.service.d" does
the job, "getty@tty1.service.d" produces this error visible in logs and
reboot machine in 60 seconds.
In some cases 60sec is enough for first service to finish writing to
the disc, but on slower machines we result in incomplete copy and
broken system.
Before this patch, when "reboot" calls were in the script, "failed"
instance simply exited and didn't try to reboot the board.
As a quick fix, I would reverted this patch.
Also, I think this behaviour may impact on bmap-tools "psplash" patches
currently we have on maillist. I would expect that user won't see the
progress bar on screen because it's somewhere on serial console.
> StandardInput=tty
> StandardOutput=tty
> --
> 2.43.0
>
--
Best regards,
Uladzimir.
--
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/3fd6bdc491628229686855d3278b8d5684643108.camel%40ilbers.de.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 03/17] meta-isar: deploy-image: Change reboot logic
2025-03-13 13:10 ` Uladzimir Bely
@ 2025-03-14 5:54 ` 'Jan Kiszka' via isar-users
2025-03-14 6:25 ` Uladzimir Bely
0 siblings, 1 reply; 30+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-03-14 5:54 UTC (permalink / raw)
To: Uladzimir Bely, isar-users; +Cc: Quirin Gylstorff, Shekar Kasturi
On 13.03.25 14:10, Uladzimir Bely wrote:
> On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> Pull the reboot out of the script. This allows for cleaner
>> integration
>> with different calling environment, may they be a systemd unit, an
>> initramfs script or simply a shell for testing purposes.
>>
>> And if the script exits with an error, wait a minute before rebooting
>> the system, rather than just trying to re-execute it. This permits to
>> inspect potential error as well.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>> .../recipes-installer/deploy-image/files/deploy-image-wic.sh | 2
>> +-
>> .../recipes-installer/deploy-image/files/install.override.conf | 2
>> +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-
>> image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-
>> image-wic.sh
>> index 8043aff1..12c1eea2 100644
>> --- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-
>> wic.sh
>> +++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-
>> wic.sh
>> @@ -105,4 +105,4 @@ fi
>> umount "$installdata"
>> sync
>> dialog --title "Reboot" --msgbox "Installation is successful. System
>> will be rebooted. Please remove the USB stick." 7 60
>> -reboot
>> +exit 0
>> diff --git a/meta-isar/recipes-installer/deploy-
>> image/files/install.override.conf b/meta-isar/recipes-
>> installer/deploy-image/files/install.override.conf
>> index 73874caa..357d8662 100644
>> --- a/meta-isar/recipes-installer/deploy-
>> image/files/install.override.conf
>> +++ b/meta-isar/recipes-installer/deploy-
>> image/files/install.override.conf
>> @@ -1,5 +1,5 @@
>> [Service]
>> ExecStart=
>> -ExecStart=/usr/bin/deploy-image-wic.sh
>> +ExecStart=/bin/sh -c "deploy-image-wic.sh || (echo 'Rebooting in 60
>> s'; sleep 60); reboot"
>
> Hello Jan.
>
> This change seems to cause a sort of race issue.
>
> Few days ago "[PATCH v3 0/2] Cover installer image with tests" was
> merged. Tests were OK (and "next" is still OK) on two jenkins and one
> gitlab instances. But on the third jenkins instance, they were failing.
>
> Boot log:
>
> ```
> Got config:
> installer_unattended=true
> installer_image_uri=/install/isar-image-ci-debian-bookworm-
> qemuamd64.wic.zst
> installer_target_dev=/dev/sda
> installer_target_overwrite=OVERWRITE
> bmaptool: ERROR: An error occurred, here is the traceback:
> Traceback (most recent call last):
> File "/usr/lib/python3/dist-packages/bmaptools/CLI.py", line 116, in
> open_block_device
> descriptor = os.open(path, os.O_WRONLY | os.O_EXCL)
>
> bmaptool: ERROR: cannot open block device '/dev/sda' in exclusive mode:
> [Errno 16] Device or resource busy: '/dev/sda'
>
> Rebooting in 60 s
> ```
>
> But either machine is not booted, or there are some "ext4" errors
> happen.
>
> I couldn't understand few things:
> - why this happens (unable to get exclusive access to block device)$
> - why device is written even if there is such error in logs$
> - why sometimes we don't see this error in logs$
> - why this doesn't happen when "unattended mode" is off.
>
> The reason is that we have these two "getty" instances overriden by
> custom one having the race. While "serial-getty@ttyS0.service.d" does
> the job, "getty@tty1.service.d" produces this error visible in logs and
> reboot machine in 60 seconds.
>
> In some cases 60sec is enough for first service to finish writing to
> the disc, but on slower machines we result in incomplete copy and
> broken system.
>
> Before this patch, when "reboot" calls were in the script, "failed"
> instance simply exited and didn't try to reboot the board.
>
> As a quick fix, I would reverted this patch.
That won't be a fix, just papering over.
The race is apparently around the target device becoming ready for
bmaptool, or our script racing with some other service accessing the
device for a while. I suspect the service is lacking some dependency
here. So, let's identify the race partner first: How to reproduce locally?
Jan
>
> Also, I think this behaviour may impact on bmap-tools "psplash" patches
> currently we have on maillist. I would expect that user won't see the
> progress bar on screen because it's somewhere on serial console.
>
>
>> StandardInput=tty
>> StandardOutput=tty
>> --
>> 2.43.0
>>
>
--
Siemens AG, Foundational Technologies
Linux Expert Center
--
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/fc56d0d1-359e-43d9-ab37-897c78e5916e%40siemens.com.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 03/17] meta-isar: deploy-image: Change reboot logic
2025-03-14 5:54 ` 'Jan Kiszka' via isar-users
@ 2025-03-14 6:25 ` Uladzimir Bely
2025-03-14 14:25 ` 'Heinisch, Alexander' via isar-users
0 siblings, 1 reply; 30+ messages in thread
From: Uladzimir Bely @ 2025-03-14 6:25 UTC (permalink / raw)
To: Jan Kiszka, isar-users; +Cc: Quirin Gylstorff, Shekar Kasturi
On Fri, 2025-03-14 at 06:54 +0100, Jan Kiszka wrote:
> On 13.03.25 14:10, Uladzimir Bely wrote:
> > On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users
> > wrote:
> > > From: Jan Kiszka <jan.kiszka@siemens.com>
> > >
> > > Pull the reboot out of the script. This allows for cleaner
> > > integration
> > > with different calling environment, may they be a systemd unit,
> > > an
> > > initramfs script or simply a shell for testing purposes.
> > >
> > > And if the script exits with an error, wait a minute before
> > > rebooting
> > > the system, rather than just trying to re-execute it. This
> > > permits to
> > > inspect potential error as well.
> > >
> > > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> > > ---
> > > .../recipes-installer/deploy-image/files/deploy-image-wic.sh
> > > | 2
> > > +-
> > > .../recipes-installer/deploy-image/files/install.override.conf
> > > | 2
> > > +-
> > > 2 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/meta-isar/recipes-installer/deploy-
> > > image/files/deploy-
> > > image-wic.sh b/meta-isar/recipes-installer/deploy-
> > > image/files/deploy-
> > > image-wic.sh
> > > index 8043aff1..12c1eea2 100644
> > > --- a/meta-isar/recipes-installer/deploy-image/files/deploy-
> > > image-
> > > wic.sh
> > > +++ b/meta-isar/recipes-installer/deploy-image/files/deploy-
> > > image-
> > > wic.sh
> > > @@ -105,4 +105,4 @@ fi
> > > umount "$installdata"
> > > sync
> > > dialog --title "Reboot" --msgbox "Installation is successful.
> > > System
> > > will be rebooted. Please remove the USB stick." 7 60
> > > -reboot
> > > +exit 0
> > > diff --git a/meta-isar/recipes-installer/deploy-
> > > image/files/install.override.conf b/meta-isar/recipes-
> > > installer/deploy-image/files/install.override.conf
> > > index 73874caa..357d8662 100644
> > > --- a/meta-isar/recipes-installer/deploy-
> > > image/files/install.override.conf
> > > +++ b/meta-isar/recipes-installer/deploy-
> > > image/files/install.override.conf
> > > @@ -1,5 +1,5 @@
> > > [Service]
> > > ExecStart=
> > > -ExecStart=/usr/bin/deploy-image-wic.sh
> > > +ExecStart=/bin/sh -c "deploy-image-wic.sh || (echo 'Rebooting in
> > > 60
> > > s'; sleep 60); reboot"
> >
> > Hello Jan.
> >
> > This change seems to cause a sort of race issue.
> >
> > Few days ago "[PATCH v3 0/2] Cover installer image with tests" was
> > merged. Tests were OK (and "next" is still OK) on two jenkins and
> > one
> > gitlab instances. But on the third jenkins instance, they were
> > failing.
> >
> > Boot log:
> >
> > ```
> > Got config:
> > installer_unattended=true
> > installer_image_uri=/install/isar-image-ci-debian-bookworm-
> > qemuamd64.wic.zst
> > installer_target_dev=/dev/sda
> > installer_target_overwrite=OVERWRITE
> > bmaptool: ERROR: An error occurred, here is the traceback:
> > Traceback (most recent call last):
> > File "/usr/lib/python3/dist-packages/bmaptools/CLI.py", line 116,
> > in
> > open_block_device
> > descriptor = os.open(path, os.O_WRONLY | os.O_EXCL)
> >
> > bmaptool: ERROR: cannot open block device '/dev/sda' in exclusive
> > mode:
> > [Errno 16] Device or resource busy: '/dev/sda'
> >
> > Rebooting in 60 s
> > ```
> >
> > But either machine is not booted, or there are some "ext4" errors
> > happen.
> >
> > I couldn't understand few things:
> > - why this happens (unable to get exclusive access to block
> > device)$
> > - why device is written even if there is such error in logs$
> > - why sometimes we don't see this error in logs$
> > - why this doesn't happen when "unattended mode" is off.
> >
> > The reason is that we have these two "getty" instances overriden by
> > custom one having the race. While "serial-getty@ttyS0.service.d"
> > does
> > the job, "getty@tty1.service.d" produces this error visible in logs
> > and
> > reboot machine in 60 seconds.
> >
> > In some cases 60sec is enough for first service to finish writing
> > to
> > the disc, but on slower machines we result in incomplete copy and
> > broken system.
> >
> > Before this patch, when "reboot" calls were in the script, "failed"
> > instance simply exited and didn't try to reboot the board.
> >
> > As a quick fix, I would reverted this patch.
>
> That won't be a fix, just papering over.
>
> The race is apparently around the target device becoming ready for
> bmaptool, or our script racing with some other service accessing the
> device for a while. I suspect the service is lacking some dependency
> here. So, let's identify the race partner first: How to reproduce
> locally?
>
> Jan
>
No, my finding is that getty@tty1.service.d conflicts with
serial-getty@ttyS0.service.d one. Every of them tries to run bmaptool
when unattended mode is active.
meta-isar/recipes-installer/deploy-image-service/deploy-image-
service.bb:
```
do_install() {
install -m 0600 ${WORKDIR}/install.override.conf
${D}/usr/lib/systemd/system/getty@tty1.service.d/override.conf
install -m 0600 ${WORKDIR}/install.override.conf
${D}/usr/lib/systemd/system/serial-getty@ttyS0.service.d/override.conf
}
```
It can be easy reproduced if we decrease timeout from 60s to e.g. 10s,
to simulate slower system:
```
isar $ sed -i -e 's/60/10/g' meta-isar/recipes-installer/deploy-image-
service/files/install.override.conf
isar $ ./kas/kas-container shell kas/isar.yaml
builder@b21a175d3b78:/build$ rm -rf conf/
builder@b21a175d3b78:/build$ /repo/scripts/ci_build.sh -T installer
```
Failed instance of overriden getty reboots the system while the target
is being populated with the not failed instance.
Reboot hangs at something like
```
[ 9.323801] JBD2: no valid journal superblock found
[ 9.325117] EXT4-fs (sda2): error loading journal
```
> >
> > Also, I think this behaviour may impact on bmap-tools "psplash"
> > patches
> > currently we have on maillist. I would expect that user won't see
> > the
> > progress bar on screen because it's somewhere on serial console.
> >
> >
> > > StandardInput=tty
> > > StandardOutput=tty
> > > --
> > > 2.43.0
> > >
> >
>
--
Best regards,
Uladzimir.
--
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/f56884186356c514f66cbea793b521640be7ee1a.camel%40ilbers.de.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 03/17] meta-isar: deploy-image: Change reboot logic
2025-03-14 6:25 ` Uladzimir Bely
@ 2025-03-14 14:25 ` 'Heinisch, Alexander' via isar-users
2025-03-14 15:04 ` Uladzimir Bely
0 siblings, 1 reply; 30+ messages in thread
From: 'Heinisch, Alexander' via isar-users @ 2025-03-14 14:25 UTC (permalink / raw)
To: ubely, isar-users, Kiszka, Jan; +Cc: quirin.gylstorff, Shekar, Kasturi
On Fri, 2025-03-14 at 09:25 +0300, Uladzimir Bely wrote:
> On Fri, 2025-03-14 at 06:54 +0100, Jan Kiszka wrote:
> > On 13.03.25 14:10, Uladzimir Bely wrote:
> > > On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users
> > > wrote:
> > > > From: Jan Kiszka <jan.kiszka@siemens.com>
> > > >
> > > > Pull the reboot out of the script. This allows for cleaner
> > > > integration
> > > > with different calling environment, may they be a systemd unit,
> > > > an
> > > > initramfs script or simply a shell for testing purposes.
> > > >
> > > > And if the script exits with an error, wait a minute before
> > > > rebooting
> > > > the system, rather than just trying to re-execute it. This
> > > > permits to
> > > > inspect potential error as well.
> > > >
> > > > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> > > > ---
> > > > .../recipes-installer/deploy-image/files/deploy-image-
> > > > wic.sh
> > > > > 2
> > > > +-
> > > > .../recipes-installer/deploy-
> > > > image/files/install.override.conf
> > > > > 2
> > > > +-
> > > > 2 files changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/meta-isar/recipes-installer/deploy-
> > > > image/files/deploy-
> > > > image-wic.sh b/meta-isar/recipes-installer/deploy-
> > > > image/files/deploy-
> > > > image-wic.sh
> > > > index 8043aff1..12c1eea2 100644
> > > > --- a/meta-isar/recipes-installer/deploy-image/files/deploy-
> > > > image-
> > > > wic.sh
> > > > +++ b/meta-isar/recipes-installer/deploy-image/files/deploy-
> > > > image-
> > > > wic.sh
> > > > @@ -105,4 +105,4 @@ fi
> > > > umount "$installdata"
> > > > sync
> > > > dialog --title "Reboot" --msgbox "Installation is successful.
> > > > System
> > > > will be rebooted. Please remove the USB stick." 7 60
> > > > -reboot
> > > > +exit 0
> > > > diff --git a/meta-isar/recipes-installer/deploy-
> > > > image/files/install.override.conf b/meta-isar/recipes-
> > > > installer/deploy-image/files/install.override.conf
> > > > index 73874caa..357d8662 100644
> > > > --- a/meta-isar/recipes-installer/deploy-
> > > > image/files/install.override.conf
> > > > +++ b/meta-isar/recipes-installer/deploy-
> > > > image/files/install.override.conf
> > > > @@ -1,5 +1,5 @@
> > > > [Service]
> > > > ExecStart=
> > > > -ExecStart=/usr/bin/deploy-image-wic.sh
> > > > +ExecStart=/bin/sh -c "deploy-image-wic.sh || (echo 'Rebooting
> > > > in
> > > > 60
> > > > s'; sleep 60); reboot"
> > >
> > > Hello Jan.
> > >
> > > This change seems to cause a sort of race issue.
> > >
> > > Few days ago "[PATCH v3 0/2] Cover installer image with tests"
> > > was
> > > merged. Tests were OK (and "next" is still OK) on two jenkins and
> > > one
> > > gitlab instances. But on the third jenkins instance, they were
> > > failing.
> > >
> > > Boot log:
> > >
> > > ```
> > > Got config:
> > > installer_unattended=true
> > > installer_image_uri=/install/isar-image-ci-debian-bookworm-
> > > qemuamd64.wic.zst
> > > installer_target_dev=/dev/sda
> > > installer_target_overwrite=OVERWRITE
> > > bmaptool: ERROR: An error occurred, here is the traceback:
> > > Traceback (most recent call last):
> > > File "/usr/lib/python3/dist-packages/bmaptools/CLI.py", line
> > > 116,
> > > in
> > > open_block_device
> > > descriptor = os.open(path, os.O_WRONLY | os.O_EXCL)
> > >
> > > bmaptool: ERROR: cannot open block device '/dev/sda' in exclusive
> > > mode:
> > > [Errno 16] Device or resource busy: '/dev/sda'
> > >
> > > Rebooting in 60 s
> > > ```
> > >
> > > But either machine is not booted, or there are some "ext4" errors
> > > happen.
> > >
> > > I couldn't understand few things:
> > > - why this happens (unable to get exclusive access to block
> > > device)$
> > > - why device is written even if there is such error in logs$
> > > - why sometimes we don't see this error in logs$
> > > - why this doesn't happen when "unattended mode" is off.
It does not happen when "unattended mode" is off, because the race is
interrupted by the script waiting for user input at the very beginning.
This is a race condition between multiple instances of the install
script executed in parallel, dependent on how many gettys are active.
Since the number of gettys and further, which getty get's connected in
the end, via terminal, via serial, ... is kind of hard to predict, imo
the only option to resolve that race is by adding a dedicated
(singleton) service which is executed on startup.
I am currently preparing a patch set where a fix for that is included,
similar to this:
```
[Unit]
Description=Target-bootstrapper service
[Service]
User=root
ExecStart=/bin/sh -c "/usr/bin/target-bootstrapper.sh || (echo
'Rebooting in 60 s'; sleep 60); reboot"
StandardOutput=journal+console
TTYPath=/dev/console
[Install]
WantedBy=multi-user.target
``
BR Alexander
> > >
> > > The reason is that we have these two "getty" instances overriden
> > > by
> > > custom one having the race. While "serial-getty@ttyS0.service.d"
> > > does
> > > the job, "getty@tty1.service.d" produces this error visible in
> > > logs
> > > and
> > > reboot machine in 60 seconds.
> > >
> > > In some cases 60sec is enough for first service to finish writing
> > > to
> > > the disc, but on slower machines we result in incomplete copy and
> > > broken system.
> > >
> > > Before this patch, when "reboot" calls were in the script,
> > > "failed"
> > > instance simply exited and didn't try to reboot the board.
> > >
> > > As a quick fix, I would reverted this patch.
> >
> > That won't be a fix, just papering over.
> >
> > The race is apparently around the target device becoming ready for
> > bmaptool, or our script racing with some other service accessing
> > the
> > device for a while. I suspect the service is lacking some
> > dependency
> > here. So, let's identify the race partner first: How to reproduce
> > locally?
> >
> > Jan
> >
>
> No, my finding is that getty@tty1.service.d conflicts with
> serial-getty@ttyS0.service.d one. Every of them tries to run bmaptool
> when unattended mode is active.
>
> meta-isar/recipes-installer/deploy-image-service/deploy-image-
> service.bb:
>
> ```
> do_install() {
> install -m 0600 ${WORKDIR}/install.override.conf
> ${D}/usr/lib/systemd/system/getty@tty1.service.d/override.conf
> install -m 0600 ${WORKDIR}/install.override.conf
> ${D}/usr/lib/systemd/system/serial-getty@ttyS0.service.d/override.con
> f
> }
> ```
>
> It can be easy reproduced if we decrease timeout from 60s to e.g.
> 10s,
> to simulate slower system:
>
> ```
> isar $ sed -i -e 's/60/10/g' meta-isar/recipes-installer/deploy-
> image-
> service/files/install.override.conf
> isar $ ./kas/kas-container shell kas/isar.yaml
> builder@b21a175d3b78:/build$ rm -rf conf/
> builder@b21a175d3b78:/build$ /repo/scripts/ci_build.sh -T installer
> ```
>
> Failed instance of overriden getty reboots the system while the
> target
> is being populated with the not failed instance.
>
> Reboot hangs at something like
>
> ```
> [ 9.323801] JBD2: no valid journal superblock found
> [ 9.325117] EXT4-fs (sda2): error loading journal
> ```
>
>
> > >
> > > Also, I think this behaviour may impact on bmap-tools "psplash"
> > > patches
> > > currently we have on maillist. I would expect that user won't see
> > > the
> > > progress bar on screen because it's somewhere on serial console.
> > >
> > >
> > > > StandardInput=tty
> > > > StandardOutput=tty
> > > > --
> > > > 2.43.0
> > > >
> > >
> >
>
> --
> Best regards,
> Uladzimir.
>
>
>
--
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/be6af9287630689ae711b50cc247ccf1d4fcd498.camel%40siemens.com.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 03/17] meta-isar: deploy-image: Change reboot logic
2025-03-14 14:25 ` 'Heinisch, Alexander' via isar-users
@ 2025-03-14 15:04 ` Uladzimir Bely
0 siblings, 0 replies; 30+ messages in thread
From: Uladzimir Bely @ 2025-03-14 15:04 UTC (permalink / raw)
To: Heinisch, Alexander, isar-users, Kiszka, Jan
Cc: quirin.gylstorff, Shekar, Kasturi
On Fri, 2025-03-14 at 14:25 +0000, Heinisch, Alexander wrote:
> On Fri, 2025-03-14 at 09:25 +0300, Uladzimir Bely wrote:
> > On Fri, 2025-03-14 at 06:54 +0100, Jan Kiszka wrote:
> > > On 13.03.25 14:10, Uladzimir Bely wrote:
> > > > On Tue, 2024-07-02 at 15:38 +0200, 'Jan Kiszka' via isar-users
> > > > wrote:
> > > > > From: Jan Kiszka <jan.kiszka@siemens.com>
> > > > >
> > > > > Pull the reboot out of the script. This allows for cleaner
> > > > > integration
> > > > > with different calling environment, may they be a systemd
> > > > > unit,
> > > > > an
> > > > > initramfs script or simply a shell for testing purposes.
> > > > >
> > > > > And if the script exits with an error, wait a minute before
> > > > > rebooting
> > > > > the system, rather than just trying to re-execute it. This
> > > > > permits to
> > > > > inspect potential error as well.
> > > > >
> > > > > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> > > > > ---
> > > > > .../recipes-installer/deploy-image/files/deploy-image-
> > > > > wic.sh
> > > > > > 2
> > > > > +-
> > > > > .../recipes-installer/deploy-
> > > > > image/files/install.override.conf
> > > > > > 2
> > > > > +-
> > > > > 2 files changed, 2 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/meta-isar/recipes-installer/deploy-
> > > > > image/files/deploy-
> > > > > image-wic.sh b/meta-isar/recipes-installer/deploy-
> > > > > image/files/deploy-
> > > > > image-wic.sh
> > > > > index 8043aff1..12c1eea2 100644
> > > > > --- a/meta-isar/recipes-installer/deploy-image/files/deploy-
> > > > > image-
> > > > > wic.sh
> > > > > +++ b/meta-isar/recipes-installer/deploy-image/files/deploy-
> > > > > image-
> > > > > wic.sh
> > > > > @@ -105,4 +105,4 @@ fi
> > > > > umount "$installdata"
> > > > > sync
> > > > > dialog --title "Reboot" --msgbox "Installation is
> > > > > successful.
> > > > > System
> > > > > will be rebooted. Please remove the USB stick." 7 60
> > > > > -reboot
> > > > > +exit 0
> > > > > diff --git a/meta-isar/recipes-installer/deploy-
> > > > > image/files/install.override.conf b/meta-isar/recipes-
> > > > > installer/deploy-image/files/install.override.conf
> > > > > index 73874caa..357d8662 100644
> > > > > --- a/meta-isar/recipes-installer/deploy-
> > > > > image/files/install.override.conf
> > > > > +++ b/meta-isar/recipes-installer/deploy-
> > > > > image/files/install.override.conf
> > > > > @@ -1,5 +1,5 @@
> > > > > [Service]
> > > > > ExecStart=
> > > > > -ExecStart=/usr/bin/deploy-image-wic.sh
> > > > > +ExecStart=/bin/sh -c "deploy-image-wic.sh || (echo
> > > > > 'Rebooting
> > > > > in
> > > > > 60
> > > > > s'; sleep 60); reboot"
> > > >
> > > > Hello Jan.
> > > >
> > > > This change seems to cause a sort of race issue.
> > > >
> > > > Few days ago "[PATCH v3 0/2] Cover installer image with tests"
> > > > was
> > > > merged. Tests were OK (and "next" is still OK) on two jenkins
> > > > and
> > > > one
> > > > gitlab instances. But on the third jenkins instance, they were
> > > > failing.
> > > >
> > > > Boot log:
> > > >
> > > > ```
> > > > Got config:
> > > > installer_unattended=true
> > > > installer_image_uri=/install/isar-image-ci-debian-bookworm-
> > > > qemuamd64.wic.zst
> > > > installer_target_dev=/dev/sda
> > > > installer_target_overwrite=OVERWRITE
> > > > bmaptool: ERROR: An error occurred, here is the traceback:
> > > > Traceback (most recent call last):
> > > > File "/usr/lib/python3/dist-packages/bmaptools/CLI.py", line
> > > > 116,
> > > > in
> > > > open_block_device
> > > > descriptor = os.open(path, os.O_WRONLY | os.O_EXCL)
> > > >
> > > > bmaptool: ERROR: cannot open block device '/dev/sda' in
> > > > exclusive
> > > > mode:
> > > > [Errno 16] Device or resource busy: '/dev/sda'
> > > >
> > > > Rebooting in 60 s
> > > > ```
> > > >
> > > > But either machine is not booted, or there are some "ext4"
> > > > errors
> > > > happen.
> > > >
> > > > I couldn't understand few things:
> > > > - why this happens (unable to get exclusive access to block
> > > > device)$
> > > > - why device is written even if there is such error in logs$
> > > > - why sometimes we don't see this error in logs$
> > > > - why this doesn't happen when "unattended mode" is off.
>
>
> It does not happen when "unattended mode" is off, because the race is
> interrupted by the script waiting for user input at the very
> beginning.
>
> This is a race condition between multiple instances of the install
> script executed in parallel, dependent on how many gettys are active.
> Since the number of gettys and further, which getty get's connected
> in
> the end, via terminal, via serial, ... is kind of hard to predict,
> imo
> the only option to resolve that race is by adding a dedicated
> (singleton) service which is executed on startup.
>
> I am currently preparing a patch set where a fix for that is
> included,
> similar to this:
Yes, there were rhetorical questions that get ansered after later
debugging.
I wanted (but didn't have time to try) to do something like in the
script:
```
if ! $installer_unattended; then
if [ "$(tty)" != "/dev/ttyS0" ]; then
echo "Disable unattended mode on $(tty), it's active on
/dev/ttyS0"
installer_unattended=0
fi
fi
```
Futher, "/dev/ttyS0" could be not hardcoded but also passed from
installer configuration during build.
>
> ```
> [Unit]
> Description=Target-bootstrapper service
>
> [Service]
> User=root
> ExecStart=/bin/sh -c "/usr/bin/target-bootstrapper.sh || (echo
> 'Rebooting in 60 s'; sleep 60); reboot"
>
> StandardOutput=journal+console
> TTYPath=/dev/console
>
> [Install]
> WantedBy=multi-user.target
> ``
>
> BR Alexander
>
> > > >
> > > > The reason is that we have these two "getty" instances
> > > > overriden
> > > > by
> > > > custom one having the race. While
> > > > "serial-getty@ttyS0.service.d"
> > > > does
> > > > the job, "getty@tty1.service.d" produces this error visible in
> > > > logs
> > > > and
> > > > reboot machine in 60 seconds.
> > > >
> > > > In some cases 60sec is enough for first service to finish
> > > > writing
> > > > to
> > > > the disc, but on slower machines we result in incomplete copy
> > > > and
> > > > broken system.
> > > >
> > > > Before this patch, when "reboot" calls were in the script,
> > > > "failed"
> > > > instance simply exited and didn't try to reboot the board.
> > > >
> > > > As a quick fix, I would reverted this patch.
> > >
> > > That won't be a fix, just papering over.
> > >
> > > The race is apparently around the target device becoming ready
> > > for
> > > bmaptool, or our script racing with some other service accessing
> > > the
> > > device for a while. I suspect the service is lacking some
> > > dependency
> > > here. So, let's identify the race partner first: How to reproduce
> > > locally?
> > >
> > > Jan
> > >
> >
> > No, my finding is that getty@tty1.service.d conflicts with
> > serial-getty@ttyS0.service.d one. Every of them tries to run
> > bmaptool
> > when unattended mode is active.
> >
> > meta-isar/recipes-installer/deploy-image-service/deploy-image-
> > service.bb:
> >
> > ```
> > do_install() {
> > install -m 0600 ${WORKDIR}/install.override.conf
> > ${D}/usr/lib/systemd/system/getty@tty1.service.d/override.conf
> > install -m 0600 ${WORKDIR}/install.override.conf
> > ${D}/usr/lib/systemd/system/serial-getty@ttyS0.service.d/override.c
> > on
> > f
> > }
> > ```
> >
> > It can be easy reproduced if we decrease timeout from 60s to e.g.
> > 10s,
> > to simulate slower system:
> >
> > ```
> > isar $ sed -i -e 's/60/10/g' meta-isar/recipes-installer/deploy-
> > image-
> > service/files/install.override.conf
> > isar $ ./kas/kas-container shell kas/isar.yaml
> > builder@b21a175d3b78:/build$ rm -rf conf/
> > builder@b21a175d3b78:/build$ /repo/scripts/ci_build.sh -T installer
> > ```
> >
> > Failed instance of overriden getty reboots the system while the
> > target
> > is being populated with the not failed instance.
> >
> > Reboot hangs at something like
> >
> > ```
> > [ 9.323801] JBD2: no valid journal superblock found
> > [ 9.325117] EXT4-fs (sda2): error loading journal
> > ```
> >
> >
> > > >
> > > > Also, I think this behaviour may impact on bmap-tools "psplash"
> > > > patches
> > > > currently we have on maillist. I would expect that user won't
> > > > see
> > > > the
> > > > progress bar on screen because it's somewhere on serial
> > > > console.
> > > >
> > > >
> > > > > StandardInput=tty
> > > > > StandardOutput=tty
> > > > > --
> > > > > 2.43.0
> > > > >
> > > >
> > >
> >
> > --
> > Best regards,
> > Uladzimir.
> >
> >
> >
>
--
Best regards,
Uladzimir.
--
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/05793724b0dfe2ec6a986c0bad83476f12a2ccda.camel%40ilbers.de.
^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2025-03-14 15:04 UTC | newest]
Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
2024-07-02 13:38 ` [PATCH 01/17] Kconfig: Rework installer image submenu Jan Kiszka
2024-07-02 13:38 ` [PATCH 02/17] installer: Do not show systemd boot menu Jan Kiszka
2024-07-02 13:38 ` [PATCH 03/17] meta-isar: deploy-image: Change reboot logic Jan Kiszka
2025-03-13 13:10 ` Uladzimir Bely
2025-03-14 5:54 ` 'Jan Kiszka' via isar-users
2025-03-14 6:25 ` Uladzimir Bely
2025-03-14 14:25 ` 'Heinisch, Alexander' via isar-users
2025-03-14 15:04 ` Uladzimir Bely
2024-07-02 13:38 ` [PATCH 04/17] meta-isar: deploy-image: Drop umount attempt after installation Jan Kiszka
2024-07-02 13:38 ` [PATCH 05/17] meta-isar: deploy-image: Fix bmap support Jan Kiszka
2024-07-02 13:38 ` [PATCH 06/17] meta-isar: deploy-image: Improve root mountpoint discovery Jan Kiszka
2024-07-02 13:38 ` [PATCH 07/17] meta-isar: deploy-image: Make TARGET_DEVICE a complete path Jan Kiszka
2024-07-02 13:38 ` [PATCH 08/17] meta-isar: deploy-image: Drop pointless --clear options from dialog Jan Kiszka
2024-07-02 13:38 ` [PATCH 09/17] meta-isar: deploy-image: Allow to cancel installation Jan Kiszka
2024-07-02 13:38 ` [PATCH 10/17] meta-isar: deploy-image: Warn if overwriting a non-empty disk Jan Kiszka
2024-07-03 15:53 ` 'MOESSBAUER, Felix' via isar-users
2024-07-03 15:55 ` 'Jan Kiszka' via isar-users
2024-07-19 5:33 ` Uladzimir Bely
2024-07-19 5:44 ` 'Jan Kiszka' via isar-users
2024-07-02 13:38 ` [PATCH 11/17] meta-isar: deploy-image: Fix and enhance image selection dialog Jan Kiszka
2024-07-02 13:38 ` [PATCH 12/17] meta-isar: deploy-image: Improve target device list dialog Jan Kiszka
2024-07-02 13:38 ` [PATCH 13/17] meta-isar: deploy-image: Polish some dialogs Jan Kiszka
2024-07-02 13:38 ` [PATCH 14/17] meta-isar: deploy-image: Re-indent Jan Kiszka
2024-07-02 13:38 ` [PATCH 15/17] meta-isar: deploy-image: Prepare for auto-installation mode Jan Kiszka
2024-07-02 13:38 ` [PATCH 16/17] meta-isar: deploy-image: Introduce " Jan Kiszka
2024-07-03 15:56 ` 'MOESSBAUER, Felix' via isar-users
2024-07-03 16:08 ` 'Jan Kiszka' via isar-users
2024-07-02 13:38 ` [PATCH 17/17] meta-isar: deploy-image: Polish recipe Jan Kiszka
2024-07-23 7:40 ` [PATCH 00/17] Reworks, fixes and unattended mode for image installer Uladzimir Bely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox