bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Crash in Grub with altconfigfile


From: Neil Masson
Subject: Crash in Grub with altconfigfile
Date: Sat, 3 Nov 2001 08:51:26 +0000

I encountered a problem with grub 0.90.0-4mdk, Mandrake 8.1  on an
IBM TP600E with BIOS "11/20/99 INET31WW".  When loading stage 2, the
error message "failed line 163" would flash up.  The menu would come
up correctly, but whichever option was selected, the machine would just
reboot and land back in grub.

The message is undocumented, so I had to unpack the source to 
figure out what was going on.  The offending routine is attached.
The memcmp function was failing and I managed to work around the
problem by removing the line 

altconfigfile (hd0,0)/grub/menu.once  

from menu.lst.  menu.once contained just 100 spaces.  I observe that
the message could be much more helpful and that RETURN does not set
disk_read_hook to NULL.  I wonder if this could be the reason grub
would reboot.

Regards,
Neil Masson

/* altconfigfile */
static int
altconfigfile_clear (void)
{
  int len, sector;
  char tmp[SECTOR_SIZE];

  static void disk_read_savesect_func (int s) { sector = s; }

  if (altconfig_file[0] == 0) return 0;
  if (grub_open (altconfig_file) == 0) return 1;

  disk_read_hook = disk_read_savesect_func;
  while ((len = grub_read (tmp, SECTOR_SIZE)))
    {
#define RETURN { printf("failed line %d\n", __LINE__); for(len = 0; len < 
90000000; len++); return 1; }
      if (biosdisk (BIOSDISK_READ,  current_drive, &buf_geom, sector, 1, 
SCRATCHSEG)) RETURN;
      if (memcmp((char *) SCRATCHADDR, tmp, len) != 0) RETURN;
      memset((char *) SCRATCHADDR, ' ', len);
      if (biosdisk (BIOSDISK_WRITE, current_drive, &buf_geom, sector, 1, 
SCRATCHSEG)) RETURN;
    }
  disk_read_hook = NULL;
  grub_close ();
  return 0;
}


Disk /dev/hda: 1299 cylinders, 240 heads, 63 sectors/track
Units = cylinders of 7741440 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls   #blocks   Id  System
/dev/hda1   *      0+    276     277-  2094088+   6  FAT16
/dev/hda2        277    1298    1022   7726320    5  Extended
/dev/hda3          0       -       0         0    0  Empty
/dev/hda4          0       -       0         0    0  Empty
/dev/hda5        277+    278       2-    15088+  83  Linux
/dev/hda6        279+    685     407-  3076888+   b  Win95 FAT32
/dev/hda7   *    686+   1036     351-  2653528+  83  Linux
/dev/hda8       1037+   1069      33-   249448+  82  Linux swap
                start: (c,h,s) expected (1023,239,63) found (1023,1,1)
/dev/hda9       1070+   1298     229-  1731208+  83  Linux
                start: (c,h,s) expected (1023,239,63) found (1023,1,1)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]