all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [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; 3+ 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] 3+ messages in thread

end of thread, other threads:[~2025-01-08 15:27 UTC | newest]

Thread overview: 3+ 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
2025-01-08 15:26   ` Daniel Kral

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal