All of lore.kernel.org
 help / color / mirror / Atom feed
* Faulty BIOS or GRUB issue (USB Stick won't boot)
@ 2009-09-30  1:12 Daniel Mierswa
  2009-09-30  6:20 ` Vladimir 'phcoder' Serbinenko
  2009-09-30  8:26 ` James Courtier-Dutton
  0 siblings, 2 replies; 9+ messages in thread
From: Daniel Mierswa @ 2009-09-30  1:12 UTC (permalink / raw)
  To: grub-devel

Hey list,
in January this year I got my hands dirty with a laptop and tried 
booting it via USB stick. The thing is that, when installed to the MBR 
of the stick, the BIOS just won't detect it and print "Operating system 
not found" and skips to reading the MBR from HDD. If I install it into 
the active boot partition of the stick, it will show me the "GRUB " 
notification_string (boot/i386/pc/boot.S). I'm currently booting this 
stick via syslinux which then loads a GRUB image I created with 
lnxboot.img. However I find this very impractical, as I need to find the 
UUID of the stick (which GRUB then sees as fd0) and load a configuration 
which itself loads the real GRUB configuration. I received quite a few 
help during that time of year by Robert and daChaac via IRC, and I also 
posted this on help-grub@ but got no answer there. I bring this up 
again, because someone else faced the same issue with another USB stick 
(until that point I seemed to be the only one facing it). I "debug"ed as 
good as I could by putting the output of the notification string in the 
boot.S file to several places and reboot. It comes to the point where it 
executes `jmp *(kernel_address)`.
If anyone has any idea how to go on with this issue, I'd welcome it.
Thanks in advance.

-- 
Mierswa, Daniel

If you still don't like it, that's ok: that's why I'm boss. I simply 
know better than you do.
                --- Linus Torvalds, comp.os.linux.advocacy, 1996/07/22



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Faulty BIOS or GRUB issue (USB Stick won't boot)
  2009-09-30  1:12 Faulty BIOS or GRUB issue (USB Stick won't boot) Daniel Mierswa
@ 2009-09-30  6:20 ` Vladimir 'phcoder' Serbinenko
  2009-09-30 19:11   ` Daniel Mierswa
  2009-09-30  8:26 ` James Courtier-Dutton
  1 sibling, 1 reply; 9+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-09-30  6:20 UTC (permalink / raw)
  To: The development of GRUB 2

Daniel Mierswa wrote:
> Hey list,
> in January this year I got my hands dirty with a laptop and tried
> booting it via USB stick. The thing is that, when installed to the MBR
> of the stick, the BIOS just won't detect it and print "Operating
> system not found" and skips to reading the MBR from HDD. If I install
> it into the active boot partition of the stick, it will show me the
> "GRUB " notification_string (boot/i386/pc/boot.S). I'm currently
> booting this stick via syslinux which then loads a GRUB image I
> created with lnxboot.img. However I find this very impractical, as I
> need to find the UUID of the stick (which GRUB then sees as fd0) and
> load a configuration which itself loads the real GRUB configuration. I
> received quite a few help during that time of year by Robert and
> daChaac via IRC, and I also posted this on help-grub@ but got no
> answer there. I bring this up again, because someone else faced the
> same issue with another USB stick (until that point I seemed to be the
> only one facing it). I "debug"ed as good as I could by putting the
> output of the notification string in the boot.S file to several places
> and reboot. It comes to the point where it executes `jmp
> *(kernel_address)`.
> If anyone has any idea how to go on with this issue, I'd welcome it.
> Thanks in advance.
>
This behaviour is probably caused by BIOS exposing first partition as a
disk. I would consider this a BIOS bug. A workaround could be following:
losetup /dev/loop0 /dev/sdb1
mount /dev/loop0 /mnt/usb
grub-install --root-directory=/mnt/usb /dev/loop0
Don't forget to apply fezie's bugfix for root-directory

Does anyone know a better workaround?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Faulty BIOS or GRUB issue (USB Stick won't boot)
  2009-09-30  1:12 Faulty BIOS or GRUB issue (USB Stick won't boot) Daniel Mierswa
  2009-09-30  6:20 ` Vladimir 'phcoder' Serbinenko
@ 2009-09-30  8:26 ` James Courtier-Dutton
  2009-09-30 19:10   ` Daniel Mierswa
  1 sibling, 1 reply; 9+ messages in thread
From: James Courtier-Dutton @ 2009-09-30  8:26 UTC (permalink / raw)
  To: The development of GRUB 2

2009/9/30 Daniel Mierswa <impulze@impulze.org>:
> Hey list,
> in January this year I got my hands dirty with a laptop and tried booting it
> via USB stick. The thing is that, when installed to the MBR of the stick,
> the BIOS just won't detect it and print "Operating system not found" and
> skips to reading the MBR from HDD. If I install it into the active boot
> partition of the stick, it will show me the "GRUB " notification_string
> (boot/i386/pc/boot.S). I'm currently booting this stick via syslinux which
> then loads a GRUB image I created with lnxboot.img. However I find this very
> impractical, as I need to find the UUID of the stick (which GRUB then sees
> as fd0) and load a configuration which itself loads the real GRUB
> configuration. I received quite a few help during that time of year by
> Robert and daChaac via IRC, and I also posted this on help-grub@ but got no
> answer there. I bring this up again, because someone else faced the same
> issue with another USB stick (until that point I seemed to be the only one
> facing it). I "debug"ed as good as I could by putting the output of the
> notification string in the boot.S file to several places and reboot. It
> comes to the point where it executes `jmp *(kernel_address)`.
> If anyone has any idea how to go on with this issue, I'd welcome it.
> Thanks in advance.
>

Can you do a
fdisk -u -l /dev/sdb

or whatever device the usb stick is when plugged in.
If the first partition of the usb stick starts at sector less than 63,
grub has probably not been installed due to lack of embedded area.
Quite a few usb sticks start at sector 32 instead of sector 64.
A simple modification to get the first partition to start at sector 64
might help you.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Faulty BIOS or GRUB issue (USB Stick won't boot)
  2009-09-30  8:26 ` James Courtier-Dutton
@ 2009-09-30 19:10   ` Daniel Mierswa
  2009-10-01  8:49     ` James Courtier-Dutton
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Mierswa @ 2009-09-30 19:10 UTC (permalink / raw)
  To: grub-devel

On 30.09.2009 10:26, James Courtier-Dutton wrote:
> Can you do a
> fdisk -u -l /dev/sdb
But of course.

Disk /dev/usb1: 1041 MB, 1041961984 bytes
33 heads, 61 sectors/track, 1010 cylinders, total 2035082 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x00000000

      Device Boot      Start         End      Blocks   Id  System

> If the first partition of the usb stick starts at sector less than 63,
> grub has probably not been installed due to lack of embedded area.
Yes I've seen that by searching the web. If that's the case grub-install 
would complain that it cannot embed core.img into the header, wouldn't 
it? Either way I've checked the size of core.img:

-rw-r--r-- 1 root root 23784 2009-09-30 20:59 /mnt/root/boot/grub/core.img

So it would require ~50 Sectors, since the partition starts at sector 62 
it _should_ work, no? I think i can remember setting a different 
sectors/track (above 63) back in the days but it didn't change any 
behaviour on boot.

-- 
Mierswa, Daniel

If you still don't like it, that's ok: that's why I'm boss. I simply 
know better than you do.
                --- Linus Torvalds, comp.os.linux.advocacy, 1996/07/22



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Faulty BIOS or GRUB issue (USB Stick won't boot)
  2009-09-30  6:20 ` Vladimir 'phcoder' Serbinenko
@ 2009-09-30 19:11   ` Daniel Mierswa
  2009-10-01  8:22     ` Vladimir 'phcoder' Serbinenko
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Mierswa @ 2009-09-30 19:11 UTC (permalink / raw)
  To: grub-devel

On 30.09.2009 08:20, Vladimir 'phcoder' Serbinenko wrote:
> [...] A workaround could be following:
> losetup /dev/loop0 /dev/sdb1
Why do I need to create a loop device for the first partition?

> grub-install --root-directory=/mnt/usb /dev/loop0
This will give a GRUB error, saying that there's no matching device for 
/dev/loop0 in my device.map. After removing the device.map and by 
letting GRUB create it automatically, I get "Invalid device `/dev/loop0'."

> Don't forget to apply fezie's bugfix for root-directory
Yeah this is already applied since I tried to install it into the 
primary partition via "--root-directory=/mnt/mount /dev/sdb1".

-- 
Mierswa, Daniel

If you still don't like it, that's ok: that's why I'm boss. I simply 
know better than you do.
                --- Linus Torvalds, comp.os.linux.advocacy, 1996/07/22



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Faulty BIOS or GRUB issue (USB Stick won't boot)
  2009-09-30 19:11   ` Daniel Mierswa
@ 2009-10-01  8:22     ` Vladimir 'phcoder' Serbinenko
  2009-10-01 13:05       ` Daniel Mierswa
  0 siblings, 1 reply; 9+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-10-01  8:22 UTC (permalink / raw)
  To: The development of GRUB 2

Daniel Mierswa wrote:
> On 30.09.2009 08:20, Vladimir 'phcoder' Serbinenko wrote:
>> [...] A workaround could be following:
>> losetup /dev/loop0 /dev/sdb1
> Why do I need to create a loop device for the first partition?
>
To simulate brain damage of your BIOS
>> grub-install --root-directory=/mnt/usb /dev/loop0
> This will give a GRUB error, saying that there's no matching device
> for /dev/loop0 in my device.map. After removing the device.map and by
> letting GRUB create it automatically, I get "Invalid device
> `/dev/loop0'."
>
echo '(hd0)  /dev/loop0' > /boot/grub/device.map
>> Don't forget to apply fezie's bugfix for root-directory
> Yeah this is already applied since I tried to install it into the
> primary partition via "--root-directory=/mnt/mount /dev/sdb1".
>




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Faulty BIOS or GRUB issue (USB Stick won't boot)
  2009-09-30 19:10   ` Daniel Mierswa
@ 2009-10-01  8:49     ` James Courtier-Dutton
  2009-10-01 13:05       ` Daniel Mierswa
  0 siblings, 1 reply; 9+ messages in thread
From: James Courtier-Dutton @ 2009-10-01  8:49 UTC (permalink / raw)
  To: The development of GRUB 2

2009/9/30 Daniel Mierswa <impulze@impulze.org>:
> On 30.09.2009 10:26, James Courtier-Dutton wrote:
>>
>> Can you do a
>> fdisk -u -l /dev/sdb
>
> But of course.
>
> Disk /dev/usb1: 1041 MB, 1041961984 bytes
> 33 heads, 61 sectors/track, 1010 cylinders, total 2035082 sectors
> Units = sectors of 1 * 512 = 512 bytes
> Disk identifier: 0x00000000
>
>     Device Boot      Start         End      Blocks   Id  System
>

From that, you do not appear to have a partition table, therefore you
will not have an embedded area at all, and so grub will not install.
usb sticks can be formatted in two ways.
1) with a partition sector and partitions like a Hard Disk.
(embedded area exists)
2) with no partition sector and no partitions like a Floppy Disk. (no
embedded area exists)

You will probably have to add partitions to your flash disk so that
grub can be installed on it.
WARNING: Changing partitions will wipe all the usb stick contents and
possibly your Hard Disk contents (if you mistype the device name)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Faulty BIOS or GRUB issue (USB Stick won't boot)
  2009-10-01  8:49     ` James Courtier-Dutton
@ 2009-10-01 13:05       ` Daniel Mierswa
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Mierswa @ 2009-10-01 13:05 UTC (permalink / raw)
  To: grub-devel

On 01.10.2009 10:49, James Courtier-Dutton wrote:
>  From that, you do not appear to have a partition table, therefore you
> will not have an embedded area at all, and so grub will not install.
I'm sorry to cause confusion like that, but I erased the partition table 
(and the MBR for that matter) to show you how the BIOS detects the stick 
geometry.

> usb sticks can be formatted in two ways.
> 1) with a partition sector and partitions like a Hard Disk.
> (embedded area exists)
> 2) with no partition sector and no partitions like a Floppy Disk. (no
> embedded area exists)
Yes, the layout which was tried looks like the below (1), I did not give 
(2) a shot yet, since this would force me to have a disk layout that 
seems utterly pointless for this matter (I think).

Disk /dev/usb: 1042 MB, 1042284544 bytes
33 heads, 61 sectors/track, 1011 cylinders
Units = cylinders of 2013 * 512 = 1030656 bytes
Disk identifier: 0x7867a96c

    Device Boot      Start         End      Blocks   Id  System
/dev/usb1   *           1        1011     1017541   83  Linux

Sorry again for the confusion.
phcoder might be on to something though, please also see his recent mail 
in this thread.

-- 
Mierswa, Daniel

If you still don't like it, that's ok: that's why I'm boss. I simply 
know better than you do.
                --- Linus Torvalds, comp.os.linux.advocacy, 1996/07/22



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Faulty BIOS or GRUB issue (USB Stick won't boot)
  2009-10-01  8:22     ` Vladimir 'phcoder' Serbinenko
@ 2009-10-01 13:05       ` Daniel Mierswa
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Mierswa @ 2009-10-01 13:05 UTC (permalink / raw)
  To: grub-devel

On 01.10.2009 10:22, Vladimir 'phcoder' Serbinenko wrote:
> To simulate brain damage of your BIOS
*shrug* I wonder how you can manage to simulate _that_ severe damage.

> echo '(hd0)  /dev/loop0'>  /boot/grub/device.map
D'oh, didn't think of hardcoding it, I thought GRUB detects it properly.

However, phcoder, there were some crackheads back in January taking some 
time with that matter and I tried almost every hack discussed on the 
net. And out of nothing comes you, applying yet another hack and it just 
seems to work. You're a true hero. :D
However when doing "ls (hd0)" in the GRUB rescue shell that fires up, 
I'm getting "Partition table". I guess this is part of the hack?
Is it possible to apply this workaround in the codebase so that others 
with that broken BIOS (remember I have another MBR file of a guy who 
reported identical behaviour) or is this something that should be left 
to people with broken BIOS?
All in all, thank you very much, now that I have a rescue shell, I can 
start playing.

-- 
Mierswa, Daniel

If you still don't like it, that's ok: that's why I'm boss. I simply 
know better than you do.
                --- Linus Torvalds, comp.os.linux.advocacy, 1996/07/22



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-10-01 13:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-30  1:12 Faulty BIOS or GRUB issue (USB Stick won't boot) Daniel Mierswa
2009-09-30  6:20 ` Vladimir 'phcoder' Serbinenko
2009-09-30 19:11   ` Daniel Mierswa
2009-10-01  8:22     ` Vladimir 'phcoder' Serbinenko
2009-10-01 13:05       ` Daniel Mierswa
2009-09-30  8:26 ` James Courtier-Dutton
2009-09-30 19:10   ` Daniel Mierswa
2009-10-01  8:49     ` James Courtier-Dutton
2009-10-01 13:05       ` Daniel Mierswa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.