public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: Uladzimir Bely <ubely@ilbers.de>, isar-users@googlegroups.com
Subject: Re: [PATCH v3 4/4] installer: Run unattended mode on the only terminal
Date: Tue, 18 Mar 2025 22:39:40 +0100	[thread overview]
Message-ID: <dfa10699-01e4-4ca4-9990-9d9882ee4b30@siemens.com> (raw)
In-Reply-To: <20250318140622.13676-5-ubely@ilbers.de>

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.

  reply	other threads:[~2025-03-18 21:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=dfa10699-01e4-4ca4-9990-9d9882ee4b30@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    --cc=ubely@ilbers.de \
    /path/to/YOUR_REPLY

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

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