Difference between revisions of "PyGrub"

From Xen
(Concept)
(Update list of supported filesystems to those present in xen 4.1)
Line 47: Line 47:
 
Thanks to (The following is taken from http://lists.xensource.com/archives/html/xen-users/2007-09/msg00524.html and own experience) for first pyGrub Reference.
 
Thanks to (The following is taken from http://lists.xensource.com/archives/html/xen-users/2007-09/msg00524.html and own experience) for first pyGrub Reference.
   
  +
== Supported File Systems ==
'''NOTE:''' PyGrub supports only EXT2 / EXT3 filesystems. Attempt to boot from EXT4 will lead in hang. See this [http://mail-index.netbsd.org/port-xen/2010/02/10/msg005716.html article] for details.
 
  +
  +
PyGrub supports the following filesystems via libfsimage:
  +
* Ext2/3/4
  +
* FAT
  +
* ISO9660
  +
* REISERFS
  +
* UFS
  +
* ZFS
   
 
[[Category:Xen]]
 
[[Category:Xen]]

Revision as of 09:45, 23 January 2012


Why?

PyGrub enables you to start Linux domUs with a kernel inside the DomU instead of a kernel that lies in the filesystem of the dom0. This means easier management - each domU manages its own kernel and initrd, meaning you can the built-in package manager to update the kernels, instead of having to track and update kernels stored in your dom0. It also allows easy migration of HVM'ed Linuxes - there's no need to extract the installed kernel & initrd.

Concept

It is used as a Bootloader and provided with Xen. PyGrub behaves like Grub and reads the standard Grub menu.lst (or Grub2's grub.cfg) to provide the xen create process with the required parameters and SXP stanzas.

  • Question is: Does it copy the required kernel and initd temporarily out to Dom0 for it to access it there or does Dom0 access the kernel and initd in their filesystem? Anyone?

Therefore usage is quite easy.

How?

In your domU

  1. Install Grub
  2. Install a linux-image-xen of your choice.
  3. Create the /boot/grub directory if it is not present.
  4. Let it create its default menu.lst (update-grub in Debian)

In your dom0

Change your domU.cfg:

  • remove kernel and initrd stanza
  • add bootloader stanza, e.g. bootloader = '/usr/bin/pygrub'

Note: You need to know where in the filesystem pygrub lies. For example, debian uses /usr/lib/xen-$version/bin/pygrub or something like this, instead of the path reflected above

Important Tip / Caveat

On your disk line, e.g.

disk = ['file:/vserver/mail/guest_base2G.img,hda1,w','file:/vserver/mail/guest_swap256M.img,hda2,w','phy:data/mail,hda3,w']

make sure that the partition/lvm/container that contains the kernel and initrd comes first. Xend passes the *first* entry to pyGrub. (At least for Version 3.2.1) If the first disk entry does not contain a kernel you will most likely get

Error: Boot loader didn't return any data

If you get this error have a look at /var/log/xen/xend.log . You can read here which parameters were given to pyGrub, try them by hand and see if pyGrub outputs the right stanzas for domU startup. (They look a little like grub entries LISPified, SXP-Format).

Thanks to (The following is taken from http://lists.xensource.com/archives/html/xen-users/2007-09/msg00524.html and own experience) for first pyGrub Reference.

Supported File Systems

PyGrub supports the following filesystems via libfsimage:

  • Ext2/3/4
  • FAT
  • ISO9660
  • REISERFS
  • UFS
  • ZFS