| Message ID | 20251021042201.1184698-1-kasturi.shekar@siemens.com |
|---|---|
| State | Under Review |
| Headers | show |
| Series | isar-installer: run installer under agetty and reboot via EXIT trap | expand |
I doubt this patch can be applied onto next. On next deploy-image-service already got replaced by target- bootstraper-service - Still, the invocation is similar. Link to source: https://github.com/ilbers/isar/tree/next/meta-isar/recipes-installer/target-bootstrapper-service and the corresponding thread on the mailinglist: https://groups.google.com/g/isar-users/c/fP88xwMFQuQ/m/d2Rz3TKIBgAJ BR Alexander On Tue, 2025-10-21 at 09:52 +0530, 'Kasturi Shekar' via isar-users wrote: > the deploy-image service was directly invoked the installer > script, which could result in the script running without a properly > configured TTY or missing TERM environment variable. This was > observed > when bypassing agetty during service startup > > now we launch the installer under agetty to ensure that it runs in a > fully initialized terminal environment. Since the service is now > managed > by agetty, we ensure that the system reboots once the installation > completes (successfully or not) by adding a trap handler. > > Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com> > --- > .../deploy-image-service/files/install.override.conf | 2 +- > .../deploy-image/files/usr/bin/deploy-image-wic.sh | 12 > ++++++++++++ > 2 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/meta-isar/recipes-installer/deploy-image- > service/files/install.override.conf b/meta-isar/recipes- > installer/deploy-image-service/files/install.override.conf > index 357d8662..913efac5 100644 > --- a/meta-isar/recipes-installer/deploy-image- > service/files/install.override.conf > +++ b/meta-isar/recipes-installer/deploy-image- > service/files/install.override.conf > @@ -1,5 +1,5 @@ > [Service] > ExecStart= > -ExecStart=/bin/sh -c "deploy-image-wic.sh || (echo 'Rebooting in 60 > s'; sleep 60); reboot" > +ExecStart=-/sbin/agetty -o --noclear -a root -l /usr/bin/deploy- > image-wic.sh --keep-baud 115200,38400,9600 %I $TERM > StandardInput=tty > StandardOutput=tty > 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 333762f1..7618a810 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 > @@ -3,6 +3,18 @@ > # Copyright (C) Siemens AG, 2024 > # > # SPDX-License-Identifier: MIT > +trap reboot_on_exit EXIT > + > +reboot_on_exit() { > + status=$? > + if [ $status -eq 0 ]; then > + echo "Installation completed successfully. Rebooting..." > + else > + echo "Installation failed. Rebooting in 60 seconds..." > + sleep 60 > + fi > + exec reboot > +} > > installdata=${INSTALL_DATA:-/install} > > -- > 2.39.5 >
diff --git a/meta-isar/recipes-installer/deploy-image-service/files/install.override.conf b/meta-isar/recipes-installer/deploy-image-service/files/install.override.conf index 357d8662..913efac5 100644 --- a/meta-isar/recipes-installer/deploy-image-service/files/install.override.conf +++ b/meta-isar/recipes-installer/deploy-image-service/files/install.override.conf @@ -1,5 +1,5 @@ [Service] ExecStart= -ExecStart=/bin/sh -c "deploy-image-wic.sh || (echo 'Rebooting in 60 s'; sleep 60); reboot" +ExecStart=-/sbin/agetty -o --noclear -a root -l /usr/bin/deploy-image-wic.sh --keep-baud 115200,38400,9600 %I $TERM StandardInput=tty StandardOutput=tty 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 333762f1..7618a810 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 @@ -3,6 +3,18 @@ # Copyright (C) Siemens AG, 2024 # # SPDX-License-Identifier: MIT +trap reboot_on_exit EXIT + +reboot_on_exit() { + status=$? + if [ $status -eq 0 ]; then + echo "Installation completed successfully. Rebooting..." + else + echo "Installation failed. Rebooting in 60 seconds..." + sleep 60 + fi + exec reboot +} installdata=${INSTALL_DATA:-/install}
the deploy-image service was directly invoked the installer script, which could result in the script running without a properly configured TTY or missing TERM environment variable. This was observed when bypassing agetty during service startup now we launch the installer under agetty to ensure that it runs in a fully initialized terminal environment. Since the service is now managed by agetty, we ensure that the system reboots once the installation completes (successfully or not) by adding a trap handler. Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com> --- .../deploy-image-service/files/install.override.conf | 2 +- .../deploy-image/files/usr/bin/deploy-image-wic.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-)