Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make bootable USB drive with Debian and make it bootable on both BIOS and UEFI systems. I've found only separate instructions for BIOS and UEFI systems. Please help me to find a solution.

share|improve this question
    
There isn't a single solution unless the UEFI system supports a legacy BIOS mode. – Ramhound Aug 21 '13 at 15:04
3  
I don't know why this being downvoted. It's a perfectly valid question even if the answer is that it can't currently be done. – supercheetah Aug 21 '13 at 15:09
1  
It's definitely possible to create a Linux USB flash drive that's bootable in both EFI and BIOS modes. Fedora's intaller does this, for instance. It may not be possible to easily set up the Debian installer to boot in both modes, but it's definitely possible to do it if you're willing to take it apart and put it back together again. I don't know how hard this would be, but the general outline is in my answer. – Rod Smith Aug 22 '13 at 0:13

If you're talking about creating a Debian installation image, I can't provide step-by-step instructions for it; however, the general way to create a USB drive that's bootable in both EFI and Linux is:

  1. Prepare the disk with partitions. GPT is probably most reliable for this, but MBR will work on at least some systems, too. Be sure to include an EFI System Partition (ESP) and (if you use GRUB 2) a BIOS Boot Partition.
  2. Install 64-bit Linux to the USB drive. (A 32-bit Linux will boot in EFI mode only on those rare 32-bit EFI-based PCs or with the help of a 64-bit EFI boot loader. These days, you're probably best off with a 64-bit Linux.)
  3. Install a BIOS-mode boot loader (probably GRUB 2, but GRUB Legacy patched with GPT support, SYSLINUX, or LILO will work, too).
  4. Install an EFI-mode boot loader/manager (GRUB 2, Fedora's patched GRUB Legacy, recent SYSLINUX, rEFInd, or gummiboot) in the ESP as EFI/BOOT/bootx64.efi.

The Debian installer, of course, has things set up in its own way, so step #2 will involve figuring out how the installer works and "translating" it to work from the USB flash drive.

share|improve this answer
    
Yes, I want to create bootable system, not installer. What partition shall I mark as 'boot': EFI System Partition or Linux rootfs? – Alexander230 Aug 22 '13 at 5:07
1  
If you use GPT, mark the ESP with the "boot flag" in parted, or give it a type code of EF00 in gdisk. (The term "boot flag" is not entirely accurate in GPT, but the parted developers chose to apply an MBR term to a very loosely related GPT concept.) If you use MBR, the "boot flag" in parted is semi-optional; GRUB doesn't use it, but some BIOSes require it to be set on a partition, and it doesn't really matter which one has the flag. If you use a boot loader other than GRUB, consult its documentation on this point. – Rod Smith Aug 22 '13 at 14:32

I would think that Debian and Ubuntu are technically close enough so that this method for Ubuntu may work also for Debian: https://help.ubuntu.com/community/Installation/UEFI-and-BIOS

EDIT: You need to first decide which flavor you want: 32-bit or 64-bit. Most people will want to go with 64-bit i.e. amd64. Then create a partition table with parted as follows: ~1MB for bios_grub, ~256MB (or 512MB, it is really up to you to decide) for the EFI System Partition (ESP). Then create your Linux partitions for / and your swap, additional partitions and possible use of LVM is entirely up to you.

Number  Start   End     Size    File system     Name  Flags
 1      1049kB  2097kB  1049kB                        bios_grub
 2      2097kB  264MB   262MB   fat32                 boot
 3      264MB   7434MB  7170MB  ext4
 4      7434MB  7799MB  365MB   linux-swap(v1)

Then install Debian, preferably in UEFI mode. After configuring the bootloader (which will be installed to the ESP) reboot again with the Debian installation media, but this time in BIOS mode. Try to install GRUB to the bios_grub partition. On Ubuntu 12.04 LTS you could use boot-repair which is only available from an external repository (once in UEFI mode, once in BIOS mode), but I don't know if this is also available on Debian. Run it both times with recommended repair settings.

On Debian you will probably have to install GRUB by hand, manually, and make sure it is installed once as UEFI bootloader on the ESP and once as BIOS boot sector on the bios_grub partition.

Be aware that automatic kernel updates will only be updated on the system that is currently running, i.e. either BIOS or UEFI, and depending on your current configuration. THIS IS NOT AUTOMATIC.

There are a couple of other possibilities described in the linked source, and sources linked from there. It is also different for an installed Debian vs. the installer for Debian to be multi-system (UEFI+BIOS). Additionally, in UEFI mode you have to take some thought if you want it to be able to use Secure Boot or not.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .