bugGNU GRUB - Bugs: bug #21865, grub.cfg syntax error leads to...


You are not allowed to post comments on this tracker with your current authentication level.

bug #21865: grub.cfg syntax error leads to infinite loop

Submitted by:  Robert Millan <robertmh>
Submitted on:  Fri 21 Dec 2007 12:03:11 PM UTC  
Category:  None Severity:  Major
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Closed Release:  CVS
Release:  None Reproducibility:  None
Planned Release:  None

( Jump to the original submission)

Fri 08 Feb 2008 04:30:21 PM UTC, comment #6: 

This was fixed by Bean a while ago.  Just update your GRUB (by running grub-install).

Robert Millan <robertmh>
Project Administrator
Fri 08 Feb 2008 02:04:41 PM UTC, comment #5: 

During a recent Debian apt-get upgrade on 'Lenny', noted Grub2 was to be upgraded to 1.96.  The upgrade completed without warnings or errors (including postinst update-grub).  When the machine was rebooted it went into a loop with the following errors;

'Syntax error'
'Incorrect command'

Attempted to fix it by booting from the Stable Netinst CD. Mounted /dev/hda on / and /usr, looked at /boot/grub/grub.cfg and saw new lines referring to Debian graphics and a new file in /etc/grub.d named 05_debian_graphics (or some such thing).  Renamed /etc/grub.d/05_debian_whatever and successfully ran '#>update-grub' yet the above errors returned on reboot.

Michael D. Norwick
-email is unavailable-

michael norwick <mnorwick>
Sat 02 Feb 2008 08:41:50 PM UTC, comment #4: 

Bean fixed this.  Closing...

Robert Millan <robertmh>
Project Administrator
Sat 22 Dec 2007 07:07:27 PM UTC, comment #3: 

I write a patch for parser related bug, it fix the following problems:

1, major modification for parse.y, now it should work better. For example,

if echo aa; echo bb; then echo cc; fi

it works properly now.

2, Check for undefined variable. for example, if AA is not defined,

echo $AA

caused problem in the old version. Now it shows blank line.

3, This following commands:

function aa { echo bb; }


error: unknown command `aa'

Now it is ok.

4, If an command return error in grub.cfg, the following content is not parsed, for example

test A=B
menuentry aa {
 set root=(hd0,1)
 chainloader +1

The menu is not parsed as test A=B set errno to 1.

This bug can be quite tricky, for example, i remember someone report that update-grub has problem as the menu is not showed at all, but in fact, the problem is caused by the font command.

5, echo module not included in command.lst
yes, this is problem is very old, but nobody seems to be fixing it.

(file #14684)

Bean <bean>
Sat 22 Dec 2007 10:47:14 AM UTC, comment #2: 

Do you know how to do this?  I'm afraid I'm completely ignorant on bison stuff.

Robert Millan <robertmh>
Project Administrator
Sat 22 Dec 2007 06:46:37 AM UTC, comment #1: 

yes, i know this bug, it's caused by the syntax rules in parser.y, i think it's here:

commands: ...
          | error
    yyerror (state, "Incorrect command");
    state->err = 1;

error is not shifted, so it's occurring over and over again.

Bean <bean>
Fri 21 Dec 2007 12:03:11 PM UTC, original submission:  

As reported by Luca Capello in Debian BTS:

The following grub.cfg menuentry has a syntax error.  However, grub won't display an error message and let you continue.  Instead, it will start an infin loop, rendering the machine unbootable:

  menuentry "test" { $ }

Robert Millan <robertmh>
Project Administrator


Attached Files
file #14684:  grub2-parser-new.diff added by bean (6KiB - application/octet-stream - Patch to fix parser related problems)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mnorwick (Posted a comment)
  • -email is unavailable- added by bean (Posted a comment)
  • -email is unavailable- added by robertmh (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-02-02 robertmh Open/ClosedOpen => Closed
    2007-12-22 bean Attached File- => Added grub2-parser-new.diff, #14684

    Back to the top

    Powered by Savane 3.6