Bug 2102303

Summary: BLSCFG eats dollar sign $
Product: [Fedora] Fedora Reporter: Weiming Shan <willxshan>
Component: grub2Assignee: Javier Martinez Canillas <fmartine>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 36CC: fmartine, lkundrak, pgnet.dev, pjones, rharwood, sauter.fabian+redhatbugzilla, travier, work.eric
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-25 16:18:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Weiming Shan 2022-06-29 15:37:00 UTC
Description of problem:
I need to reserve memory with kernel parameter memmap=nn[KMG]$ss[KMG], 
(e.g. memmap=2048M$6144M).

I also tried adding backslash(s) '\' before '$' but no matter what I do, 
on boot the '$6144M' always gets eaten. 

I had to disable BLSCFG (GRUB_ENABLE_BLSCFG=false) 
and set GRUB_CMDLINE_LINUX='memmap=2048M\$6144M', 
then use grub2-mkconfig to create a new grub.cfg to get around the problem.


Version-Release number of selected component (if applicable):
GRUB 2.06

How reproducible:
Always

Steps to Reproduce:
1.Add args with grubby: "memmap=2048M\$6144M", number of '\' doesn't matter.
2.Reboot.
3.Enter 'e' to see the cmdline list. 

Actual results:
"memmap=2048M\" is shown.

Expected results:
"memmap=2048M\$6144M"

Additional info:

Comment 1 Eric Work 2022-09-05 07:49:18 UTC
Looking at the code it expects to expand some grub environment variable when following a dollar sign. Maybe you could somehow set a dummy variable that has the dollar sign and address to make it work.

Comment 2 Eric Work 2022-09-05 08:22:24 UTC
Following up on my previous comment I was able to get this working with BLS enabled.

First I needed to set a grubenv variable which is what blscfg is looking for when it encounters a dollar sign.

$ sudo grub2-editenv /boot/grub2/grubenv set memmap_val='4K\$0xb554ed000'
$ sudo grub2-editenv /boot/grub2/grubenv list
...
memmap_val=4K\$0xb554ed000
...

I then edited /etc/default/grub and changed it to:

GRUB_CMDLINE_LINUX="... memmap=\$memmap_val"

This finally resulted in the kernel cmdline:

$ cat /proc/cmdline 
BOOT_IMAGE=(hd2,gpt2)/vmlinuz-5.19.6-200.fc36.x86_64 ... memmap=4K$0xb554ed000

Confirming this worked as expected.

$ sudo cat /proc/iomem
...
100000000-b554ecfff : System RAM
b554ed000-b554edfff : Reserved
b554ee000-102f2fffff : System RAM
...

Comment 3 Ben Cotton 2023-04-25 17:31:08 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '36'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 4 Ludek Smid 2023-05-25 16:18:25 UTC
Fedora Linux 36 entered end-of-life (EOL) status on 2023-05-16.

Fedora Linux 36 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 5 Fabian Sauter 2025-04-18 14:12:08 UTC
For everyone in the future stumbling across this, I created a gist describing the workaround a bit better: https://gist.github.com/COM8/5084fdcc8afec5007c58c3b45cb2eaf3

Comment 6 Timothée Ravier 2025-08-29 09:53:35 UTC

*** This bug has been marked as a duplicate of bug 2362821 ***