[pve-devel] [PATCH installer] btrfs: write /etc/kernel/cmdline unconditionally
Stoiko Ivanov
s.ivanov at proxmox.com
Tue Apr 8 21:18:06 CEST 2025
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 at 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
More information about the pve-devel
mailing list