public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v3 0/4] Fixes for unattended installation
@ 2025-03-18 14:02 Uladzimir Bely
  2025-03-18 14:02 ` [PATCH v3 1/4] meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable Uladzimir Bely
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Uladzimir Bely @ 2025-03-18 14:02 UTC (permalink / raw)
  To: isar-users

Changes since v2:

- Allow to specify TTY to run unattended installation on;
- Allow to specify getty instances to run installer on.

Changes since v1:

- Install directly to "installer.wic", without "-snapshot" option;
- Fix race between to copies of unattended installer running on.

Uladzimir Bely (4):
  meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable
  testsuite: Disable "snapshot" feature for installer image.
  Installer: allow to set custom TTYs for installer
  installer: Run unattended mode on the only terminal

 meta-isar/recipes-core/images/isar-image-installer.bb    | 2 +-
 .../deploy-image-service/deploy-image-service.bb         | 9 +++++++--
 .../recipes-installer/deploy-image/deploy-image_0.1.bb   | 8 +++++++-
 .../{deploy-image-wic.sh => deploy-image-wic.sh.tmpl}    | 6 ++++++
 testsuite/cibuilder.py                                   | 3 ++-
 5 files changed, 23 insertions(+), 5 deletions(-)
 rename meta-isar/recipes-installer/deploy-image/files/usr/bin/{deploy-image-wic.sh => deploy-image-wic.sh.tmpl} (95%)

-- 
2.45.3

-- 
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/20250318140622.13676-1-ubely%40ilbers.de.

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

* [PATCH v3 1/4] meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable
  2025-03-18 14:02 [PATCH v3 0/4] Fixes for unattended installation Uladzimir Bely
@ 2025-03-18 14:02 ` Uladzimir Bely
  2025-03-18 14:02 ` [PATCH v3 2/4] testsuite: Disable "snapshot" feature for installer image Uladzimir Bely
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Uladzimir Bely @ 2025-03-18 14:02 UTC (permalink / raw)
  To: isar-users

Existing implementation treated INSTALLER_UNATTENDED = "0" like
it was enabled.

See also commit 29bb5a5c.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta-isar/recipes-core/images/isar-image-installer.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta-isar/recipes-core/images/isar-image-installer.bb b/meta-isar/recipes-core/images/isar-image-installer.bb
index ee04bb41..db379f5d 100644
--- a/meta-isar/recipes-core/images/isar-image-installer.bb
+++ b/meta-isar/recipes-core/images/isar-image-installer.bb
@@ -13,7 +13,7 @@ WKS_FILE = "${INSTALLER_WKS_FILE}"
 
 ADDITIONAL_KERNEL_CMDLINE ??= ""
 
-OVERRIDES .= "${@':unattended-installer' if d.getVar('INSTALLER_UNATTENDED') else ''}"
+OVERRIDES .= "${@':unattended-installer' if bb.utils.to_boolean(d.getVar('INSTALLER_UNATTENDED')) else ''}"
 ADDITIONAL_KERNEL_CMDLINE:append:unattended-installer = " \
     installer.unattended \
     installer.image.uri=/install/${IMAGE_DATA_FILE}.${IMAGE_DATA_POSTFIX} \
-- 
2.45.3

-- 
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/20250318140622.13676-2-ubely%40ilbers.de.

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

* [PATCH v3 2/4] testsuite: Disable "snapshot" feature for installer image.
  2025-03-18 14:02 [PATCH v3 0/4] Fixes for unattended installation Uladzimir Bely
  2025-03-18 14:02 ` [PATCH v3 1/4] meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable Uladzimir Bely
@ 2025-03-18 14:02 ` Uladzimir Bely
  2025-03-18 14:02 ` [PATCH v3 3/4] Installer: allow to set custom TTYs for installer Uladzimir Bely
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Uladzimir Bely @ 2025-03-18 14:02 UTC (permalink / raw)
  To: isar-users

In the testsuite we use qemu-system with "-shapshot" optiop with wic
images thus preventing them from unwanted modification by tests.

For installer.wic it's reasonable to disable this feature so that
bmaptool will write directly to "installer.wic" instead of temporary
file used by qemu for providing snapshot features.

It also allows to mount it after build for debugging purposes.
---
 testsuite/cibuilder.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 52eb35e8..eb5de190 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -236,7 +236,8 @@ class CIBuilder(Test):
                 f.write(f'DISTRO ?= "{installer_distro}"\n')
                 f.write(f'MACHINE ?= "{installer_machine}"\n')
                 f.write(f'QEMU_DISK_ARGS = "-bios /usr/share/ovmf/OVMF.fd"\n')
-                f.write(f'QEMU_DISK_ARGS += "-hda {install_target}"\n')
+                f.write(f'QEMU_DISK_ARGS += "-drive file={install_target},'\
+                    'if=ide,bus=0,unit=0,format=raw,snapshot=off"\n')
                 f.write(f'QEMU_DISK_ARGS += "-hdb ##ROOTFS_IMAGE##"\n')
 
         # include ci_build.conf in local.conf
-- 
2.45.3

-- 
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/20250318140622.13676-3-ubely%40ilbers.de.

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

* [PATCH v3 3/4] Installer: allow to set custom TTYs for installer
  2025-03-18 14:02 [PATCH v3 0/4] Fixes for unattended installation Uladzimir Bely
  2025-03-18 14:02 ` [PATCH v3 1/4] meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable Uladzimir Bely
  2025-03-18 14:02 ` [PATCH v3 2/4] testsuite: Disable "snapshot" feature for installer image Uladzimir Bely
@ 2025-03-18 14:02 ` Uladzimir Bely
  2025-03-18 21:25   ` 'Jan Kiszka' via isar-users
  2025-03-18 14:02 ` [PATCH v3 4/4] installer: Run unattended mode on the only terminal Uladzimir Bely
  2025-03-24  9:20 ` [PATCH v3 0/4] Fixes for unattended installation Uladzimir Bely
  4 siblings, 1 reply; 10+ messages in thread
From: Uladzimir Bely @ 2025-03-18 14:02 UTC (permalink / raw)
  To: isar-users

Different machines may use different terminals we want to
run installer on. Allow this to be set in local.conf via
INSTALLER_GETTY_TARGETS variables.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 .../deploy-image-service/deploy-image-service.bb         | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb b/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb
index 0fa3dcf3..fbcfbbfa 100644
--- a/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb
+++ b/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb
@@ -13,9 +13,14 @@ SRC_URI = "file://install.override.conf \
 DEPENDS += " deploy-image"
 DEBIAN_DEPENDS = "deploy-image"
 
+INSTALLER_GETTY_TARGETS ?= "getty@tty1 serial-getty@ttyS0"
+
 do_install[cleandirs] = "${D}/usr/lib/systemd/system/getty@tty1.service.d/ \
                          ${D}/usr/lib/systemd/system/serial-getty@ttyS0.service.d/"
 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
+  for target in ${INSTALLER_GETTY_TARGETS}; do
+    rm -rf ${D}/usr/lib/systemd/system/${target}.service.d/*
+    install -d -m 0700 ${D}/usr/lib/systemd/system/${target}.service.d/
+    install -m 0600 ${WORKDIR}/install.override.conf ${D}/usr/lib/systemd/system/${target}.service.d/
+  done
 }
-- 
2.45.3

-- 
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/20250318140622.13676-4-ubely%40ilbers.de.

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

* [PATCH v3 4/4] installer: Run unattended mode on the only terminal
  2025-03-18 14:02 [PATCH v3 0/4] Fixes for unattended installation Uladzimir Bely
                   ` (2 preceding siblings ...)
  2025-03-18 14:02 ` [PATCH v3 3/4] Installer: allow to set custom TTYs for installer Uladzimir Bely
@ 2025-03-18 14:02 ` Uladzimir Bely
  2025-03-18 21:39   ` 'Jan Kiszka' via isar-users
  2025-03-24  9:20 ` [PATCH v3 0/4] Fixes for unattended installation Uladzimir Bely
  4 siblings, 1 reply; 10+ messages in thread
From: Uladzimir Bely @ 2025-03-18 14:02 UTC (permalink / raw)
  To: isar-users

This fixes race between two unattended installer instances running
on different (e.g. serial "ttyS0" and graphic "tty1") terminals.

While one of them starts writing the disk, another one fails
and schedules reboot in 60 seconds. Depending on build machine
performance we can get incomplete installation and broken target
filesystem.

Selected terminal with unattended installer can be set by
INSTALLER_UNATTENDED_TTY variable. It should correspond to one
of INSTALLER_GETTY_TARGETS from deploy-image.service recipe.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 .../recipes-installer/deploy-image/deploy-image_0.1.bb    | 8 +++++++-
 .../bin/{deploy-image-wic.sh => deploy-image-wic.sh.tmpl} | 6 ++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
 rename meta-isar/recipes-installer/deploy-image/files/usr/bin/{deploy-image-wic.sh => deploy-image-wic.sh.tmpl} (95%)

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 242ca88e..1af3a6dd 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
@@ -7,10 +7,16 @@ DESCRIPTION = "Install image to device"
 
 inherit dpkg-raw
 
-SRC_URI = "file://usr/bin/deploy-image-wic.sh \
+SRC_URI = "file://usr/bin/deploy-image-wic.sh.tmpl \
            file://usr/lib/deploy-image-wic/handle-config.sh \
           "
 DEBIAN_DEPENDS = "bmap-tools, pv, dialog, util-linux, parted, fdisk, gdisk, pigz, xz-utils, pbzip2, zstd"
+
+INSTALLER_UNATTENDED_TTY ?= "${MACHINE_SERIAL}"
+
+TEMPLATE_FILES += "usr/bin/deploy-image-wic.sh.tmpl"
+TEMPLATE_VARS += "INSTALLER_UNATTENDED_TTY"
+
 do_install[cleandirs] = "${D}/usr/bin/ \
                          ${D}/usr/lib/deploy-image-wic \
                         "
diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh.tmpl
similarity index 95%
rename from meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
rename to meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh.tmpl
index 7f552eee..33a409f3 100755
--- a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh.tmpl
@@ -10,6 +10,12 @@ SCRIPT_DIR=$( dirname -- "$( readlink -f -- "$0"; )"; )
 
 . ${SCRIPT_DIR}/../lib/deploy-image-wic/handle-config.sh
 
+if $installer_unattended; then
+    if [ "$(tty)" != "/dev/${INSTALLER_UNATTENDED_TTY}" ]; then
+        dialog --msgbox "Unattended installer is active on ${INSTALLER_UNATTENDED_TTY}. Please wait for it to finish." 7 60
+        installer_unattended=false
+    fi
+fi
 
 if ! $installer_unattended; then
     installer_image_uri=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;)
-- 
2.45.3

-- 
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/20250318140622.13676-5-ubely%40ilbers.de.

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

* Re: [PATCH v3 3/4] Installer: allow to set custom TTYs for installer
  2025-03-18 14:02 ` [PATCH v3 3/4] Installer: allow to set custom TTYs for installer Uladzimir Bely
@ 2025-03-18 21:25   ` 'Jan Kiszka' via isar-users
  0 siblings, 0 replies; 10+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-03-18 21:25 UTC (permalink / raw)
  To: Uladzimir Bely, isar-users

On 18.03.25 15:02, Uladzimir Bely wrote:
> Different machines may use different terminals we want to
> run installer on. Allow this to be set in local.conf via
> INSTALLER_GETTY_TARGETS variables.
> 
> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> ---
>  .../deploy-image-service/deploy-image-service.bb         | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb b/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb
> index 0fa3dcf3..fbcfbbfa 100644
> --- a/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb
> +++ b/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb
> @@ -13,9 +13,14 @@ SRC_URI = "file://install.override.conf \
>  DEPENDS += " deploy-image"
>  DEBIAN_DEPENDS = "deploy-image"
>  
> +INSTALLER_GETTY_TARGETS ?= "getty@tty1 serial-getty@ttyS0"
> +
>  do_install[cleandirs] = "${D}/usr/lib/systemd/system/getty@tty1.service.d/ \
>                           ${D}/usr/lib/systemd/system/serial-getty@ttyS0.service.d/"

Now only "${D}/usr/lib/systemd/system/"

>  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
> +  for target in ${INSTALLER_GETTY_TARGETS}; do
> +    rm -rf ${D}/usr/lib/systemd/system/${target}.service.d/*

Unneeded, we already have cleandirs.

> +    install -d -m 0700 ${D}/usr/lib/systemd/system/${target}.service.d/
> +    install -m 0600 ${WORKDIR}/install.override.conf ${D}/usr/lib/systemd/system/${target}.service.d/
> +  done
>  }

Jan

-- 
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/57115aa5-1c8e-4d96-b762-451b22fe87ed%40siemens.com.

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

* Re: [PATCH v3 4/4] installer: Run unattended mode on the only terminal
  2025-03-18 14:02 ` [PATCH v3 4/4] installer: Run unattended mode on the only terminal Uladzimir Bely
@ 2025-03-18 21:39   ` 'Jan Kiszka' via isar-users
  2025-03-19  9:15     ` Uladzimir Bely
  2025-03-19 10:13     ` Uladzimir Bely
  0 siblings, 2 replies; 10+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-03-18 21:39 UTC (permalink / raw)
  To: Uladzimir Bely, isar-users

On 18.03.25 15:02, Uladzimir Bely wrote:
> This fixes race between two unattended installer instances running
> on different (e.g. serial "ttyS0" and graphic "tty1") terminals.
> 
> While one of them starts writing the disk, another one fails
> and schedules reboot in 60 seconds. Depending on build machine
> performance we can get incomplete installation and broken target
> filesystem.
> 
> Selected terminal with unattended installer can be set by
> INSTALLER_UNATTENDED_TTY variable. It should correspond to one
> of INSTALLER_GETTY_TARGETS from deploy-image.service recipe.
> 
> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> ---
>  .../recipes-installer/deploy-image/deploy-image_0.1.bb    | 8 +++++++-
>  .../bin/{deploy-image-wic.sh => deploy-image-wic.sh.tmpl} | 6 ++++++
>  2 files changed, 13 insertions(+), 1 deletion(-)
>  rename meta-isar/recipes-installer/deploy-image/files/usr/bin/{deploy-image-wic.sh => deploy-image-wic.sh.tmpl} (95%)
> 
> 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 242ca88e..1af3a6dd 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
> @@ -7,10 +7,16 @@ DESCRIPTION = "Install image to device"
>  
>  inherit dpkg-raw
>  
> -SRC_URI = "file://usr/bin/deploy-image-wic.sh \
> +SRC_URI = "file://usr/bin/deploy-image-wic.sh.tmpl \
>             file://usr/lib/deploy-image-wic/handle-config.sh \
>            "
>  DEBIAN_DEPENDS = "bmap-tools, pv, dialog, util-linux, parted, fdisk, gdisk, pigz, xz-utils, pbzip2, zstd"
> +
> +INSTALLER_UNATTENDED_TTY ?= "${MACHINE_SERIAL}"
> +
> +TEMPLATE_FILES += "usr/bin/deploy-image-wic.sh.tmpl"
> +TEMPLATE_VARS += "INSTALLER_UNATTENDED_TTY"
> +
>  do_install[cleandirs] = "${D}/usr/bin/ \
>                           ${D}/usr/lib/deploy-image-wic \
>                          "
> diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh.tmpl
> similarity index 95%
> rename from meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> rename to meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh.tmpl
> index 7f552eee..33a409f3 100755
> --- a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> +++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh.tmpl
> @@ -10,6 +10,12 @@ SCRIPT_DIR=$( dirname -- "$( readlink -f -- "$0"; )"; )
>  
>  . ${SCRIPT_DIR}/../lib/deploy-image-wic/handle-config.sh
>  
> +if $installer_unattended; then
> +    if [ "$(tty)" != "/dev/${INSTALLER_UNATTENDED_TTY}" ]; then
> +        dialog --msgbox "Unattended installer is active on ${INSTALLER_UNATTENDED_TTY}. Please wait for it to finish." 7 60
> +        installer_unattended=false

This remains wrong, already wrote before. Even more now with the new
model where we define that we will only handle even errors on
INSTALLER_UNATTENDED_TTY.

But all this is not what I suggested: First entry into the script that
passes the "target dev empty" test will do the copying, the other
instances terminate without error. If the empty test fails and
installer_target_overwrite is not set, the dialog will still be shown on
all terminals. The one that is then used will become the first (and
only) to copy.

Jan

> +    fi
> +fi
>  
>  if ! $installer_unattended; then
>      installer_image_uri=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;)

-- 
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/dfa10699-01e4-4ca4-9990-9d9882ee4b30%40siemens.com.

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

* Re: [PATCH v3 4/4] installer: Run unattended mode on the only terminal
  2025-03-18 21:39   ` 'Jan Kiszka' via isar-users
@ 2025-03-19  9:15     ` Uladzimir Bely
  2025-03-19 10:13     ` Uladzimir Bely
  1 sibling, 0 replies; 10+ messages in thread
From: Uladzimir Bely @ 2025-03-19  9:15 UTC (permalink / raw)
  To: Jan Kiszka, isar-users

On Tue, 2025-03-18 at 22:39 +0100, Jan Kiszka wrote:
> On 18.03.25 15:02, Uladzimir Bely wrote:
> > This fixes race between two unattended installer instances running
> > on different (e.g. serial "ttyS0" and graphic "tty1") terminals.
> > 
> > While one of them starts writing the disk, another one fails
> > and schedules reboot in 60 seconds. Depending on build machine
> > performance we can get incomplete installation and broken target
> > filesystem.
> > 
> > Selected terminal with unattended installer can be set by
> > INSTALLER_UNATTENDED_TTY variable. It should correspond to one
> > of INSTALLER_GETTY_TARGETS from deploy-image.service recipe.
> > 
> > Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> > ---
> >  .../recipes-installer/deploy-image/deploy-image_0.1.bb    | 8
> > +++++++-
> >  .../bin/{deploy-image-wic.sh => deploy-image-wic.sh.tmpl} | 6
> > ++++++
> >  2 files changed, 13 insertions(+), 1 deletion(-)
> >  rename meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/{deploy-image-wic.sh => deploy-image-
> > wic.sh.tmpl} (95%)
> > 
> > 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 242ca88e..1af3a6dd 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
> > @@ -7,10 +7,16 @@ DESCRIPTION = "Install image to device"
> >  
> >  inherit dpkg-raw
> >  
> > -SRC_URI = "file://usr/bin/deploy-image-wic.sh \
> > +SRC_URI = "file://usr/bin/deploy-image-wic.sh.tmpl \
> >             file://usr/lib/deploy-image-wic/handle-config.sh \
> >            "
> >  DEBIAN_DEPENDS = "bmap-tools, pv, dialog, util-linux, parted,
> > fdisk, gdisk, pigz, xz-utils, pbzip2, zstd"
> > +
> > +INSTALLER_UNATTENDED_TTY ?= "${MACHINE_SERIAL}"
> > +
> > +TEMPLATE_FILES += "usr/bin/deploy-image-wic.sh.tmpl"
> > +TEMPLATE_VARS += "INSTALLER_UNATTENDED_TTY"
> > +
> >  do_install[cleandirs] = "${D}/usr/bin/ \
> >                           ${D}/usr/lib/deploy-image-wic \
> >                          "
> > diff --git a/meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-
> > installer/deploy-image/files/usr/bin/deploy-image-wic.sh.tmpl
> > similarity index 95%
> > rename from meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh
> > rename to meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh.tmpl
> > index 7f552eee..33a409f3 100755
> > --- a/meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh
> > +++ b/meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh.tmpl
> > @@ -10,6 +10,12 @@ SCRIPT_DIR=$( dirname -- "$( readlink -f --
> > "$0"; )"; )
> >  
> >  . ${SCRIPT_DIR}/../lib/deploy-image-wic/handle-config.sh
> >  
> > +if $installer_unattended; then
> > +    if [ "$(tty)" != "/dev/${INSTALLER_UNATTENDED_TTY}" ]; then
> > +        dialog --msgbox "Unattended installer is active on
> > ${INSTALLER_UNATTENDED_TTY}. Please wait for it to finish." 7 60
> > +        installer_unattended=false
> 
> This remains wrong, already wrote before. Even more now with the new
> model where we define that we will only handle even errors on
> INSTALLER_UNATTENDED_TTY.
> 
> But all this is not what I suggested: First entry into the script
> that
> passes the "target dev empty" test will do the copying,

But if there is no direct definition of UNATTENDED_TTY and we allow
such kind of race, it's not predictable, where to look at the
installation process.

>  the other
> instances terminate without error.

I didn't get why, but for some reason board reboots even if the
instance immediately terminates without errors (i.e. returns 0). That's
strange (because we have ' || <reboot logic>' in the service, but it
is. So, the only way I found is to leave other instances waiting for
user input.

>  If the empty test fails and
> installer_target_overwrite is not set, the dialog will still be shown
> on
> all te mrminals. The one that is then used will become the first (and
> only) to copy.
> 

The main thing I tried to achieve with the patchset is to fix problems
that make CI fail and block merging other patches from maillist.

Probably, from the user perspective the ideal behaviour would be run
unattended installation on one TTY and just show the progress on all
TTYs. 

> Jan
> 
> > +    fi
> > +fi
> >  
> >  if ! $installer_unattended; then
> >      installer_image_uri=$(find "$installdata" -type f -iname
> > "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;)
> 

-- 
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/65b10c049f59096a66d835faa17ae13948e8056d.camel%40ilbers.de.

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

* Re: [PATCH v3 4/4] installer: Run unattended mode on the only terminal
  2025-03-18 21:39   ` 'Jan Kiszka' via isar-users
  2025-03-19  9:15     ` Uladzimir Bely
@ 2025-03-19 10:13     ` Uladzimir Bely
  1 sibling, 0 replies; 10+ messages in thread
From: Uladzimir Bely @ 2025-03-19 10:13 UTC (permalink / raw)
  To: Jan Kiszka, isar-users

On Tue, 2025-03-18 at 22:39 +0100, Jan Kiszka wrote:
> On 18.03.25 15:02, Uladzimir Bely wrote:
> > This fixes race between two unattended installer instances running
> > on different (e.g. serial "ttyS0" and graphic "tty1") terminals.
> > 
> > While one of them starts writing the disk, another one fails
> > and schedules reboot in 60 seconds. Depending on build machine
> > performance we can get incomplete installation and broken target
> > filesystem.
> > 
> > Selected terminal with unattended installer can be set by
> > INSTALLER_UNATTENDED_TTY variable. It should correspond to one
> > of INSTALLER_GETTY_TARGETS from deploy-image.service recipe.
> > 
> > Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> > ---
> >  .../recipes-installer/deploy-image/deploy-image_0.1.bb    | 8
> > +++++++-
> >  .../bin/{deploy-image-wic.sh => deploy-image-wic.sh.tmpl} | 6
> > ++++++
> >  2 files changed, 13 insertions(+), 1 deletion(-)
> >  rename meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/{deploy-image-wic.sh => deploy-image-
> > wic.sh.tmpl} (95%)
> > 
> > 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 242ca88e..1af3a6dd 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
> > @@ -7,10 +7,16 @@ DESCRIPTION = "Install image to device"
> >  
> >  inherit dpkg-raw
> >  
> > -SRC_URI = "file://usr/bin/deploy-image-wic.sh \
> > +SRC_URI = "file://usr/bin/deploy-image-wic.sh.tmpl \
> >             file://usr/lib/deploy-image-wic/handle-config.sh \
> >            "
> >  DEBIAN_DEPENDS = "bmap-tools, pv, dialog, util-linux, parted,
> > fdisk, gdisk, pigz, xz-utils, pbzip2, zstd"
> > +
> > +INSTALLER_UNATTENDED_TTY ?= "${MACHINE_SERIAL}"
> > +
> > +TEMPLATE_FILES += "usr/bin/deploy-image-wic.sh.tmpl"
> > +TEMPLATE_VARS += "INSTALLER_UNATTENDED_TTY"
> > +
> >  do_install[cleandirs] = "${D}/usr/bin/ \
> >                           ${D}/usr/lib/deploy-image-wic \
> >                          "
> > diff --git a/meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-
> > installer/deploy-image/files/usr/bin/deploy-image-wic.sh.tmpl
> > similarity index 95%
> > rename from meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh
> > rename to meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh.tmpl
> > index 7f552eee..33a409f3 100755
> > --- a/meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh
> > +++ b/meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh.tmpl
> > @@ -10,6 +10,12 @@ SCRIPT_DIR=$( dirname -- "$( readlink -f --
> > "$0"; )"; )
> >  
> >  . ${SCRIPT_DIR}/../lib/deploy-image-wic/handle-config.sh
> >  
> > +if $installer_unattended; then
> > +    if [ "$(tty)" != "/dev/${INSTALLER_UNATTENDED_TTY}" ]; then
> > +        dialog --msgbox "Unattended installer is active on
> > ${INSTALLER_UNATTENDED_TTY}. Please wait for it to finish." 7 60
> > +        installer_unattended=false
> 
> This remains wrong, already wrote before. Even more now with the new
> model where we define that we will only handle even errors on
> INSTALLER_UNATTENDED_TTY.
> 
> But all this is not what I suggested: First entry into the script
> that
> passes the "target dev empty" test will do the copying, the other
> instances terminate without error.

Actually, all instances will pass "target dev empty" test since they
are working in parallel. First error starts at "bmaptool" stage.

>  If the empty test fails and
> installer_target_overwrite is not set, the dialog will still be shown
> on
> all terminals. The one that is then used will become the first (and
> only) to copy.
> 
> Jan
> 
> > +    fi
> > +fi
> >  
> >  if ! $installer_unattended; then
> >      installer_image_uri=$(find "$installdata" -type f -iname
> > "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;)
> 

-- 
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/a606f3ae2bd47b158cc26e0417ef246120eb46ca.camel%40ilbers.de.

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

* Re: [PATCH v3 0/4] Fixes for unattended installation
  2025-03-18 14:02 [PATCH v3 0/4] Fixes for unattended installation Uladzimir Bely
                   ` (3 preceding siblings ...)
  2025-03-18 14:02 ` [PATCH v3 4/4] installer: Run unattended mode on the only terminal Uladzimir Bely
@ 2025-03-24  9:20 ` Uladzimir Bely
  4 siblings, 0 replies; 10+ messages in thread
From: Uladzimir Bely @ 2025-03-24  9:20 UTC (permalink / raw)
  To: isar-users

On Tue, 2025-03-18 at 17:02 +0300, Uladzimir Bely wrote:
> Changes since v2:
> 
> - Allow to specify TTY to run unattended installation on;
> - Allow to specify getty instances to run installer on.
> 
> Changes since v1:
> 
> - Install directly to "installer.wic", without "-snapshot" option;
> - Fix race between to copies of unattended installer running on.
> 
> Uladzimir Bely (4):
>   meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable
>   testsuite: Disable "snapshot" feature for installer image.
>   Installer: allow to set custom TTYs for installer
>   installer: Run unattended mode on the only terminal
> 
>  meta-isar/recipes-core/images/isar-image-installer.bb    | 2 +-
>  .../deploy-image-service/deploy-image-service.bb         | 9
> +++++++--
>  .../recipes-installer/deploy-image/deploy-image_0.1.bb   | 8
> +++++++-
>  .../{deploy-image-wic.sh => deploy-image-wic.sh.tmpl}    | 6 ++++++
>  testsuite/cibuilder.py                                   | 3 ++-
>  5 files changed, 23 insertions(+), 5 deletions(-)
>  rename meta-isar/recipes-installer/deploy-
> image/files/usr/bin/{deploy-image-wic.sh => deploy-image-wic.sh.tmpl}
> (95%)
> 
> -- 
> 2.45.3

Patches 1 and 2 are merged to next.

This makes full CI passing on all our servers with CI and unblocks
testing/merging other patches from the list.

Patches 3 and 4 fixing core issues with installer race in unattended
mode are not yet merged since they require some time to rework.

-- 
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/27078e20bbd41ad943da88deca51d958df202a33.camel%40ilbers.de.

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

end of thread, other threads:[~2025-03-24  9:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-18 14:02 [PATCH v3 0/4] Fixes for unattended installation Uladzimir Bely
2025-03-18 14:02 ` [PATCH v3 1/4] meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable Uladzimir Bely
2025-03-18 14:02 ` [PATCH v3 2/4] testsuite: Disable "snapshot" feature for installer image Uladzimir Bely
2025-03-18 14:02 ` [PATCH v3 3/4] Installer: allow to set custom TTYs for installer Uladzimir Bely
2025-03-18 21:25   ` 'Jan Kiszka' via isar-users
2025-03-18 14:02 ` [PATCH v3 4/4] installer: Run unattended mode on the only terminal Uladzimir Bely
2025-03-18 21:39   ` 'Jan Kiszka' via isar-users
2025-03-19  9:15     ` Uladzimir Bely
2025-03-19 10:13     ` Uladzimir Bely
2025-03-24  9:20 ` [PATCH v3 0/4] Fixes for unattended installation Uladzimir Bely

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