Bug 577511 - Grub2 guest support for RHEL5 Xen pygrub
Grub2 guest support for RHEL5 Xen pygrub
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: xen (Show other bugs)
5.5
All Linux
low Severity medium
: rc
: ---
Assigned To: Michal Novotny
Virtualization Bugs
:
Depends On:
Blocks: 514499
  Show dependency treegraph
 
Reported: 2010-03-27 13:53 EDT by Pasi Karkkainen
Modified: 2014-11-11 11:10 EST (History)
8 users (show)

See Also:
Fixed In Version: xen-3.0.3-111.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-01-13 17:21:08 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Grub2 support for pyGrub (14.38 KB, patch)
2010-03-31 05:34 EDT, Michal Novotny
no flags Details | Diff
Grub2 support for pyGrub with c/s 21188 (14.60 KB, patch)
2010-04-19 05:22 EDT, Michal Novotny
no flags Details | Diff
New version of my patch (19.00 KB, patch)
2010-05-26 06:51 EDT, Michal Novotny
no flags Details | Diff

  None (edit)
Description Pasi Karkkainen 2010-03-27 13:53:21 EDT
Description of problem:
pygrub in RHEL5 Xen only supports PV guests using grub1 config files.
Distributions like Ubuntu have been already using grub2 on multiple distro releases, and Debian is changing to Grub2 for their next 6.0 "Squeeze" release. Fedora is planning to switch to grub2 aswell.

Upstream Xen 4.0.0 pygrub supports Grub2 config file formats. 
Grub2 pygrub support should be backported to RHEL5 pygrub.

Version-Release number of selected component (if applicable):
Xen pygrub in RHEL5.4 and 5.5 beta.

How reproducible:
Always.

Steps to Reproduce:
1. Install RHEL5 Xen dom0
2. Install a PV guest using Grub2
3. Try to boot it using pygrub
  
Actual results:
pygrub fails to parse guest grub2 config.

Expected results:
pygrub is able parse guest grub2 cfgfile and boot the guest.

Additional info:
Comment 2 Michal Novotny 2010-03-31 04:00:51 EDT
(In reply to comment #0)
> Description of problem:
> pygrub in RHEL5 Xen only supports PV guests using grub1 config files.
> Distributions like Ubuntu have been already using grub2 on multiple distro
> releases, and Debian is changing to Grub2 for their next 6.0 "Squeeze" release.
> Fedora is planning to switch to grub2 aswell.
> 
> Upstream Xen 4.0.0 pygrub supports Grub2 config file formats. 
> Grub2 pygrub support should be backported to RHEL5 pygrub.
> 
> Version-Release number of selected component (if applicable):
> Xen pygrub in RHEL5.4 and 5.5 beta.
> 
> How reproducible:
> Always.
> 
> Steps to Reproduce:
> 1. Install RHEL5 Xen dom0
> 2. Install a PV guest using Grub2
> 3. Try to boot it using pygrub
> 
> Actual results:
> pygrub fails to parse guest grub2 config.
> 
> Expected results:
> pygrub is able parse guest grub2 cfgfile and boot the guest.
> 
> Additional info:    

Pasi, where can I get PV guest installer for Ubuntu or any other distro using Grub2 by default? I did try to download it but it's HVM guest only.

Michal
Comment 3 Michal Novotny 2010-03-31 05:34:31 EDT
Created attachment 403682 [details]
Grub2 support for pyGrub

This is the backport of xen-unstable c/s 20485, 20486, 20487, 20858, 21002 and 21033 but like stated in comment above, I don't know where to get any PV guest that would be using Grub2 configuration by default but I did try to test it using the HVM guest and comparing the kernel and ramdisk file size and contents transferred via SSH to those that were automatically extracted by pygrub utility. The sizes were the same and diff-ing those files shows that the files are the same so it should be working but I can't be sure until I have the option to test it using any PV guest that uses Grub2 bootloader.

Michal
Comment 4 Pasi Karkkainen 2010-03-31 07:26:37 EDT
Thanks!

I'm busy right now, but I'll get back to you and provide an image that can be used for testing.
Comment 5 Michal Novotny 2010-03-31 07:35:31 EDT
(In reply to comment #4)
> Thanks!
> 
> I'm busy right now, but I'll get back to you and provide an image that can be
> used for testing.    

Ok, great, it will be necessary for testing because I don't know where to get PV image using Grub2 bootloader.

Michal
Comment 6 Michal Novotny 2010-04-01 06:34:14 EDT
Pasi, could you please provide me some information where to download those PV images or what location to install from?

Thanks,
Michal
Comment 7 Den Ivanov 2010-04-15 02:56:48 EDT
Try this:

virt-install --name=grub2 --paravirt --location=http://ftp.us.debian.org/debian/dists/squeeze/main/installer-amd64/ --disk path=/dev/srv112/vm-grub2 --nographics --ram=512
Comment 8 Michal Novotny 2010-04-19 05:22:25 EDT
Created attachment 407518 [details]
Grub2 support for pyGrub with c/s 21188

(In reply to comment #7)
> Try this:
> 
> virt-install --name=grub2 --paravirt
> --location=http://ftp.us.debian.org/debian/dists/squeeze/main/installer-amd64/
> --disk path=/dev/srv112/vm-grub2 --nographics --ram=512    

Ok. I did install this version of Xen but also I added unstable c/s 21188 which is about Grub2 configuration matching for both grub2 version used in Ubuntu 10.04 and previous versions so this one is good to have as well.

Before my patch applied, it was returning error that bootloader (grub2) didn't return any data but now it's not returning an error and it's booting the system. Current version of my patch, including c/s 21188 is attached now.

Michal
Comment 9 Pasi Karkkainen 2010-04-19 05:35:56 EDT
Sounds good! 

Michal: Sorry I've been really busy lately. Do you still need more images? To me it sounds ok, since you have the latest ubuntu 10.04 patch included already.
Comment 10 Michal Novotny 2010-04-19 05:39:13 EDT
(In reply to comment #9)
> Sounds good! 
> 
> Michal: Sorry I've been really busy lately. Do you still need more images? To
> me it sounds ok, since you have the latest ubuntu 10.04 patch included already.    

Pasi: Yeah, I have a subscription for upstream xen-devel list as well and when I saw that patch that is about grub2 support in pygrub too, I added it as well. I don't need more images any longer but feel free to apply this patch and try it yourself.

Michal
Comment 11 Pasi Karkkainen 2010-05-13 15:25:46 EDT
Ok, I finally found the time to test the pygrub grub2 patch.
I started with EL 5.5 and applied the grub2 patch you provided.

Then I downloaded http://fi.archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/xen/xm-debian.cfg configuration file and edited it.

I set the following options:
memory = 1024
name = ubuntu01
vcpus = 1
vif = ['bridge=virbr0']
disk = ['phy:vg01/ubuntu01,xvda,w']

and also edited the "bootloader" line and corrected the filename by adding the path to it: /usr/bin/pygrub

Then I started the installation like this:

xm create -f xm-debian.cfg -c install=true install-kernel="http://fi.archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/xen/vmlinuz" install-ramdisk="http://fi.archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/xen/initrd.gz" install-mirror="http://fi.archive.ubuntu.com/ubuntu"

The installation went smoothly, no problems appeared.
After the installation I started the guest like this:

xm create -f xm-debian.cfg -c

And it seems to work OK, I can see the pygrub menu, I can choose the kernel and it boots fine!

So the patch seems all fine to me!

I assume it can be applied for RHEL 5.6 ? 

Thanks!
Comment 12 Michal Novotny 2010-05-26 05:42:06 EDT
(In reply to comment #11)
> Ok, I finally found the time to test the pygrub grub2 patch.
> I started with EL 5.5 and applied the grub2 patch you provided.
> 
> Then I downloaded
> http://fi.archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/xen/xm-debian.cfg
> configuration file and edited it.
> 
> I set the following options:
> memory = 1024
> name = ubuntu01
> vcpus = 1
> vif = ['bridge=virbr0']
> disk = ['phy:vg01/ubuntu01,xvda,w']
> 
> and also edited the "bootloader" line and corrected the filename by adding the
> path to it: /usr/bin/pygrub
> 
> Then I started the installation like this:
> 
> xm create -f xm-debian.cfg -c install=true
> install-kernel="http://fi.archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/xen/vmlinuz"
> install-ramdisk="http://fi.archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/xen/initrd.gz"
> install-mirror="http://fi.archive.ubuntu.com/ubuntu"
> 
> The installation went smoothly, no problems appeared.
> After the installation I started the guest like this:
> 
> xm create -f xm-debian.cfg -c
> 
> And it seems to work OK, I can see the pygrub menu, I can choose the kernel and
> it boots fine!
> 
> So the patch seems all fine to me!
> 
> I assume it can be applied for RHEL 5.6 ? 
> 
> Thanks!    

Hi Pasi,
yeah, I did some modifications to the patch since there were some issues to be fixed (not that much connected to grub2 boot loader but with manually entering the boot commands that was *not* using the proper bootloader configuration and it was treating everything as grub1 image etc. I had to fix it upstream first since upstream was having the same issues with that). It should be applied for RHEL 5.6, that's right.

Michal
Comment 13 Michal Novotny 2010-05-26 05:51:16 EDT
(In reply to comment #11)
> Ok, I finally found the time to test the pygrub grub2 patch.
> I started with EL 5.5 and applied the grub2 patch you provided.
> 
> Then I downloaded
> http://fi.archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/xen/xm-debian.cfg
> configuration file and edited it.
> 
> I set the following options:
> memory = 1024
> name = ubuntu01
> vcpus = 1
> vif = ['bridge=virbr0']
> disk = ['phy:vg01/ubuntu01,xvda,w']
> 
> and also edited the "bootloader" line and corrected the filename by adding the
> path to it: /usr/bin/pygrub
> 
> Then I started the installation like this:
> 
> xm create -f xm-debian.cfg -c install=true
> install-kernel="http://fi.archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/xen/vmlinuz"
> install-ramdisk="http://fi.archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/xen/initrd.gz"
> install-mirror="http://fi.archive.ubuntu.com/ubuntu"
> 
> The installation went smoothly, no problems appeared.
> After the installation I started the guest like this:
> 
> xm create -f xm-debian.cfg -c
> 
> And it seems to work OK, I can see the pygrub menu, I can choose the kernel and
> it boots fine!
> 
> So the patch seems all fine to me!
> 
> I assume it can be applied for RHEL 5.6 ? 
> 
> Thanks!    

Yeah, I did some modifications to the patch but the functionality of Grub2 should be unaffected. It was mainly fixing some things so I had to fix upstream first since it was not fixed there yet. It should be applied for RHEL 5.6.

Michal
Comment 14 Michal Novotny 2010-05-26 05:53:10 EDT
Sorry, there was some bugzilla error so I didn't know the comment was already posted so sorry for 2 repeated comments.

Michal
Comment 15 Michal Novotny 2010-05-26 06:51:36 EDT
Created attachment 416763 [details]
New version of my patch

Hi,
this is the patch to add Grub2 support to pyGrub to be able to install
and boot e.g. Debian and/or Ubuntu guests. Sooner or later even Fedora
will be using the Grub2 boot loader so this backport is really needed.
Also, fixes for isconfig support and entering boot loader commands
manually has been added to this patch (backported from my upstream patch
available for c/s 21461) to use the proper boot loader image instead
of old behaviour to use GrubImage in all cases (even Lilo case on ia64).

Upstream: xen-unstable c/s 20485, 20486, 20487, 20858, 21002, 21188 and 21461

Testing: I did testing on x86_64 dom0 both without and with this patch
applied. Testing was done for PV guests using both grub and grub2 and both
guests were working fine.

Michal
Comment 16 Michal Novotny 2010-05-26 06:54:21 EDT
Hi Pasi,
could you please try retesting with patch in comment #15 ? It should work the same and also you could try entering the command manually to grub and grub2 and it should be treated as the good image class instead of old behaviour of treating it as GrubImage always.

Thanks,
Michal
Comment 17 Pasi Karkkainen 2010-05-26 08:09:18 EDT
Yep, I'll try the new patch and let you know how it goes.
Comment 18 Michal Novotny 2010-05-26 08:58:15 EDT
(In reply to comment #17)
> Yep, I'll try the new patch and let you know how it goes.    

Ok, thanks Pasi.
Comment 19 Pasi Karkkainen 2010-05-27 16:27:59 EDT
I just applied the latest version of the patch and it seems to work! 

I booted Ubuntu 10.04 guest (grub2) and fedora 13 guest (grub1) and both worked OK. I could also edit the kernel parameters on the pygrub prompt, if that's what you meant with the "entering the command manually".. ? 

Thanks!
Comment 20 Michal Novotny 2010-06-07 05:28:35 EDT
(In reply to comment #19)
> I just applied the latest version of the patch and it seems to work! 
> 
> I booted Ubuntu 10.04 guest (grub2) and fedora 13 guest (grub1) and both worked
> OK. I could also edit the kernel parameters on the pygrub prompt, if that's
> what you meant with the "entering the command manually".. ? 
> 
> Thanks!    

Yeah Pasi, exactly. By "entering the boot commands manually" I meant to edit the kernel parameters inside of the grub bootloader. It was treated like grub1 always (i.e. it was not even treated like Lilo bootloader on ia64) so I did the patch to use proper bootloader (i.e. grub for grub1, grub2 for grub2 and lilo for lilo bootloader on ia64) - it's been already merged upstream.

Michal
Comment 29 Yufang Zhang 2010-09-07 03:14:47 EDT
QA verified this bug on xen-3.0.3-115.el5:

Install latest ubuntu PV guest with the following command:

#xm create -f xm-debian.cfg -c install=true install-kernel="http://mirrors.sohu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/xen/vmlinuz" install-ramdisk="http://mirrors.sohu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/xen/initrd.gz" install-mirror="http://mirrors.sohu.com/ubuntu"

After OS Installation, we could boot the guest with successfully with pygrub. Also, just using pygrub command line to check the image, grub manual could be reflected well. 

Change this bug VERIFIED.
Comment 31 errata-xmlrpc 2011-01-13 17:21:08 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0031.html

Note You need to log in before you can comment on or make changes to this bug.