* [pve-devel] [PATCH installer] fix #5984: unconfigured: do not reboot if auto-installer fails by default
@ 2024-12-11 16:14 Daniel Kral
2024-12-17 10:26 ` Christoph Heiss
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Kral @ 2024-12-11 16:14 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [pve-devel] [PATCH installer] fix #5984: unconfigured: do not reboot if auto-installer fails by default
2024-12-11 16:14 [pve-devel] [PATCH installer] fix #5984: unconfigured: do not reboot if auto-installer fails by default Daniel Kral
@ 2024-12-17 10:26 ` Christoph Heiss
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Heiss @ 2024-12-17 10:26 UTC (permalink / raw)
To: Daniel Kral; +Cc: Proxmox VE development discussion
Thanks for tackling this!
But this still doesn't really fix the issue by honoring the
`global.reboot_on_error` flag in any way, but just inverts the current
behaviour?
I.e. now it just always drops into the a shell, w/o ever auto-rebooting,
even if `global.reboot_on_error = true`.
This would need some sort of proper flag(-file) to indicate to
`unconfigured.sh` whether to reboot on errors in auto-installer mode or
not -- along the lines of that proxmox-auto-installer could e.g. touch
/run/proxmox-reboot-on-error if `reboot_on_error` is set and
unconfigured.sh can then just check for that files existence.
Same goes for when proxmox-post-hook fails, as the reboot is also
unconditional if that fails. Both should honor the flag set in the
answer file.
Waiting ~30s before auto-rebooting on errors is a good thing IMHO, so
I'd keep that.
On Wed Dec 11, 2024 at 5:14 PM CET, Daniel Kral wrote:
> [..]
> 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
Since the function is now called here directly, the shellcheck
`disable=SC2317` directive can now be removed from the function
definition above.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-17 10:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-11 16:14 [pve-devel] [PATCH installer] fix #5984: unconfigured: do not reboot if auto-installer fails by default Daniel Kral
2024-12-17 10:26 ` Christoph Heiss
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox