[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] PyGrub And Grub2 Submenus

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



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.