public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer] auto: add some error context when loading the first-boot executable
Date: Tue,  8 Apr 2025 11:06:08 +0200	[thread overview]
Message-ID: <20250408090614.223392-1-c.heiss@proxmox.com> (raw)

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


             reply	other threads:[~2025-04-08  9:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08  9:06 Christoph Heiss [this message]
2025-04-08  9:23 ` Thomas Lamprecht
2025-04-08  9:29   ` Christoph Heiss

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=20250408090614.223392-1-c.heiss@proxmox.com \
    --to=c.heiss@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 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