Package: xen-tools
Version: 4.2.1
(Also, previous versions)

When creating a new domU with xen-create-image the template
'/etc/xen-tools/xm.tmpl' does not ensure that the "root[/]" file
system/drive occurs first in the "disk" stanza in the domU.cfg that is
created at '/etc/xen/domU.cfg'. Often(always) when the "root[/]" drive does
not come first in the config the following common error occurs:

# xm create domU.cfg
Using config file "/etc/xen/domU.cfg".
Error: Boot loader didn't return any data!


The common fix is to manually edit the domU.cfg file to reorder the "disk"
stanza to allow the "root[/]" disk/file to come first. This may be pyGrub
related, but this fix appears to cleanly avoid generating the issue.

Here is a patch for the '/etc/xen-tools/xm.tmpl' file that fixes this
issue.

####################Patch Begin#######################

*** xm.tmpl Tue Jan 11 13:29:34 2011
--- xm.tmpl-root_first Tue Jan 11 13:30:23 2011
***************
*** 53,59 ****
      $OUT .= "disk        = [\n";
      for ( my $i = $#PARTITIONS; $i >= 0 ; $i-- )
      {
!       $OUT .= "
 '$PARTITIONS[$i]{'imagetype'}$PARTITIONS[$i]{'image'},$device" . ( $i + 1 )
.",w',\n";
      }
      $OUT .= "              ]\n";
    }
--- 53,69 ----
      $OUT .= "disk        = [\n";
      for ( my $i = $#PARTITIONS; $i >= 0 ; $i-- )
      {
!        if ( $PARTITIONS[$i]{'mountpoint'} eq '/' )
!        {
!            $OUT .= "
 '$PARTITIONS[$i]{'imagetype'}$PARTITIONS[$i]{'image'},$device" . ( $i + 1 )
.",w',\n";
!        }
!     }
!     for ( my $i = $#PARTITIONS; $i >= 0 ; $i-- )
!     {
!        if ( $PARTITIONS[$i]{'mountpoint'} ne '/' )
!        {
!            $OUT .= "
 '$PARTITIONS[$i]{'imagetype'}$PARTITIONS[$i]{'image'},$device" . ( $i + 1 )
.",w',\n";
!        }
      }
      $OUT .= "              ]\n";
    }

####################Patch End#########################

P.S. This is the first patch I have created. Sorry if it is incorrect. Also,
I have searched pretty far and wide to see if this issue is solved
elsewhere. With the exception of manual editing it does not seem to be. I
run into it with pyGrub in conjuction with LVM and local loop files. I am
not sure if there are cases where it does not occur, I have always had this
issue.




John H
*** xm.tmpl	Tue Jan 11 13:29:34 2011
--- xm.tmpl-root_first	Tue Jan 11 13:30:23 2011
***************
*** 53,59 ****
      $OUT .= "disk        = [\n";
      for ( my $i = $#PARTITIONS; $i >= 0 ; $i-- )
      {
!       $OUT .= "                  '$PARTITIONS[$i]{'imagetype'}$PARTITIONS[$i]{'image'},$device" . ( $i + 1 ) .",w',\n";
      }
      $OUT .= "              ]\n";
    }
--- 53,69 ----
      $OUT .= "disk        = [\n";
      for ( my $i = $#PARTITIONS; $i >= 0 ; $i-- )
      {
!        if ( $PARTITIONS[$i]{'mountpoint'} eq '/' )
!        {
!            $OUT .= "                  '$PARTITIONS[$i]{'imagetype'}$PARTITIONS[$i]{'image'},$device" . ( $i + 1 ) .",w',\n";
!        }
!     }
!     for ( my $i = $#PARTITIONS; $i >= 0 ; $i-- )
!     {
!        if ( $PARTITIONS[$i]{'mountpoint'} ne '/' )
!        {
!            $OUT .= "                  '$PARTITIONS[$i]{'imagetype'}$PARTITIONS[$i]{'image'},$device" . ( $i + 1 ) .",w',\n";
!        }
      }
      $OUT .= "              ]\n";
    }

Reply via email to