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.k...@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