大网数据广告活动
服务器运维问答

Grub incorrectly escapes $ character in its settings

· 52CE 我爱测

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 str…

问题原文

原帖链接 · expert · CC BY-SA 4.0

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 · CC BY-SA 4.0

@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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-02-22)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。