public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-kernel-meta v2] proxmox-boot: read only first line of /etc/kernel/cmdline
@ 2021-11-10 15:25 Stoiko Ivanov
  2021-11-11 10:21 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2021-11-10 15:25 UTC (permalink / raw)
  To: pve-devel

following the commit of removing the wrong indentation of the linux
and initrd lines - this commit strips empty lines (and leading
trailing whitespace) in /etc/kernel/cmdline.

I managed to reproduce the issue reported in the forum [0] by adding
empty lines to /etc/kernel/cmdline) - without this - systemd-boot
booted quite happily even with the indentation.

considered using perl -pe with multiline matching but thanks to
Thomas' suggestion went with the shell-builtin read.

the check for existance of 'root=' in the resulting CMDLINE was added,
since my test-system had an empty line in the beginning, which again
rendered it unbootable.

quickly tested on a VM.

[0]: https://forum.proxmox.com/threads/problem-with-proxmox-boot-tool.99043/

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
v1->v2:
* incorporated Dominik and Thomas' feedback (huge thanks for catching my
glitches!)

 proxmox-boot/zz-proxmox-boot | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/proxmox-boot/zz-proxmox-boot b/proxmox-boot/zz-proxmox-boot
index 52171b2..26a9e7e 100755
--- a/proxmox-boot/zz-proxmox-boot
+++ b/proxmox-boot/zz-proxmox-boot
@@ -50,7 +50,9 @@ update_esps() {
 	    exit 0
 	fi
 	if [ -f /etc/kernel/cmdline ]; then
-		CMDLINE="$(cat /etc/kernel/cmdline)"
+		read -r CMDLINE < /etc/kernel/cmdline
+		echo ${CMDLINE} | grep -q 'root=' || \
+			{ warn "No root= parameter in /etc/kernel/cmdline found!"; exit 1; }
 	else
 		warn "No /etc/kernel/cmdline found - falling back to /proc/cmdline"
 		# remove initrd entries
-- 
2.30.2





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

end of thread, other threads:[~2021-11-11 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 15:25 [pve-devel] [PATCH pve-kernel-meta v2] proxmox-boot: read only first line of /etc/kernel/cmdline Stoiko Ivanov
2021-11-11 10:21 ` [pve-devel] applied: " Thomas Lamprecht

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