[pve-devel] [PATCH v3 kernel-meta] fix #2403: exclude initrd entries from /proc/cmdline

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Nov 7 20:43:17 CET 2019


On 10/16/19 1:17 PM, Oguz Bektas wrote:
> if we fallback to /proc/cmdline, it can include the booted initrd.
> 
> to avoid loader entries with initrd 'options' lines, we have to parse
> them out.
> 
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
> 
> v2->v3:
> * match forward slashes
> * match underscore
> * match zero or more whitespace at the end
> 
>  efiboot/zz-pve-efiboot | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/efiboot/zz-pve-efiboot b/efiboot/zz-pve-efiboot
> index 4756555..8771da9 100755
> --- a/efiboot/zz-pve-efiboot
> +++ b/efiboot/zz-pve-efiboot
> @@ -50,7 +50,8 @@ update_esps() {
>  		CMDLINE="$(cat /etc/kernel/cmdline)"
>  	else
>  		warn "No /etc/kernel/cmdline found - falling back to /proc/cmdline"
> -		CMDLINE="$(cat /proc/cmdline)"
> +		# remove initrd entries
> +		CMDLINE="$(awk '{gsub(/\yinitrd=([0-9a-zA-Z\/\\._-])*\s*/,x)}1' /proc/cmdline)"

sooo, this does not works at all with the default installed mawk...
Only with gnu awk, which one may get fast installed on a developer
workstation... :/ So we all did not test clean environments..

it seems mawk has no word boundary regexp[0], soo either we depend on gawk
or we find a way were it works with mawk.. 

[0]: https://mail-index.netbsd.org/tech-userlevel/2012/12/02/msg006954.html

>  	fi
>  
>  	loop_esp_list update_esp_func
> 





More information about the pve-devel mailing list