Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to create a multiboot USB flash drive by using GRUB2 to chainload different partitions on the drive. It's not working. I do not want advice on how to create a multiboot flash drive; I know there are lots of ways to do that. I am only interested in figuring out why this particular method doesn't work.

Some background: I have two USB drives, let's call them USB1 and USB2. I am currently trying to install Debian Wheezy on either one of them in a multiboot-friendly way. Now, if I simply dd the iso onto USB1 (/dev/sdb):

dd conv=notrunc bs=4M if=/path/to/iso of=/dev/sdb

That creates a nice, bootable drive from which I can installed Debian. Furthermore, if I install GRUB2 on USB2 I can successfully chainload USB1 from it with:

search --label --set=root "Debian 7.0.0 i386 1"
chainloader +1
boot

Now for my problem: If I instead create a second partition on USB2 and dd the iso onto that:

dd conv=notrunc bs=4M if=/path/to/iso of=/dev/sdc2

Chainloading that doesn't work. It doesn't throw any error message, but simply gives me a black screen with a blinking dash (unresponsive). (I tried this with both drives, so I don't think faulty hardware is to blame).

Why doesn't this work? What's the difference between chainloading a different drive, and chainloading a different partition on the same drive when they contain the exact same data?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

First of all, a disk image is a different thing than a partition image. You're trying to use your one (seemingly disk image) as both, which is wrong. Don't assume everything is okay from dd giving no errors: it will happily do whatever you tell it to do, unless there's some kind of real IO error.

When you chainload the drive, GRUB will look for a Master Boot Record - that's a kind of thing that starts disk contents and contains boot code. However, partition structure is different - it doesn't even start from code; it has a boot record, but in some further location. GRUB can chainload that too; procedure is different, though. As you put a disk image into the partition, you didn't create anything easily usable and for sure GRUB isn't expecting a MBR there. Instead it runs some random machine code, which is never healthy for your PC.

To make that work you'd have to copy the contents of the Debian partition to this and install GRUB on it. Unless there's some mistake on the way, it should work flawlessly. Don't forget to recreate your /dev/sdc2!

share|improve this answer
    
Aha! So a disc image is distinct from a partition image. That's exactly what I was wondering, thanks! I'm a bit confused by your last paragraph though; in "copy the contents of the Debian partition to this", what do you mean by "this"? –  bessman May 8 '13 at 14:51
    
@bessman To this partition, ie. this one (second one, to be exact) you want to boot from. –  TNW May 8 '13 at 15:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.