all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer] btrfs: write /etc/kernel/cmdline unconditionally
@ 2025-04-08 19:18 Stoiko Ivanov
  2025-04-09  6:35 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2025-04-08 19:18 UTC (permalink / raw)
  To: pve-devel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH installer] btrfs: write /etc/kernel/cmdline unconditionally
  2025-04-08 19:18 [pve-devel] [PATCH installer] btrfs: write /etc/kernel/cmdline unconditionally Stoiko Ivanov
@ 2025-04-09  6:35 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-04-09  6:35 UTC (permalink / raw)
  To: pve-devel, Stoiko Ivanov

On Tue, 08 Apr 2025 21:18:06 +0200, Stoiko Ivanov wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] btrfs: write /etc/kernel/cmdline unconditionally
      commit: 268783c3e8f07dd6a30a8fdc18038a5f2681503d


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-09  6:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-08 19:18 [pve-devel] [PATCH installer] btrfs: write /etc/kernel/cmdline unconditionally Stoiko Ivanov
2025-04-09  6:35 ` [pve-devel] applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal