Skip to contentSkip to conversation

Grub2 usb stick boot error

DISCUSSION Fulvio Scapin 2 participants 4 messages Jun 23, 2008 – Jun 24, 2008

lore
Share & tools
lore
#0 lore raw

I am having a problem using Grub2 to boot some bootable partition stored on a usb stick.
Basically I am trying to fit several distros, all fat partitions made bootable with syslinux, on a usb stick and use grub2 to select and boot one of them.
I should say that I come across two distinct cases, one using a GPT label and a much worse one employing the usual dos label.
First I tried the gpt label cause I didn't relish the idea of using extended partitions. On a 8GB stick I create a BIOS Boot Partition, marked it with parted, and grub embedded itself in it with no problem. Then a second partition containing the configuration of grub, and further on several partitions containing distros, all fat16 bootable thanks to syslinux. I discovered, to my surprise, that grub allows me to boot only the third and fouth partition, while anyone beyond the fourth gives me boot error. I even created a fifth partition containing the exact same files of the fourth, and while the fourth boots, the fifth still doesn't.
Then, on another stick, a 4GB one, I tried with a dos label. This time, after countless tries to get grub installed, and having succeeded, I discover that I can't boot any partition, even when having just two partitions, one with the configuration of grub and the other a bootable fat16 fs with a distro.
I tried Grub legacy and it works fine. I tried chainloading Grub2 from Grub Legacy, just to make an attempt, and still no luck booting from Grub2. I have to specify the with booting one of the volumes I mean chainloading syslinux on it, doing a "chainloader +1" on the volume. The Grub 2 console works fine (it's brilliant by the way) but I can't chainload anything (with the GPT restricted exception detailed above. ) I compiled and run grub2 (from cvs and from git) on a Gentoo system running on a Macbook, and tested the sticks on 2 common x86 machines and with qemu with the same results.
I figuratively beating my head against the wall, so any help or comment would be greatly appreciated.

P.S.

I suppose I could just use Grub Legacy, but I just like Grub 2 immensely, so I'll keep that solution as a last resort, or maybe chainload Grub2 from Grub Legacy at least to use the shell.

Thanks in advance,
Fulvio Scapin

#1 lore raw
Quoted 34 lines · Fulvio Scapin

I am having a problem using Grub2 to boot some bootable partition stored on a usb stick.
Basically I am trying to fit several distros, all fat partitions made bootable with syslinux, on a usb stick and use grub2 to select and boot one of them.
I should say that I come across two distinct cases, one using a GPT label and a much worse one employing the usual dos label.
First I tried the gpt label cause I didn't relish the idea of using extended partitions. On a 8GB stick I create a BIOS Boot Partition, marked it with parted, and grub embedded itself in it with no problem. Then a second partition containing the configuration of grub, and further on several partitions containing distros, all fat16 bootable thanks to syslinux. I discovered, to my surprise, that grub allows me to boot only the third and fouth partition, while anyone beyond the fourth gives me boot error. I even created a fifth partition containing the exact same files of the fourth, and while the fourth boots, the fifth still doesn't.
Then, on another stick, a 4GB one, I tried with a dos label. This time, after countless tries to get grub installed, and having succeeded, I discover that I can't boot any partition, even when having just two partitions, one with the configuration of grub and the other a bootable fat16 fs with a distro.
I tried Grub legacy and it works fine. I tried chainloading Grub2 from Grub Legacy, just to make an attempt, and still no luck booting from Grub2. I have to specify the with booting one of the volumes I mean chainloading syslinux on it, doing a "chainloader +1" on the volume. The Grub 2 console works fine (it's brilliant by the way) but I can't chainload anything (with the GPT restricted exception detailed above. ) I compiled and run grub2 (from cvs and from git) on a Gentoo system running on a Macbook, and tested the sticks on 2 common x86 machines and with qemu with the same results.
I figuratively beating my head against the wall, so any help or comment would be greatly appreciated.

Quoted 6 lines

P.S.

I suppose I could just use Grub Legacy, but I just like Grub 2 immensely, so I'll keep that solution as a last resort, or maybe chainload Grub2 from Grub Legacy at least to use the shell.

Hi,

First, you can check the size of partition, for example, does the ones that doesn't boot cross any boundary, like 4G/2G ?

Also, you mention it apply to qemu as well, how do you test it, can you produce a qemu image that illustrate the problem ?

Signature · 1 line
Bean
#2 lore raw

2008/6/24 Bean <[email protected]>:

Quoted 4 lines

Hi,

Quoted 9 lines

First, you can check the size of partition, for example, does the ones that doesn't boot cross any boundary, like 4G/2G ?

Also, you mention it apply to qemu as well, how do you test it, can you produce a qemu image that illustrate the problem ?

--
Bean

Output of parted on the GPT labeled stick:

Model: USB Flash Disk (scsi)
Disco /dev/sdc: 8120MB
Dimensione del settore (logica/fisica): 512B/512B
Tabella delle partizioni: gpt

Numero Inizio Fine Dimensione File System Nome Flag

1 17,4kB 6000kB 5983kB
bios_grub
3 6000kB 32,0MB 26,0MB ext2 grub avvio

2 32,0MB 433MB 401MB fat16 clonezilla-sysrsc msftres

4 433MB 532MB 99,0MB fat16 puppylinux msftres

5 532MB 650MB 118MB msftres

6 650MB 800MB 150MB fat16 msftres

Partitions 4 and 6 contain the same data, a syslinux-booted puppylinux. 4 chainloads correctly, 6 gives me "Boot error". Interestingly, using Grub Legacy, chainloaded from Grub2, I can't boot the 4th partition either.

About qemu, I simply use the device as a raw disk with qemu and boot it.

#3 lore raw

USB stick with dos label:

Model: Kingston DataTraveler 2.0 (scsi)
Disco /dev/sdf: 4006MB
Dimensione del settore (logica/fisica): 512B/512B
Tabella delle partizioni: msdos

Numero  Inizio  Fine    Dimensione  Tipo      File System  Flag
 1      31,7kB  55,1MB  55,1MB      primary   ext2
 2      55,1MB  185MB   130MB       primary   fat16        lba
 3      185MB   295MB   110MB       primary   fat16        lba
 4      295MB   4003MB  3708MB      extended
 5      295MB   405MB   110MB       logical   fat16        lba

2 and 5 with same data. The 2nd partition boots, the other doesn't.

Same stick, new layout:
Model: Kingston DataTraveler 2.0 (scsi)
Disco /dev/sdf: 4006MB
Dimensione del settore (logica/fisica): 512B/512B
Tabella delle partizioni: msdos

Numero  Inizio  Fine    Dimensione  Tipo      File System  Flag
 1      31,7kB  55,1MB  55,1MB      primary   ext2
 2      55,1MB  185MB   130MB       primary   fat16        lba
 3      185MB   398MB   213MB       extended
 5      185MB   398MB   213MB       logical   fat16        lba
 4      398MB   4003MB  3606MB      primary   fat32        lba

This time 2,4 and 5 all can succeed to boot. All contain the same data. I confess I do not quite understand.
In both cases above I chainloaded Grub 2 from Grub Legacy.