bugGNU GRUB - Bugs: bug #17653, [grub2] must probe for partmap in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #17653: [grub2] must probe for partmap in (fdX), because some BIOS detect USB drives as floppies

Submitted by:  Nikolaj (unDEFER) Krivchenkov <undefer>
Submitted on:  Fri 08 Sep 2006 07:38:33 PM UTC  
 
Category:  Disk & Partition Severity:  Major
Priority:  5 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Closed Release:  1.98
Release:  Bazaar - trunk Reproducibility:  Every Time
Planned Release:  None

( Jump to the original submission)

Mon 25 Aug 2008 04:36:17 PM UTC, comment #6: 

Is this still a problem with recent SVN?
If so could you please try Robert's patch

Felix Zielcke <fzielcke>
Project Member
Thu 20 Dec 2007 06:20:43 PM UTC, comment #5: 

Can you please build GRUB 2 with the attached patch, boot from it, and use the (now modified) "ls" command to determine the number of sectors your BIOS reports that these "fake" floppies have?

If they have more than 2880 we can probably add a workaround.

Thanks

(file #14677)

Robert Millan <robertmh>
Project Administrator
Sat 30 Dec 2006 09:36:37 AM UTC, comment #4: 

On GRUB side it's interesting too. It's quite unfortunate situation: during GRUB setup the device is seen as "HDD" while on boot BIOS presents it twisted to a "floppy".

Syslinux uses same code for both so it doesn't matter there, however GRUB has the special workaround at the very start: it remembers it was installed to HDD, checks the device number, if it is not 80h or above, forces 80h.

So after printing "GRUB" it is trying to read not from boot device (flash, presented by BIOS as (fd1)) but from (hd0) present on the system. Verified: after unplugging internal HDD, the message when booting from flash drive becomes "GRUB Hard Disk Error".

Ok, replaced the two NOPs (90 90) at offset 75 with original JMP (EB 07). Another place where GRUB has wrong data is the start sector of stage2, because this was counted from MBR, while now 0 begins at boot sector, 32 sectors closer .. corrected this, at offset 44.

Result: "GRUB Geom Error". Hmmm, not there yet.

Jozef Hitzinger <hico>
Sat 30 Dec 2006 09:16:43 AM UTC, comment #3: 

More news from syslinux front: Looking at source, first thing it does is some floppy block ax=0 int 13h call, then tries to detect if LBA (EBIOS) is needed. It then prints it booted using "CBIOS", i.e. the reads were done using CHS calls. So far so good. It may be interesting to put in debug prints that reveal geometry used.

Jozef Hitzinger <hico>
Thu 28 Dec 2006 08:14:33 PM UTC, comment #2: 

Hi,

I see the same with MSI K7N2 Delta-L motherboard and 512MB USB flash drive. Used GNU GRUB 0.97 from Knoppix 5.0.1 Live DVD. Copied GRUB files to flash drive, there is one FAT16 primary partition created on the flash drive. Under Knoppix "grub" command it's recognized as (hd1) and /dev/sda i.e. as a harddisk, geometry 245/126/32 total sectors 990208. GRUB can be setup to flash MBR (hd1) including stage 1.5, and without stage 1.5 also to flash Boot record (hd1,0).

The MBR copy works well e.g. on hp nc6000 notebook. Using "Boot from USB harddisk" BIOS option on this laptop, GRUB boots up and is able to boot Windows from internal harddrive, or GParted or Memtest from USB drive, etc. In this GRUB shell the flash drive is recognized as (hd0). The copy of GRUB in Boot sector is not used in this scenario (verified by having syslinux in Boot record and still GRUB came up).

Now the K7N2 motherboard BIOS has 3 options for booting USB: USB-FDD, USB-ZIP, USB-HDD. If GRUB is just in MBR of the flash drive, nothing happens with any of the options. If GRUB is setup to the Boot record of the partition on flash drive, and USB-ZIP is selected, GRUB gets as far as printing "GRUB" and then freezes. So part of the Boot sector code is run.

This is consitent with fact that writing Boot sector of the flash drive with "syslinux /dev/sda1" leads to fully working syslinux booting (works only with USB-ZIP BIOS option but well), which can be used e.g. for booting GParted stored on the flash drive. So there is a way to boot from USB on this motherboard.

Next try was to boot GRUB off a floppy with USB key attached. In this case GRUB detects the attached USB flash drive as (fd1). Geometry given for it is the classic floppy geometry 80/2/18 total sectors 2880. Using e.g. "cat (fd1)+1" it can be verified we're indeed reading from the flash drive. And the first sector we get is not MBR but the boot sector of the primary partition.

At this moment is hard to say what way this BIOS presents the flash drive when it boots off it using USB-ZIP option.

It seems reasonable that BIOS still presents it as "floppy", and the first sector it gives out is Boot record of the partition. Perhaps GRUB needs to check better for the actual geometry of such "floppy" to boot up successfully as syslinux does.

Jozef Hitzinger <hico>
Fri 08 Sep 2006 08:34:07 PM UTC, comment #1: 

In the grub 0.97 I have the same problem.
I have ASUS P4SE motherboard, and updated BIOS to last (1011) revision.

Nikolaj (unDEFER) Krivchenkov <undefer>
Fri 08 Sep 2006 07:38:33 PM UTC, original submission:  

Hello!
I try install grub on flash drive, but has many problems, because it's detect USB Flash drive as floppy, not harddisk.
So I can't to get access to partitions.

Google seems know only one similar happen:
http://linuxfromscratch.org/pipermail/lfs-chat/2005-June/026611.html

What you may advice to get access to partitions of my flash drive?

Nikolaj (unDEFER) Krivchenkov <undefer>

 

Attached Files
file #14677:  fake_floppy_size.diff added by robertmh (621B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by phcoder (Updated the item)
  • -email is unavailable- added by fzielcke (Posted a comment)
  • -email is unavailable- added by robertmh (Updated the item)
  • -email is unavailable- added by hico (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-08-27 phcoder StatusNone => Fixed
        Open/ClosedOpen => Closed
        Release0.95 => 1.98
        ReleaseNone => Bazaar - trunk
    2007-12-20 robertmh Attached File- => Added fake_floppy_size.diff, #14677
    2007-12-15 robertmh SummarySometimes (on some motherboards?) Flash Drives detected as floppy disk (fd1). How I can get access to partitions? => [grub2] must probe for partmap in (fdX), because some BIOS detect USB drives as floppies

    Back to the top


    Powered by Savane 3.6