[pve-devel] [PATCH pve-kernel-meta] proxmox-boot: trim /etc/kernel/cmdline before appending

Dominik Csapak d.csapak at proxmox.com
Wed Nov 10 15:28:22 CET 2021


comment inline

On 11/10/21 15:15, Stoiko Ivanov wrote:
> 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.
> 
> quickly tested on a VM.
> 
> [0]: https://forum.proxmox.com/threads/problem-with-proxmox-boot-tool.99043/
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
>   proxmox-boot/zz-proxmox-boot | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/proxmox-boot/zz-proxmox-boot b/proxmox-boot/zz-proxmox-boot
> index 52171b2..2356c74 100755
> --- a/proxmox-boot/zz-proxmox-boot
> +++ b/proxmox-boot/zz-proxmox-boot
> @@ -50,7 +50,7 @@ update_esps() {
>   	    exit 0
>   	fi
>   	if [ -f /etc/kernel/cmdline ]; then
> -		CMDLINE="$(cat /etc/kernel/cmdline)"
> +		CMDLINE="$(sed -re '/^\s*$/d;s/^\s+(\S*)\s+$/\1/g' /etc/kernel/cmdline)"

while the first  part of the regex looks good (delete all lines that 
only contain whitespace (or nothing), the second part will often not 
trigger since there is not *only* non-whitespace in the middle?

should it not be more like:

'^\s+(.*?)\s+$/\1/g' ?



>   	else
>   		warn "No /etc/kernel/cmdline found - falling back to /proc/cmdline"
>   		# remove initrd entries
> 





More information about the pve-devel mailing list