public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer] btrfs: write /etc/kernel/cmdline unconditionally
Date: Tue,  8 Apr 2025 21:18:06 +0200	[thread overview]
Message-ID: <20250408191806.2410107-1-s.ivanov@proxmox.com> (raw)

the recent change of handing the ESPs to proxmox-boot-tool broke
installation on btrfs booted with systemd-boot (currently efi-systems
without secureboot). our systemd-boot config-generation takes the
kernel commandline from /etc/kernel/cmdline - without this there is no
root= parameter, and we end up in a initramfs shell.

write the file unconditionally of boot-mode (legacy, efi,
efi-secureboot), to be consistent with the way we do it on ZFS.

the uuid is stored in a variable instead of running blkid multiple
time primarily to not end up with different versions of a similar
command in the future, at the expense of 3 change-sites which are
quite far apart.

Fixes: dc5b8d7 ("btrfs: use proxmox-boot-tool to sync ESPs for RAID installs")
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
tested minimally with a vm with a single disk booted with a efi-disk without
enrolled keys - as this is what broke for me.

 Proxmox/Install.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index cb6c502..f673604 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -751,6 +751,7 @@ sub extract_data {
 
     my ($swapfile, $rootdev, $datadev);
     my ($use_zfs, $use_btrfs) = (0, 0);
+    my $btrfs_uuid;
 
     my $filesys = Proxmox::Install::Config::get_filesys();
     my $hdsize = Proxmox::Install::Config::get_hdsize();
@@ -1125,6 +1126,9 @@ sub extract_data {
 
 	    die "unable to detect FS UUID" if !defined($fsuuid);
 
+	    # needed for /etc/kernel/cmdline when making the system bootable.
+	    $btrfs_uuid = $fsuuid;
+
 	    my $btrfs_opts = Proxmox::Install::Config::get_btrfs_opt();
 
 	    my $mountopts = 'defaults';
@@ -1333,6 +1337,11 @@ _EOD
 	    file_write_all("$targetdir/etc/kernel/cmdline", "root=ZFS=$zfs_pool_name/ROOT/$zfs_root_volume_name boot=zfs $target_cmdline\n");
 	}
 
+	if ($use_btrfs) {
+	    # add root= option to /etc/kernel/cmdline as well (for systemd-boot+btrfs)
+	    file_write_all("$targetdir/etc/kernel/cmdline", "root=UUID=$btrfs_uuid $target_cmdline\n");
+	}
+
 	# Always write zfs module parameter - even if the user did not select ZFS-on-root.
 	# It still makes sense to provide a sensible default for zfs_arc_max, in case a
 	# separate zfs pool is created afterwards.
-- 
2.39.5



_______________________________________________
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 19:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08 19:18 Stoiko Ivanov [this message]
2025-04-09  6:35 ` [pve-devel] applied: " Thomas Lamprecht

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=20250408191806.2410107-1-s.ivanov@proxmox.com \
    --to=s.ivanov@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