Comment 6 for bug 445952

Revision history for this message
Jean-Louis (jean-louis) wrote : Re: grub2 does not work with kernel comandline arguments containing spaces

jean-louis@desktop:~$ apt-show-versions | grep grub
grub-common 1.97~beta4-1ubuntu5 newer than version in archive
grub-pc 1.97~beta4-1ubuntu5 newer than version in archive

jean-louis@desktop:~$ uname -a
Linux desktop 2.6.31-21-generic #59-Ubuntu SMP Wed Mar 24 07:28:56 UTC 2010 i686 GNU/Linux

Hi, sorry for my bad english.

I have similar problem: due to bad ram, I have to start my kernel with memmap parameter;
in accordance with kernel-parameters.txt, the exact string is (in my case) memmap=64k$0x24190000

if I put in /etc/default/grub:
  GRUB_CMDLINE_LINUX="memmap=64$0x24190000"
or press the 'e' (edit) button after boot and add manually:
  memmap=64$0x24190000
the pc don't boots and show only a blinking cursor...

instead if I put in /etc/default/grub:
 GRUB_CMDLINE_LINUX="memmap=64\\\$0x24190000"
or press the 'e' (edit) button after boot and add manually:
  memmap=64\$0x24190000
the pc boots correctly.

if I press F6 in cd live and add kernel parameter:
  memmap=64$0x24190000
the pc boots correctly.

There are 2 differents, but similar, problems:

[1]

if I put in /etc/default/grub:
  GRUB_CMDLINE_LINUX="memmap=64$0x24190000"

jean-louis@desktop:~$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-21-generic
Found initrd image: /boot/initrd.img-2.6.31-21-generic
done

jean-louis@desktop:~$ cat /boot/grub/grub.cfg | grep vmlinuz
 linux /vmlinuz-2.6.31-21-generic root=UUID=e1b91314-5934-4c3e-ab0a-a2137ac93a91 ro memmap=64/usr/sbin/grub-mkconfigx24190000 quiet splash
 linux /vmlinuz-2.6.31-21-generic root=UUID=e1b91314-5934-4c3e-ab0a-a2137ac93a91 ro single memmap=64/usr/sbin/grub-mkconfigx24190000

the problem [1] is that GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT is "expanded" without a reason...

for solve this problem, enclose those variable inside single-quote rather than double-quote

GRUB_CMDLINE_LINUX_DEFAULT='quiet splash'
GRUB_CMDLINE_LINUX='memmap=64$0x24190000'

(if kernel parameters require quote, use duble-quote: i.e.
 GRUB_CMDLINE_LINUX='acpi_osi="!Windows 2006" memmap=64$0x24190000'
)

jean-louis@desktop:~$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-21-generic
Found initrd image: /boot/initrd.img-2.6.31-21-generic
done

jean-louis@desktop:~$ cat /boot/grub/grub.cfg | grep vmlinuz
 linux /vmlinuz-2.6.31-21-generic root=UUID=e1b91314-5934-4c3e-ab0a-a2137ac93a91 ro memmap=64$0x24190000 quiet splash
 linux /vmlinuz-2.6.31-21-generic root=UUID=e1b91314-5934-4c3e-ab0a-a2137ac93a91 ro single memmap=64$0x24190000

now grub.cfg is correct, but pc don't boot due to problem 2

[2] (there is also when manually edits kernel parameter after boot)

if the parser find $ or " change state, but this don't have meaning for kernel parameters.

I have single-quoted the parameters of command 'linux' all together (except kernel name), because the initial parser must don't touch those parameters

for version 1.97~beta4-1ubuntu5 (karmic-proposed)

edit /etc/grub.d/10_linux search:

linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2

and replace with:

linux ${rel_dirname}/${basename} 'root=${linux_root_device_thisversion} ro $2'

jean-louis@desktop:~$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-21-generic
Found initrd image: /boot/initrd.img-2.6.31-21-generic
done

jean-louis@desktop:~$ cat /boot/grub/grub.cfg | grep vmlinuz
 linux /vmlinuz-2.6.31-21-generic 'root=UUID=e1b91314-5934-4c3e-ab0a-a2137ac93a91 ro memmap=64$0x24190000 quiet splash'
 linux /vmlinuz-2.6.31-21-generic 'root=UUID=e1b91314-5934-4c3e-ab0a-a2137ac93a91 ro single memmap=64$0x24190000'

now works!

this solve also the acpi_osi="!Windows 2006" and quoted string in general (duble-quoted)

for lucid file 10_linux is little different, but the solution is similar (don't tested)

search:

linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}

replace with

linux ${rel_dirname}/${basename} 'root=${linux_root_device_thisversion} ro ${args}'