[Pkg-xen-devel] Bug#599243: xen-utils-4.0: pygrub does not understand grub2 partition types (e.g. (hd0, msdos1) instead of (hd0, 1))

Hal Finkel half at halssoftware.com
Wed Oct 6 04:01:28 UTC 2010


Package: xen-utils-4.0
Version: 4.0.1-1
Severity: normal
Tags: patch


pygrub could not boot a newly-updated Debian/testing domU with a non-chained grub2. The traceback was:
Using <class 'grub.GrubConf.Grub2ConfigFile'> to parse /grub/grub.cfg
WARNING:root:Unknown directive load_video
WARNING:root:Unknown directive terminal_output
Traceback (most recent call last):
  File "/usr/lib/xen-4.0/bin/pygrub", line 669, in <module>
    chosencfg = run_grub(file, entry, fs, incfg["args"])
  File "/usr/lib/xen-4.0/bin/pygrub", line 549, in run_grub
    g = Grub(file, fs)
  File "/usr/lib/xen-4.0/bin/pygrub", line 205, in __init__
    self.read_config(file, fs)
  File "/usr/lib/xen-4.0/bin/pygrub", line 413, in read_config
    self.cf.parse(buf)
  File "/usr/lib/xen-4.0/lib/python/grub/GrubConf.py", line 400, in parse
    self.add_image(Grub2Image(title, img))
  File "/usr/lib/xen-4.0/lib/python/grub/GrubConf.py", line 316, in __init__
    _GrubImage.__init__(self, title, lines)
  File "/usr/lib/xen-4.0/lib/python/grub/GrubConf.py", line 85, in __init__
    self.reset(lines)
  File "/usr/lib/xen-4.0/lib/python/grub/GrubConf.py", line 101, in reset
    self._parse(lines)
  File "/usr/lib/xen-4.0/lib/python/grub/GrubConf.py", line 96, in _parse
    map(self.set_from_line, lines)
  File "/usr/lib/xen-4.0/lib/python/grub/GrubConf.py", line 326, in set_from_line
    setattr(self, self.commands[com], arg.strip())
  File "/usr/lib/xen-4.0/lib/python/grub/GrubConf.py", line 104, in set_root
    self._root = GrubDiskPart(val)
  File "/usr/lib/xen-4.0/lib/python/grub/GrubConf.py", line 55, in __init__
    (self.disk, self.part) = str.split(",", 2)
  File "/usr/lib/xen-4.0/lib/python/grub/GrubConf.py", line 80, in set_part
    self._part = int(val)
ValueError: invalid literal for int() with base 10: 'msdos1'

Newer versions of grub2 support the use of named partition types (such as msdos1),
and pygrub needs to deal with these (since the Debian scripts now generate device
specifications with named partition types).

A simple way to fix this, at least for msdos partitions, is:
--- GrubConf.py.orig	2010-08-29 11:13:20.000000000 -0400
+++ GrubConf.py	2010-10-05 23:27:57.000000000 -0400
@@ -76,7 +76,7 @@
         if val is None:
             self._part = val
             return
-        val = val.replace("(", "").replace(")", "")
+        val = val.replace("(", "").replace(")", "").replace("msdos", "")
         self._part = int(val)
     part = property(get_part, set_part)


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-xen-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages xen-utils-4.0 depends on:
ii  e2fslibs                1.41.12-2        ext2/ext3/ext4 file system librari
ii  iproute                 20100519-3       networking and traffic control too
ii  libc6                   2.11.2-6         Embedded GNU C Library: Shared lib
ii  libncurses5             5.7+20100313-4   shared libraries for terminal hand
ii  libxenstore3.0          4.0.1-1          Xenstore communications library fo
ii  python-support          1.0.10           automated rebuilding support for P
ii  python2.5               2.5.5-8          An interactive high-level object-o
ii  udev                    160-1            /dev/ and hotplug management daemo
ii  xen-utils-common        4.0.0-1          XEN administrative tools - common 
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

Versions of packages xen-utils-4.0 recommends:
ii  bridge-utils                  1.4-5      Utilities for configuring the Linu
ii  xen-hypervisor-4.0-amd64 [xen 4.0.1-1    The Xen Hypervisor on AMD64

Versions of packages xen-utils-4.0 suggests:
pn  xen-docs-4.0                  <none>     (no description available)

-- no debconf information





More information about the Pkg-xen-devel mailing list