This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-users] PyGrub And Grub2 Submenus

To: xen-users@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-users] PyGrub And Grub2 Submenus
From: Michael MacLeod <mikemacleod@xxxxxxxxx>
Date: Thu, 14 Jul 2011 11:51:25 -0400
Delivery-date: Thu, 14 Jul 2011 08:53:12 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=qa92A/WZFnbo0Udg6E2C8c8hI8ZB5Ch4WhhlRdv4qPI=; b=erV+x4LuFPOHWLkwkvqSizaGxDX5/T0nxeRgIKnbYSoJEOpmgAG9j06I/0I8dBgg68 HmDu7molR3JFDW7RtuG5ksOnJwLJhMWcSsrC1MSPJqGCsiVs9p70Q570KhfMuzcUBkOc WZd+8Tt5nrQUyEL/yd6B/MmOuLXIjiWJDJiPk=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
I recently updated the kernel on an Ubuntu 11.04 PVM domU. The dom0 is an up to date Debian Squeeze host (Xen 4.0.1). Attempting to start the domU after this with xm create gives "Error: Boot loader didn't return any data!". I ran pygrub against the domU manually, I got the following:
Traceback (most recent call last):
  File "/usr/lib/xen-default/bin/pygrub", line 669, in <module>
    chosencfg = run_grub(file, entry, fs, incfg["args"])
  File "/usr/lib/xen-default/bin/pygrub", line 549, in run_grub
    g = Grub(file, fs)
  File "/usr/lib/xen-default/bin/pygrub", line 205, in __init__
    self.read_config(file, fs)
  File "/usr/lib/xen-default/bin/pygrub", line 413, in read_config
  File "/usr/lib/xen-4.0/bin/../lib/python/grub/GrubConf.py", line 400, in parse
    raise RuntimeError, "syntax error: closing brace without menuentry"
RuntimeError: syntax error: closing brace without menuentry

Looking at GrubConf.py, around line 400 we have this bit of logic:
            title_match = re.match('^menuentry ["\'](.*)["\'] (.*){', l)
            if title_match:
                if img is not None:
                    raise RuntimeError, "syntax error: cannot nest menuentry (%d %s)" % (len(img),img)
                img = []
                title = title_match.group(1)
            if l.startswith("}"):
                if img is None:
                    raise RuntimeError, "syntax error: closing brace without menuentry"

Looking at the grub.cfg, I see the following section:
menuentry 'Ubuntu, with Linux 2.6.38-10-generic' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry 'Ubuntu, with Linux 2.6.38-10-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
submenu "Previous Linux versions" {
menuentry 'Ubuntu, with Linux 2.6.38-8-generic' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry 'Ubuntu, with Linux 2.6.38-8-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {

Note that this grub.cfg contains a submenu entry. I'm not particular familiar with python, but it appears that GrubConf.py checks all lines with a closing bracket for a matching menuentry line, and this submenu causes that check to fail. There's also the error about nesting menuentries, but I see not logic for matching against a submenu. The workaround is to remove the submenu and it's closing bracket from the grub.cfg, but the fix would be to add support for submenus to pygrub.

Xen-users mailing list
<Prev in Thread] Current Thread [Next in Thread>