From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id B181020EC91
	for <inbox@lore.proxmox.com>; Tue, 30 Apr 2024 11:54:04 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 2AA5C306B9;
	Tue, 30 Apr 2024 11:54:16 +0200 (CEST)
Message-ID: <c47a7a22-5dc4-44b7-a47b-5aecd4ae9e9d@proxmox.com>
Date: Tue, 30 Apr 2024 11:54:12 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Stefan Sterz <s.sterz@proxmox.com>
References: <20240430085434.86655-1-a.lauterer@proxmox.com>
 <D0XCWYADW8SQ.1W8HI4SD4J9NO@proxmox.com>
Content-Language: en-US
From: Aaron Lauterer <a.lauterer@proxmox.com>
In-Reply-To: <D0XCWYADW8SQ.1W8HI4SD4J9NO@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.044 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pve-devel] [PATCH 1/2] assistant: keep prepared iso bootable
 on uefi with flash drives
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>



On  2024-04-30  11:41, Stefan Sterz wrote:
> On Tue Apr 30, 2024 at 10:54 AM CEST, Aaron Lauterer wrote:
>> By mapping files into the ISO, the UUID for the partitions change as
>> they depend on the timestamp. The result is, that grub cannot find its
>> partition anymore and the user ends up on the grub shell.
>>
>> This only happens when booting from a blockdev in UEFI mode. E.g. a USB
>> flash drive. Alternatively one can `dd` the ISO to a small (2GiB) VM
>> disk and mark it as the first boot device.
>>
>> Booting in legacy mode or via CDROM (e.g. pass through via IPMI), it
>> worked.
>>
>> Xorriso can report the commands needed to recreate the source ISO. The
>> '-volume_date uuid' is the one needed to override the same UUIDs. We
>> therefore read it first from the source iso and pass it as parameter
>> whenever we inject a file into the iso.
>>
>> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
>> ---
>>   proxmox-auto-install-assistant/src/main.rs | 44 ++++++++++++++++++++--
>>   1 file changed, 41 insertions(+), 3 deletions(-)
>>
>>
>> +fn get_iso_uuid(iso: &PathBuf) -> Result<String> {
>> +    let result = Command::new("xorriso")
>> +        .arg("-dev")
>> +        .arg(iso)
>> +        .arg("-report_system_area")
>> +        .arg("cmd")
>> +        .output()?;
>> +    if !result.status.success() {
>> +        bail!(
>> +            "Error determining the UUID of the source ISO: {}",
>> +            String::from_utf8_lossy(&result.stderr)
>> +        );
>> +    }
>> +    let mut uuid = String::new();
>> +    for line in String::from_utf8(result.stdout)?.lines() {
>> +        if line.starts_with("-volume_date uuid") {
>> +            uuid = line
>> +                .split(' ')
>> +                .last()
>> +                .unwrap()
> 
> nit: while this probably won't happen, if xorriso ever starts returning
> nothing to the above command, this unwrap may panic. it might be nice to
> do a `ok_or_else(|| bail!("xorisso command behaved unexpectedly"))?` or
> similar here.

thanks. will send a v2
> 
>> +                .replace('\'', "")
>> +                .trim()
>> +                .into();
>> +            break;
>> +        }
>> +    }
>> +    Ok(uuid)
>> +}
>> +
>>   fn get_disks() -> Result<BTreeMap<String, BTreeMap<String, String>>> {
>>       let unwantend_block_devs = vec![
>>           "ram[0-9]*",
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel