public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Kral <d.kral@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer] fix #5984: unconfigured: do not reboot if auto-installer fails by default
Date: Wed, 11 Dec 2024 17:14:02 +0100	[thread overview]
Message-ID: <20241211161402.236144-1-d.kral@proxmox.com> (raw)

A unintended side effect was introduced in 21ef304, which caused the
auto-installer to reboot on error, even though the answer file option
`general.reboot_on_error` has been set to `false`.

When an error signal is received inside `unconfigured.sh` (after the
trap statement `trap 'err_reboot' ERR`), it causes any failing command
to execute the `err_reboot` function and therefore dropping the user in
the debug shell. One exception, as described under `trap` in bash(1), is
for a command being part of the test in an if statement.

Therefore, simply simulate a trap by calling `err_reboot` directly.

Fixes: 21ef304 ("unconfigured.sh: run proxmox-post-hook after successful auto-install")
Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
I've tested this by booting into debug mode with a auto-installer
prepared ISO that has an invalid configuration (in this case, the
first-boot executable is not available in FromIso mode), patching the
`/usr/sbin/unconfigured.sh` script, forcing `start_auto_installer=1` and
skipping any statements in `unconfigured.sh`, which have already been
run to be in the debug shell (mounting procfs, sysfs, dhcp, ...).

When running `unconfigured.sh`, I have been dropped in another debug
shell with the output:

```sh
root@proxmox:/# unconfigured.sh
Caching device info from udev
Fetching answers for automatic installation
Starting automatic installation
INFO: Starting auto installer
ERROR: Installer setup error: Failed to retrieve setup info: No such
file or directory (os error 2)

Installation aborted - unable to continue (type exit or CTRL-D to reboot)
root@proxmox:/$ _
```

 unconfigured.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/unconfigured.sh b/unconfigured.sh
index 070cf33..f9cc9de 100755
--- a/unconfigured.sh
+++ b/unconfigured.sh
@@ -260,6 +260,9 @@ elif [ $start_auto_installer -ne 0 ]; then
             echo "waiting 30s to allow gathering the error before reboot."
             sleep 30
         fi
+    else
+	# simulate a trap to `err_reboot` if the auto-installer fails
+	err_reboot
     fi
 else
     echo "Starting the installer GUI - see tty2 (CTRL+ALT+F2) for any errors..."
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


             reply	other threads:[~2024-12-11 16:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11 16:14 Daniel Kral [this message]
2024-12-17 10:26 ` Christoph Heiss

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=20241211161402.236144-1-d.kral@proxmox.com \
    --to=d.kral@proxmox.com \
    --cc=pve-devel@lists.proxmox.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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal