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

Changes since v1:

- P2: Install directly to "installer.wic"
- P3: Fix race between to copies of unattended installer running on
different terminals.

Uladzimir Bely (3):
  meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable
  testsuite: Disable "snapshot" feature for installer image.
  installer: Run in unattended mode only on ttyS0

 meta-isar/recipes-core/images/isar-image-installer.bb       | 2 +-
 .../deploy-image/files/usr/bin/deploy-image-wic.sh          | 6 ++++++
 testsuite/cibuilder.py                                      | 3 ++-
 3 files changed, 9 insertions(+), 2 deletions(-)

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

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

* [PATCH v2 1/3] meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable
  2025-03-18  6:10 [PATCH v2 0/3] Fixes for unattended installation Uladzimir Bely
@ 2025-03-18  6:10 ` Uladzimir Bely
  2025-03-18  6:10 ` [PATCH v2 2/3] testsuite: Disable "snapshot" feature for installer image Uladzimir Bely
  2025-03-18  6:10 ` [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0 Uladzimir Bely
  2 siblings, 0 replies; 12+ messages in thread
From: Uladzimir Bely @ 2025-03-18  6:10 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/20250318061300.12805-2-ubely%40ilbers.de.

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

* [PATCH v2 2/3] testsuite: Disable "snapshot" feature for installer image.
  2025-03-18  6:10 [PATCH v2 0/3] Fixes for unattended installation Uladzimir Bely
  2025-03-18  6:10 ` [PATCH v2 1/3] meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable Uladzimir Bely
@ 2025-03-18  6:10 ` Uladzimir Bely
  2025-03-18  6:10 ` [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0 Uladzimir Bely
  2 siblings, 0 replies; 12+ messages in thread
From: Uladzimir Bely @ 2025-03-18  6:10 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/20250318061300.12805-3-ubely%40ilbers.de.

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

* [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0
  2025-03-18  6:10 [PATCH v2 0/3] Fixes for unattended installation Uladzimir Bely
  2025-03-18  6:10 ` [PATCH v2 1/3] meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable Uladzimir Bely
  2025-03-18  6:10 ` [PATCH v2 2/3] testsuite: Disable "snapshot" feature for installer image Uladzimir Bely
@ 2025-03-18  6:10 ` Uladzimir Bely
  2025-03-18  6:25   ` 'Jan Kiszka' via isar-users
  2 siblings, 1 reply; 12+ messages in thread
From: Uladzimir Bely @ 2025-03-18  6:10 UTC (permalink / raw)
  To: isar-users

This fixes race between two unattended installer instances running
on 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.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 .../deploy-image/files/usr/bin/deploy-image-wic.sh          | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
index 7f552eee..bd580694 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
@@ -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/ttyS0" ]; then
+        echo "Disable unattended mode on $(tty), it's active on /dev/ttyS0"
+        installer_unattended=0
+    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/20250318061300.12805-4-ubely%40ilbers.de.

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

* Re: [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0
  2025-03-18  6:10 ` [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0 Uladzimir Bely
@ 2025-03-18  6:25   ` 'Jan Kiszka' via isar-users
  2025-03-18  6:29     ` 'Jan Kiszka' via isar-users
  2025-03-18  6:37     ` Uladzimir Bely
  0 siblings, 2 replies; 12+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-03-18  6:25 UTC (permalink / raw)
  To: Uladzimir Bely, isar-users

On 18.03.25 07:10, Uladzimir Bely wrote:
> This fixes race between two unattended installer instances running
> on 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.
> 
> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> ---
>  .../deploy-image/files/usr/bin/deploy-image-wic.sh          | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> index 7f552eee..bd580694 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
> @@ -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/ttyS0" ]; then

This is wrong. "ttyS0" is target-specific. We need a different, generic
mechanism to detect multiple executions.

Jan

> +        echo "Disable unattended mode on $(tty), it's active on /dev/ttyS0"
> +        installer_unattended=0
> +    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/f1552f18-0127-4240-a205-48dded1ab6b4%40siemens.com.

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

* Re: [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0
  2025-03-18  6:25   ` 'Jan Kiszka' via isar-users
@ 2025-03-18  6:29     ` 'Jan Kiszka' via isar-users
  2025-03-18  6:33       ` Uladzimir Bely
  2025-03-18  6:37     ` Uladzimir Bely
  1 sibling, 1 reply; 12+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-03-18  6:29 UTC (permalink / raw)
  To: Uladzimir Bely, isar-users

On 18.03.25 07:25, 'Jan Kiszka' via isar-users wrote:
> On 18.03.25 07:10, Uladzimir Bely wrote:
>> This fixes race between two unattended installer instances running
>> on 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.
>>
>> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
>> ---
>>  .../deploy-image/files/usr/bin/deploy-image-wic.sh          | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
>> index 7f552eee..bd580694 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
>> @@ -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/ttyS0" ]; then
> 
> This is wrong. "ttyS0" is target-specific. We need a different, generic
> mechanism to detect multiple executions.
> 
> Jan
> 
>> +        echo "Disable unattended mode on $(tty), it's active on /dev/ttyS0"
>> +        installer_unattended=0

And this would be also wrong.

But all this does not make sense yet. We have a single service that is
supposed to run a single script. I don't see why systemd should
instantiate the service multiple times. Is our service file incorrect?

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/7b66abad-a095-4eb0-bc20-643f9743e5fb%40siemens.com.

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

* Re: [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0
  2025-03-18  6:29     ` 'Jan Kiszka' via isar-users
@ 2025-03-18  6:33       ` Uladzimir Bely
  2025-03-18  7:08         ` 'Jan Kiszka' via isar-users
  0 siblings, 1 reply; 12+ messages in thread
From: Uladzimir Bely @ 2025-03-18  6:33 UTC (permalink / raw)
  To: Jan Kiszka, isar-users

On Tue, 2025-03-18 at 07:29 +0100, Jan Kiszka wrote:
> On 18.03.25 07:25, 'Jan Kiszka' via isar-users wrote:
> > On 18.03.25 07:10, Uladzimir Bely wrote:
> > > This fixes race between two unattended installer instances
> > > running
> > > on 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.
> > > 
> > > Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> > > ---
> > >  .../deploy-image/files/usr/bin/deploy-image-wic.sh          | 6
> > > ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/meta-isar/recipes-installer/deploy-
> > > image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-
> > > installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> > > index 7f552eee..bd580694 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
> > > @@ -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/ttyS0" ]; then
> > 
> > This is wrong. "ttyS0" is target-specific. We need a different,
> > generic
> > mechanism to detect multiple executions.
> > 
> > Jan
> > 
> > > +        echo "Disable unattended mode on $(tty), it's active on
> > > /dev/ttyS0"
> > > +        installer_unattended=0
> 
> And this would be also wrong.
> 
> But all this does not make sense yet. We have a single service that
> is
> supposed to run a single script. I don't see why systemd should
> instantiate the service multiple times. Is our service file
> incorrect?
> 

The service itself is correct, the problem is that it's run twice.

https://github.com/ilbers/isar/blob/master/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb#L19-L20

For non-unattended mode it doesn't matter, but in unattended mode one
of instances fails and schedules rebooting.

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

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

* Re: [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0
  2025-03-18  6:25   ` 'Jan Kiszka' via isar-users
  2025-03-18  6:29     ` 'Jan Kiszka' via isar-users
@ 2025-03-18  6:37     ` Uladzimir Bely
  2025-03-18  7:09       ` 'Jan Kiszka' via isar-users
  1 sibling, 1 reply; 12+ messages in thread
From: Uladzimir Bely @ 2025-03-18  6:37 UTC (permalink / raw)
  To: Jan Kiszka, isar-users

On Tue, 2025-03-18 at 07:25 +0100, Jan Kiszka wrote:
> On 18.03.25 07:10, Uladzimir Bely wrote:
> > This fixes race between two unattended installer instances running
> > on 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.
> > 
> > Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> > ---
> >  .../deploy-image/files/usr/bin/deploy-image-wic.sh          | 6
> > ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-
> > installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> > index 7f552eee..bd580694 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
> > @@ -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/ttyS0" ]; then
> 
> This is wrong. "ttyS0" is target-specific. We need a different,
> generic
> mechanism to detect multiple executions.
> 
> Jan

I agree. But this is also hardcoded in the service recipe, so this
generic mechanism should also make change in it.

I think, it could be some "main" tty variable defined in the recipe and
some additional ttys to run always in "attended" mode.

> 
> > +        echo "Disable unattended mode on $(tty), it's active on
> > /dev/ttyS0"
> > +        installer_unattended=0
> > +    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/5ab461a76bc066f989804803f693d8b836328078.camel%40ilbers.de.

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

* Re: [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0
  2025-03-18  6:33       ` Uladzimir Bely
@ 2025-03-18  7:08         ` 'Jan Kiszka' via isar-users
  2025-03-18  7:51           ` Uladzimir Bely
  0 siblings, 1 reply; 12+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-03-18  7:08 UTC (permalink / raw)
  To: Uladzimir Bely, isar-users

On 18.03.25 07:33, Uladzimir Bely wrote:
> On Tue, 2025-03-18 at 07:29 +0100, Jan Kiszka wrote:
>> On 18.03.25 07:25, 'Jan Kiszka' via isar-users wrote:
>>> On 18.03.25 07:10, Uladzimir Bely wrote:
>>>> This fixes race between two unattended installer instances
>>>> running
>>>> on 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.
>>>>
>>>> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
>>>> ---
>>>>  .../deploy-image/files/usr/bin/deploy-image-wic.sh          | 6
>>>> ++++++
>>>>  1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/meta-isar/recipes-installer/deploy-
>>>> image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-
>>>> installer/deploy-image/files/usr/bin/deploy-image-wic.sh
>>>> index 7f552eee..bd580694 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
>>>> @@ -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/ttyS0" ]; then
>>>
>>> This is wrong. "ttyS0" is target-specific. We need a different,
>>> generic
>>> mechanism to detect multiple executions.
>>>
>>> Jan
>>>
>>>> +        echo "Disable unattended mode on $(tty), it's active on
>>>> /dev/ttyS0"
>>>> +        installer_unattended=0
>>
>> And this would be also wrong.
>>
>> But all this does not make sense yet. We have a single service that
>> is
>> supposed to run a single script. I don't see why systemd should
>> instantiate the service multiple times. Is our service file
>> incorrect?
>>
> 
> The service itself is correct, the problem is that it's run twice.
> 
> https://github.com/ilbers/isar/blob/master/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb#L19-L20
> 
> For non-unattended mode it doesn't matter, but in unattended mode one
> of instances fails and schedules rebooting.
> 

Ah, now I remember.

But, again, we need a proper fix here. Re-entrance needs to be detected,
the core copy job needs to be run only once. And all other entrances of
the script skip over the copying core or otherwise wait at the same
dialog that semi-unattended modes may show.

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/0935ecd8-60c5-40ac-bb9d-d52ff49609d9%40siemens.com.

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

* Re: [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0
  2025-03-18  6:37     ` Uladzimir Bely
@ 2025-03-18  7:09       ` 'Jan Kiszka' via isar-users
  0 siblings, 0 replies; 12+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-03-18  7:09 UTC (permalink / raw)
  To: Uladzimir Bely, isar-users

On 18.03.25 07:37, Uladzimir Bely wrote:
> On Tue, 2025-03-18 at 07:25 +0100, Jan Kiszka wrote:
>> On 18.03.25 07:10, Uladzimir Bely wrote:
>>> This fixes race between two unattended installer instances running
>>> on 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.
>>>
>>> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
>>> ---
>>>  .../deploy-image/files/usr/bin/deploy-image-wic.sh          | 6
>>> ++++++
>>>  1 file changed, 6 insertions(+)
>>>
>>> diff --git a/meta-isar/recipes-installer/deploy-
>>> image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-
>>> installer/deploy-image/files/usr/bin/deploy-image-wic.sh
>>> index 7f552eee..bd580694 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
>>> @@ -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/ttyS0" ]; then
>>
>> This is wrong. "ttyS0" is target-specific. We need a different,
>> generic
>> mechanism to detect multiple executions.
>>
>> Jan
> 
> I agree. But this is also hardcoded in the service recipe, so this
> generic mechanism should also make change in it.
> 

That's no excuse for hard-coding that in the script as well.

Jan

> I think, it could be some "main" tty variable defined in the recipe and
> some additional ttys to run always in "attended" mode.
> 
>>
>>> +        echo "Disable unattended mode on $(tty), it's active on
>>> /dev/ttyS0"
>>> +        installer_unattended=0
>>> +    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/ceddc5c7-9b4a-4ca6-9a38-dd26d08f317f%40siemens.com.

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

* Re: [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0
  2025-03-18  7:08         ` 'Jan Kiszka' via isar-users
@ 2025-03-18  7:51           ` Uladzimir Bely
  2025-03-18  8:13             ` Uladzimir Bely
  0 siblings, 1 reply; 12+ messages in thread
From: Uladzimir Bely @ 2025-03-18  7:51 UTC (permalink / raw)
  To: Jan Kiszka, isar-users

On Tue, 2025-03-18 at 08:08 +0100, Jan Kiszka wrote:
> On 18.03.25 07:33, Uladzimir Bely wrote:
> > On Tue, 2025-03-18 at 07:29 +0100, Jan Kiszka wrote:
> > > On 18.03.25 07:25, 'Jan Kiszka' via isar-users wrote:
> > > > On 18.03.25 07:10, Uladzimir Bely wrote:
> > > > > This fixes race between two unattended installer instances
> > > > > running
> > > > > on 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.
> > > > > 
> > > > > Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> > > > > ---
> > > > >  .../deploy-image/files/usr/bin/deploy-image-wic.sh         
> > > > > | 6
> > > > > ++++++
> > > > >  1 file changed, 6 insertions(+)
> > > > > 
> > > > > diff --git a/meta-isar/recipes-installer/deploy-
> > > > > image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-
> > > > > installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> > > > > index 7f552eee..bd580694 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
> > > > > @@ -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/ttyS0" ]; then
> > > > 
> > > > This is wrong. "ttyS0" is target-specific. We need a different,
> > > > generic
> > > > mechanism to detect multiple executions.
> > > > 
> > > > Jan
> > > > 
> > > > > +        echo "Disable unattended mode on $(tty), it's active
> > > > > on
> > > > > /dev/ttyS0"
> > > > > +        installer_unattended=0
> > > 
> > > And this would be also wrong.
> > > 
> > > But all this does not make sense yet. We have a single service
> > > that
> > > is
> > > supposed to run a single script. I don't see why systemd should
> > > instantiate the service multiple times. Is our service file
> > > incorrect?
> > > 
> > 
> > The service itself is correct, the problem is that it's run twice.
> > 
> > https://github.com/ilbers/isar/blob/master/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb#L19-L20
> > 
> > For non-unattended mode it doesn't matter, but in unattended mode
> > one
> > of instances fails and schedules rebooting.
> > 
> 
> Ah, now I remember.
> 
> But, again, we need a proper fix here. Re-entrance needs to be
> detected,
> the core copy job needs to be run only once. And all other entrances
> of
> the script skip over the copying core or otherwise wait at the same
> dialog that semi-unattended modes may show.
> 
> Jan
> 

OK, I see.

So, there are two ways to deal with the issue:

1. Make one of terminals (for example, first virtual console ttyS1)
main one, e.g.:

INSTALLER_UNATTENDED_CONSOLE ?= "ttyS1"

And refer to this variable instead of hardcoded value.

2. Unattended installation will be done by the service which was the
first one in the race (first who run bmaptool and locked e.g.
/dev/sda). Other services just should not trigger reboot in this case,
that means "reboot" should be moved from service unit to script again.

As for me, I would prefer option 1 since it's more predictable.


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

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

* Re: [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0
  2025-03-18  7:51           ` Uladzimir Bely
@ 2025-03-18  8:13             ` Uladzimir Bely
  0 siblings, 0 replies; 12+ messages in thread
From: Uladzimir Bely @ 2025-03-18  8:13 UTC (permalink / raw)
  To: Jan Kiszka, isar-users

On Tue, 2025-03-18 at 10:51 +0300, Uladzimir Bely wrote:
> On Tue, 2025-03-18 at 08:08 +0100, Jan Kiszka wrote:
> > On 18.03.25 07:33, Uladzimir Bely wrote:
> > > On Tue, 2025-03-18 at 07:29 +0100, Jan Kiszka wrote:
> > > > On 18.03.25 07:25, 'Jan Kiszka' via isar-users wrote:
> > > > > On 18.03.25 07:10, Uladzimir Bely wrote:
> > > > > > This fixes race between two unattended installer instances
> > > > > > running
> > > > > > on 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.
> > > > > > 
> > > > > > Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> > > > > > ---
> > > > > >  .../deploy-image/files/usr/bin/deploy-image-
> > > > > > wic.sh         
> > > > > > > 6
> > > > > > ++++++
> > > > > >  1 file changed, 6 insertions(+)
> > > > > > 
> > > > > > diff --git a/meta-isar/recipes-installer/deploy-
> > > > > > image/files/usr/bin/deploy-image-wic.sh b/meta-
> > > > > > isar/recipes-
> > > > > > installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> > > > > > index 7f552eee..bd580694 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
> > > > > > @@ -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/ttyS0" ]; then
> > > > > 
> > > > > This is wrong. "ttyS0" is target-specific. We need a
> > > > > different,
> > > > > generic
> > > > > mechanism to detect multiple executions.
> > > > > 
> > > > > Jan
> > > > > 
> > > > > > +        echo "Disable unattended mode on $(tty), it's
> > > > > > active
> > > > > > on
> > > > > > /dev/ttyS0"
> > > > > > +        installer_unattended=0
> > > > 
> > > > And this would be also wrong.
> > > > 
> > > > But all this does not make sense yet. We have a single service
> > > > that
> > > > is
> > > > supposed to run a single script. I don't see why systemd should
> > > > instantiate the service multiple times. Is our service file
> > > > incorrect?
> > > > 
> > > 
> > > The service itself is correct, the problem is that it's run
> > > twice.
> > > 
> > > https://github.com/ilbers/isar/blob/master/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb#L19-L20
> > > 
> > > For non-unattended mode it doesn't matter, but in unattended mode
> > > one
> > > of instances fails and schedules rebooting.
> > > 
> > 
> > Ah, now I remember.
> > 
> > But, again, we need a proper fix here. Re-entrance needs to be
> > detected,
> > the core copy job needs to be run only once. And all other
> > entrances
> > of
> > the script skip over the copying core or otherwise wait at the same
> > dialog that semi-unattended modes may show.
> > 
> > Jan
> > 
> 
> OK, I see.
> 
> So, there are two ways to deal with the issue:
> 
> 1. Make one of terminals (for example, first virtual console ttyS1)
> main one, e.g.:
> 
> INSTALLER_UNATTENDED_CONSOLE ?= "ttyS1"
> 
> And refer to this variable instead of hardcoded value.

...Actually, we could simply check for MACHINE_SERIAL here without
adding new variable.

> 
> 2. Unattended installation will be done by the service which was the
> first one in the race (first who run bmaptool and locked e.g.
> /dev/sda). Other services just should not trigger reboot in this
> case,
> that means "reboot" should be moved from service unit to script
> again.
> 
> As for me, I would prefer option 1 since it's more predictable.
> 
> 
> -- 
> 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/6ce13be6cba7f99471d3eeb3d14722adc702b711.camel%40ilbers.de.

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

end of thread, other threads:[~2025-03-18  8:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-18  6:10 [PATCH v2 0/3] Fixes for unattended installation Uladzimir Bely
2025-03-18  6:10 ` [PATCH v2 1/3] meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable Uladzimir Bely
2025-03-18  6:10 ` [PATCH v2 2/3] testsuite: Disable "snapshot" feature for installer image Uladzimir Bely
2025-03-18  6:10 ` [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0 Uladzimir Bely
2025-03-18  6:25   ` 'Jan Kiszka' via isar-users
2025-03-18  6:29     ` 'Jan Kiszka' via isar-users
2025-03-18  6:33       ` Uladzimir Bely
2025-03-18  7:08         ` 'Jan Kiszka' via isar-users
2025-03-18  7:51           ` Uladzimir Bely
2025-03-18  8:13             ` Uladzimir Bely
2025-03-18  6:37     ` Uladzimir Bely
2025-03-18  7:09       ` 'Jan Kiszka' via isar-users

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