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


Re: [Xen-users] PyGrub And Grub2 Submenus

To: Michael MacLeod <mikemacleod@xxxxxxxxx>
Subject: Re: [Xen-users] PyGrub And Grub2 Submenus
From: Pasi Kärkkäinen <pasik@xxxxxx>
Date: Thu, 21 Jul 2011 15:56:55 +0300
Cc: xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 21 Jul 2011 05:59:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <CAM-FeoGOaTVRTA6TZ8h3MQChmVoyt3f1FXKeXAFg4QC5u9UxwA@xxxxxxxxxxxxxx>
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>
References: <CAM-FeoGOaTVRTA6TZ8h3MQChmVoyt3f1FXKeXAFg4QC5u9UxwA@xxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-17)
On Thu, Jul 14, 2011 at 11:51:25AM -0400, Michael MacLeod wrote:
>    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
>        self.cf.parse(buf)
>      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)
>                    continue
>                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 {
>    <snip>
>    }
>    menuentry 'Ubuntu, with Linux 2.6.38-10-generic (recovery mode)' --class
>    ubuntu --class gnu-linux --class gnu --class os {
>    <snip>
>    }
>    submenu "Previous Linux versions" {
>    menuentry 'Ubuntu, with Linux 2.6.38-8-generic' --class ubuntu --class
>    gnu-linux --class gnu --class os {
>    <snip>
>    }
>    menuentry 'Ubuntu, with Linux 2.6.38-8-generic (recovery mode)' --class
>    ubuntu --class gnu-linux --class gnu --class os {
>    <snip>
>    }
>    }
>    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.

Feel free to contribute such a patch :)

-- Pasi

Xen-users mailing list

<Prev in Thread] Current Thread [Next in Thread>