Xen 
 
Home About Xen.org Xen Xen Summit Wiki Mailing List Bug Tracker Xen Downloads
 
   
 

xen-users

Re: [Xen-users] Problems with pygrub: ValueError: unable to open file

To: Michael Paesold <mpaesold@xxxxxx>
Subject: Re: [Xen-users] Problems with pygrub: ValueError: unable to open file
From: Michael Paesold <mpaesold@xxxxxx>
Date: Thu, 30 Mar 2006 20:47:45 +0200
Cc: Xen Users <xen-users@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 30 Mar 2006 18:49:23 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <011601c64eb4$39a8a030$0f01a8c0@zaphod>
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/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <011601c64eb4$39a8a030$0f01a8c0@zaphod>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5 (Windows/20051201)
I wrote:
I am currently struggling with getting pygrub to work. I am using unstable
9327:cf89e8f0831b with 2.6.16-rc6-git3 on CentOS 4 (although the kernel
version should not matter here).
...

Traceback (most recent call last):
 File "/root/pygrub", line 258, in ?
   cf = get_config(file, isconfig)
 File "/root/pygrub", line 121, in get_config
   fs = fstype.open_fs(fn, offset)
 File "/usr/lib/python2.3/site-packages/grub/fsys/ext2/__init__.py", line
35, in open_fs
   return Ext2Fs(fn, offset = offset)
ValueError: unable to open file
Error: Boot loader didn't return any data!

I checked the values of fn and offset:
fn = /dev/sdb1
offset = 512

This seems perfectly ok, considering the output of fdisk:
...

Well, after further investigation, the problem is that the CentOS/RHEL 4
version of e2fsprogs does not have a ext2fs_open2 that allows to use the
offset. The "bug" is that this is not reported at all.

    if (offset != 0) {
        snprintf(offsetopt, 29, "offset=%d", offset);
    }

#ifdef HAVE_EXT2FS_OPEN2
    err = ext2fs_open2(name, offsetopt, flags, superblock, block_size,
                       unix_io_manager, &efs);
#else
    err = ext2fs_open(name, flags, superblock, block_size,
                      unix_io_manager, &efs);
#endif


Here, HAVE_EXT2FS_OPEN2 is not defined. An offset cannot be used if ext2fs_open2 is not available. Does anyone see a way to work around this issue other than either update e2fsprogs or otherwise teach pygrub to use devicemapper or similar to be able to open an ext2 filesystem in a partition that is not directly accessible to the host (e.g. in a partitioned image)?

Best Regards,
Michael Paesold

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users