generates grub.cfg with syntax error if GRUB_DISTRIBUTOR contains spaces

Bug #557606 reported by winux
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Fix Released
Medium
Colin Watson

Bug Description

Binary package hint: grub-pc

Hi

I'm on Ubuntu Lucid, version of April 4th

Actually, despite Ubuntu doc, I cannot change anything in the "start menu" line corresponding to Lucid start.

I wanted to have the "start menu" looking like this: Ubuntu 10.04 Lucid, Linux 2.6.32 ….
instead of: Ubuntu , Linux 2.6.32 …. (with no version #, what kind of Ubuntu is it, 9.10 - 10.04?)

So, as the doc says, in /etc/default/grub, I replaced
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
By
GRUB_DISTRIBUTOR=`echo -n $(lsb_release -cir 2> /dev/null || echo Debian)`
Then : sudo update-grub
And reboot

Big surprise: in the start menu the only thing remaining was "Windows Seven"!! a shame!

I've tried to investigate and did the following:
As previously, I changed the line in /etc/default/grub, but I did not replace "–i –s", I just added "-r" to it

That means that if you change anything behind the "-" argument, grub is lost and displays NOTHING regarding the current version.

I did the same thing in Karmic, but it worked. Hope you can fix this

Revision history for this message
Colin Watson (cjwatson) wrote :

You really do want to keep the -s in there, otherwise the results will not be what you wanted.

There seems to be a problem with spaces in GRUB_DISTRIBUTOR; the wrong thing ends up passed to --class as a result.

Revision history for this message
winux (g-vaquant) wrote :

I've also tried adding -s, otherwise, as you said, there's a lot of extra comments on the line.

To make sure I understand:

do you confirm this is a bug linked to a space problem in GRUB DISTRIBUTOR? In that case I stop trials waiting for bug correction

Otherwise if you know what to do so far, please just let me know

Have a nice day. BTW, this is a wonderful version

Revision history for this message
Colin Watson (cjwatson) wrote :

Yes, I'm pretty sure it's due to the space. Temporary workaround is to make this change to /etc/grub.d/10_linux:

  - CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]') ${CLASS}"
  + CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | cut -d' ' -f1) ${CLASS}"

(I've committed such a change upstream and will backport it for the next grub2 upload to Lucid.)

Changed in grub2 (Ubuntu):
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Colin Watson (cjwatson)
summary: - CANNOT CHANGE START MENU
+ generates grub.cfg with syntax error if GRUB_DISTRIBUTOR contains spaces
Revision history for this message
winux (g-vaquant) wrote : Re: [Bug 557606] Re: CANNOT CHANGE START MENU

OK I'll try again on the last version end this month

Thx

Gérard VAQUANT

2010/4/8 Colin Watson <email address hidden>

> Yes, I'm pretty sure it's due to the space. Temporary workaround is to
> make this change to /etc/grub.d/10_linux:
>
> - CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]')
> ${CLASS}"
> + CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | cut
> -d' ' -f1) ${CLASS}"
>
> (I've committed such a change upstream and will backport it for the next
> grub2 upload to Lucid.)
>
> ** Changed in: grub2 (Ubuntu)
> Status: New => Fix Committed
>
> ** Changed in: grub2 (Ubuntu)
> Importance: Undecided => Medium
>
> ** Changed in: grub2 (Ubuntu)
> Assignee: (unassigned) => Colin Watson (cjwatson)
>
> ** Summary changed:
>
> - CANNOT CHANGE START MENU
> + generates grub.cfg with syntax error if GRUB_DISTRIBUTOR contains spaces
>
> --
> generates grub.cfg with syntax error if GRUB_DISTRIBUTOR contains spaces
> https://bugs.launchpad.net/bugs/557606
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub2 - 1.98-1ubuntu4

---------------
grub2 (1.98-1ubuntu4) lucid; urgency=low

  * Only use the first word of GRUB_DISTRIBUTOR for --class, to avoid
    problems if somebody puts spaces in GRUB_DISTRIBUTOR (LP: #557606).
  * Probe all devices in 'grub-probe --target=drive' if
    /boot/grub/device.map is missing (LP: #549980).
  * Adjust hostdisk id for hard disks, allowing grub-setup to use its
    standard workaround for broken BIOSes (thanks to TJ for detailed
    investigation; LP: #555500).
 -- Colin Watson <email address hidden> Fri, 09 Apr 2010 09:46:44 +0100

Changed in grub2 (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.