public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: Jan Kiszka <jan.kiszka@siemens.com>, isar-users@googlegroups.com
Subject: Re: [PATCH v2 3/3] installer: Run in unattended mode only on ttyS0
Date: Tue, 18 Mar 2025 10:51:34 +0300	[thread overview]
Message-ID: <c96899552e7a4e8e677f54394f2490ac17fba1f3.camel@ilbers.de> (raw)
In-Reply-To: <0935ecd8-60c5-40ac-bb9d-d52ff49609d9@siemens.com>

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.

  reply	other threads:[~2025-03-18  7:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-03-18  8:13             ` Uladzimir Bely
2025-03-18  6:37     ` Uladzimir Bely
2025-03-18  7:09       ` 'Jan Kiszka' via isar-users

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=c96899552e7a4e8e677f54394f2490ac17fba1f3.camel@ilbers.de \
    --to=ubely@ilbers.de \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    /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