From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Daniel Kral <d.kral@proxmox.com>
Subject: [pve-devel] applied: [PATCH installer v2] fix #5984: unconfigured: do not reboot if auto-installer fails by default
Date: Mon, 24 Feb 2025 16:19:31 +0100 [thread overview]
Message-ID: <715fdb41-01ea-4f7a-94ff-b7e6e1bbaac3@proxmox.com> (raw)
In-Reply-To: <20250108152828.232648-1-d.kral@proxmox.com>
Am 08.01.25 um 16:28 schrieb Daniel Kral:
> An 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, if
> the auto-installer failed, it won't trap to `err_reboot`.
>
> Therefore, create a flag file "/run/proxmox-reboot-on-error" if the
> auto-installer should reboot on error. If it should, the auto-installer
> will be rebooted on error. If not, artificially trap to `err_reboot` to
> drop into the debug shell.
>
> The shell check at `err_reboot` can now be removed since the function is
> called directly.
>
> Fixes: 21ef304 ("unconfigured.sh: run proxmox-post-hook after successful auto-install")
> Signed-off-by: Daniel Kral <d.kral@proxmox.com>
> ---
> changes since v1 (thanks @Christoph):
> - add a flag file "/run/proxmox-reboot-on-error"
> - fix issue where `reboot_on_error` is ignored in general
> - removing the shell check since `err_reboot` is called directly
>
> ---
>
> Testing
>
> I've tested this by booting the installer in debug mode, setting up DHCP
> and patching the changes below. Otherwise I tested 8 possible scenarios,
> where I simulated a failing auto install through trying to install a ZFS
> RAID10 on only one disk and simulated a failing
> post-installation-webhook by stopping the web server that handles the
> POST request.
>
> The following scenarios rebooted because of successful execution:
>
> 1. `reboot_on_error = false`, successful auto install
> 2. `reboot_on_error = false`, successful post-installation-webhook
> 3. `reboot_on_error = true`, successful auto install
> 4. `reboot_on_error = true`, successful post-installation-webhook
>
> The following scenarios rebooted because of an error:
>
> 5. `reboot_on_error = true`, error during auto install
> 6. `reboot_on_error = true`, error during post-installation-webhook
>
> And the following scenarios dropped into the debug shell:
>
> 7. `reboot_on_error = false`, error during auto install
> 8. `reboot_on_error = false`, error during post-installation-webhook
>
> .../src/bin/proxmox-auto-installer.rs | 23 ++++++++-----------
> unconfigured.sh | 14 ++++++++---
> 2 files changed, 20 insertions(+), 17 deletions(-)
>
>
applied, thanks!
I made two small follow-ups, one added a bit more output for cases where the
auto-installer exited with a failure, and as it's only slightly tangentially
related to your patch, so saw no reason for a v3 there, and the other one,
which adds error handling for the flag-file creation, I noticed only after
having your change pushed.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
prev parent reply other threads:[~2025-02-24 15:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 15:28 [pve-devel] " Daniel Kral
2025-02-24 15:19 ` Thomas Lamprecht [this message]
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=715fdb41-01ea-4f7a-94ff-b7e6e1bbaac3@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.