* [pve-devel] [PATCH installer] auto: add some error context when loading the first-boot executable
@ 2025-04-08 9:06 Christoph Heiss
2025-04-08 9:23 ` Thomas Lamprecht
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Heiss @ 2025-04-08 9:06 UTC (permalink / raw)
To: pve-devel
At least to one user in the forum already ran into this IIRC, and most
recently Maximiliano too.
This can happen when e.g. copying example answer files with the
first-boot section, without then passing `--on-first-boot` to
proxmox-auto-install-assistant.
In that case, the user would just get a pretty unhelpful error message:
ERROR: Autoinstaller setup error: No such file or directory (os error 2)
Attach some context, which points the user directly to the corresponding
setting / answer file section.
Reported-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
proxmox-auto-installer/src/bin/proxmox-auto-installer.rs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/proxmox-auto-installer/src/bin/proxmox-auto-installer.rs b/proxmox-auto-installer/src/bin/proxmox-auto-installer.rs
index 05d1801..b248dff 100644
--- a/proxmox-auto-installer/src/bin/proxmox-auto-installer.rs
+++ b/proxmox-auto-installer/src/bin/proxmox-auto-installer.rs
@@ -1,4 +1,4 @@
-use anyhow::{Result, bail, format_err};
+use anyhow::{Context, Result, bail, format_err};
use log::{LevelFilter, error, info};
use std::{
env,
@@ -47,7 +47,9 @@ fn setup_first_boot_executable(first_boot: &FirstBootHookInfo) -> Result<()> {
}
}
FirstBootHookSourceMode::FromIso => {
- Some(fs::read(format!("/cdrom/{FIRST_BOOT_EXEC_NAME}"))?)
+ Some(fs::read(format!("/cdrom/{FIRST_BOOT_EXEC_NAME}")).context(
+ "failed loading first-boot executable from ISO (was --on-first-boot specified?)",
+ )?)
}
};
@@ -115,7 +117,7 @@ fn main() -> ExitCode {
let (answer, udevadm_info) = match auto_installer_setup(in_test_mode) {
Ok(result) => result,
Err(err) => {
- error!("Autoinstaller setup error: {err}");
+ error!("Autoinstaller setup error: {err:#}");
return ExitCode::FAILURE;
}
};
--
2.48.1
_______________________________________________
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
* Re: [pve-devel] [PATCH installer] auto: add some error context when loading the first-boot executable
2025-04-08 9:06 [pve-devel] [PATCH installer] auto: add some error context when loading the first-boot executable Christoph Heiss
@ 2025-04-08 9:23 ` Thomas Lamprecht
2025-04-08 9:29 ` Christoph Heiss
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Lamprecht @ 2025-04-08 9:23 UTC (permalink / raw)
To: Proxmox VE development discussion, Christoph Heiss
Am 08.04.25 um 11:06 schrieb Christoph Heiss:
> @@ -47,7 +47,9 @@ fn setup_first_boot_executable(first_boot: &FirstBootHookInfo) -> Result<()> {
> }
> }
> FirstBootHookSourceMode::FromIso => {
> - Some(fs::read(format!("/cdrom/{FIRST_BOOT_EXEC_NAME}"))?)
> + Some(fs::read(format!("/cdrom/{FIRST_BOOT_EXEC_NAME}")).context(
> + "failed loading first-boot executable from ISO (was --on-first-boot specified?)",
Definitively better than the status quo, but as user I would then ask
myself how I can pass that flag to the installer, so maybe word it
something like:
"failed loading first-boot executable from ISO (was ISO prepared with --on-first-boot specified?"
Or is this caught already earlier?
_______________________________________________
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
* Re: [pve-devel] [PATCH installer] auto: add some error context when loading the first-boot executable
2025-04-08 9:23 ` Thomas Lamprecht
@ 2025-04-08 9:29 ` Christoph Heiss
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Heiss @ 2025-04-08 9:29 UTC (permalink / raw)
To: Thomas Lamprecht; +Cc: Proxmox VE development discussion
On Tue Apr 8, 2025 at 11:23 AM CEST, Thomas Lamprecht wrote:
> Am 08.04.25 um 11:06 schrieb Christoph Heiss:
>
>> @@ -47,7 +47,9 @@ fn setup_first_boot_executable(first_boot: &FirstBootHookInfo) -> Result<()> {
>> }
>> }
>> FirstBootHookSourceMode::FromIso => {
>> - Some(fs::read(format!("/cdrom/{FIRST_BOOT_EXEC_NAME}"))?)
>> + Some(fs::read(format!("/cdrom/{FIRST_BOOT_EXEC_NAME}")).context(
>> + "failed loading first-boot executable from ISO (was --on-first-boot specified?)",
> Definitively better than the status quo, but as user I would then ask
> myself how I can pass that flag to the installer, so maybe word it
> something like:
>
> "failed loading first-boot executable from ISO (was ISO prepared with --on-first-boot specified?"
Definitively sounds better, especially when seeing it from that
perspective!
I tried to keep the message rather short at first, since it is printed
on one line currently. But we could also use "{err:#?}" as format
specifier below, to let anyhow break up the error message over multiple
lines.
I'll send a v2 shortly!
>
> Or is this caught already earlier?
No, currently not. But I already talked with Michael about more
extensive validation in the future, in both the auto-installer and
auto-install-assistant.
_______________________________________________
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-04-08 9:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-08 9:06 [pve-devel] [PATCH installer] auto: add some error context when loading the first-boot executable Christoph Heiss
2025-04-08 9:23 ` Thomas Lamprecht
2025-04-08 9:29 ` Christoph Heiss
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