Bug#565706: grub2 enters rescue mode with "fd0 cannot get C/H/S values"

Tom Wright thomaswright at cantab.net
Thu Feb 25 07:51:37 UTC 2010


On Wednesday 24 February 2010 09:58:05 Vladimir 'φ-coder/phcoder' Serbinenko 
wrote:
> Can you try the attached patch?

I think the patch is segfaulting because it always destroys the grub_disk_t 
structure when returning from the grub_raid_register function, even if that 
grub_disk_t has been successfully added to an array and will be used in the 
future.  If I change the function so that it is not destroyed when 
successfully added, it all compiles and installs correctly, but then gives 
errors when booting with the USB drive attached, as before.  I tried the 
function as follows:

void
grub_raid_register (grub_raid_t raid)
{
  auto int hook (const char *name);
  int hook (const char *name)
    {
      grub_disk_t disk;
      struct grub_raid_array array;

      grub_dprintf ("raid", "Scanning for RAID devices on disk %s\n", name);

      disk = grub_disk_open (name);

      if (disk && (disk->total_sectors != GRUB_ULONG_MAX) &&
          (! grub_raid_list->detect (disk, &array)) &&
          (! insert_array (disk, &array, grub_raid_list->name)))
        return 0;

      /* This error usually means it's not raid, no need to display             
         it.  */
      if (grub_errno != GRUB_ERR_OUT_OF_RANGE)
        grub_print_error ();

      grub_errno = GRUB_ERR_NONE;

      if (disk)
        grub_disk_close (disk);

      return 0;
    }

  raid->next = grub_raid_list;
  grub_raid_list = raid;
  grub_device_iterate (&hook);
}


When rebooting, it gave this output:

GRUB loading.
Welcome to GRUB!

error: fd0 cannot get C/H/S values.
error: fd0 cannot get C/H/S values.
Entering rescue mode...
grub rescue> 

I think that before, it only listed the error line once, if that helps.

Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20100225/a8a92f13/attachment.pgp>


More information about the Pkg-grub-devel mailing list