2

Not sure where I make mistake but I can't escape $ correctly in /etc/default/grub. I'm on Ubuntu MATE 18.04. This is what I do:

In console I edit confid by calling

sudo mcedit /etc/default/grub

I add memmap parameter so that string look like this

GRUB_CMDLINE_LINUX_DEFAULT="quiet memmap=3M\$11992M"

And follow this by invoking sudo update-grub. When I restart my system it hangs on boot. Going into grub settings editor from boot menu shows me linux param string that looks like

quiet memmap=3M$11992M

Note lack of backslash. If I press F10 to boot it hangs again. So I restart again and edit in boot editor this string to

quiet memmap=3M\$11992M

and then after pressing F10 it boots. So it almost feels like settings file gets unescaped twice.

What am I missing ?

expert
  • 322
  • 1
  • 3
  • 13
  • 1
    Does the "single quote trick" as described in [grub2: needed (undocumented) character escape for kernel parameters](https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/445952/comments/6) work? – Freddy Feb 22 '19 at 12:54

2 Answers2

1

Just a note for any newcomer like myself.

I am working on Fedora 36 and by default GRUB2 uses BootLoaderSpec(BLS). BLS uses blscfg command to read a .conf file in /boot/loader/entries/. It seems that $ is always eaten by blscfg regardless how many \ you add before it.

So for @expert's solution to work, disable BLS by setting GRUB_ENABLE_BLSCFG=false in /etc/default/grub, then generate a new grub.cfg by grub2-mkconfig -o /boot/grub2/grub.cfg

W.S
  • 11
  • 2
  • Update: workaround using BLSCFG https://bugzilla.redhat.com/show_bug.cgi?id=2102303 – W.S Sep 09 '22 at 19:02
1

@freddy Correctly pointed out I could use single-quote. But before I read this reply I managed to fix the problem by typing

quiet memmap=3M\\\$11992M

Looks like grub unescapes the string twice.

expert
  • 322
  • 1
  • 3
  • 13