[How To]Boot from a USB drive without BIOS support


Recommended Posts

Since it seemed to be such a common issue with barely any resources available, I decided to write a tutorial on how to achieve booting Linux, from an external USB drive, on a computer that can't boot from USB (Using a boot CD). I'll get right to the point.

I used Windows for the CD burning steps just because it was easier for me, but feel free to use linux.

1. Start off by installing the distro of your choice to the USB drive. For the rest of the tutorial I'm going to be using Mandrake 10.1 just becuase I've already made the initrd for it. All the defualt settings should be fine.

2. Using a rescue/LiveCD, mount your USB drive and steal the kernel off it (from /boot). Copy the kernel to somewhere that you can access from Windows, like a NTFS/FAT partition on the disk.

3. Here comes the fun part. If you plan on installing Mandrake 10.1 (I've found it to be pretty nice), you can just use my initrd file, which will save you A LOT of time. If you plan to use a distro, hop over to my section on editing my initrd to fit your system.

4. Now, from Windows, proceed to create your CD bootloader. I've convienently made an isolinux boot cd, so all you have to do is insert your kernel. Use MagicIso or a similar program to put your kernel and initrd.img into the isolinux directory on the cd. Check the isolinux.cfg and make sure it's pointing to the kernel and initrd, and that root is set to /dev/sda1.

5. Burn your Boot CD. I've been looking for buisness card cd's so I could put my bootloader in my wallet, but none of the major retail stores have them. Tell me if you find a good deal on them somewhere.

6. This is the first test. Put in the boot CD, and plug in the USB drive. The system should boot up and get to the startup script, and it'll probably get hung at the fsck step (At least for Mandrake 10.1). If you didn't get that far, you have a problem with the bootloader on the cd, the kernel, or the initrd. Fix it, or if you can't figure out what's wrong, contact me.

7. If you made it this far, you're pretty much done, and you can smile now. Just use a rescue/live cd and mount your usb drive again. Delete/modify the lines in your rc script that the boot is getting stuck at. Keep trying to boot/fixing the script until it's happy and you can boot.

8. That's it! You're done. Hope this guide helped you. If there are any bugs/errors/you can't figure it out, PLEASE contact me so I can change it.

Initrd Editing:

So, you chose to use a different disto. That's fine and all, but it's going to require some work.

Basically, here are the steps.

Boot using a rescue/live cd. Mount your usb drive. Also, mount the directory containing my initrd image (Have it on a cd or something). Gunzip the initrd.img (rename it to initrd.gz first) if it needs it. Mkdir /mnt/initrd Then mount it using mount -o loop initrd /mnt/initrd.

From /mnt/initrd, view the linuxrc file and get a feel for what it's doing. Then, replace all of the modules currently in the initrd (The Mandrake 10.1 modules) with the modules from the usb drive, the system you wish to boot from usb.

Unmount the initrd image, gzip it back up, rename it to initrd.img, and copy it back to a Windows accessable partition.

Continue on with the rest of the steps.

usbboot.zip

initrd.zip

Edited by zachman123
5.  Burn your Boot CD.  I've been looking for buisness card cd's  so I could put my bootloader in my wallet, but none of the major retail stores have them.  Tell me if you find a good deal on them somewhere.

585264239[/snapback]

thank you!!!! this is SO cool!!!! i'm gonna try it soon (i hope!).

anyhoo...you might try supermediastore for your business card cds. i've ordered stuff from them before and they seem to be ok. i'd swear that i saw the cds in compusa but can't find anything about them on the site.

  • 2 weeks later...

Not better...

For both files:

With Winzip : "File is not in the standard Zip 2.0 format"

With 7-Zip : file broken

With unzip under Linux : error uncompressing

Inspite of these errors, I get some files:

usbboot.iso :120 KO

initrd.img : 129KO

but when I try to open them under MapgicIso, it tells me that these files don't contain image...

Files Fixed.

Stuffit apparently hates me, it wouldn't zip files correctly AND it didn't give an error trying to unzip the old files (but they were still messed up)

Anyways Winzip did the trick, and I may be reinstalling/killing stuffit soon.

If you have ANY problems AT ALL, please let me know. Feel free to

E-mail [email protected]

AIM zachman123

MSN [email protected] **Not on often

YAHOO [email protected] **Not on often

Hi again, indeed your files are fixed. Unfortunatly, I can't boot yet. What I did:

Using winimage:

- I opened the usbboot.iso file and I found an isolinux dir.

- I put my MDK 10.1 vmlinuz-2.6.8.1-12mdk-i586-up-1GB from my USB install /boot to isolinux directory

- I put the initrd.img file in the isolinux directory as well

- I edited initrd.cfg file :

*********************

default linux

timeout 0

label linux

kernel vmlinuz-2.6.8.1-12mdk-i586-up-1GB

append initrd=initrd.img root=/dev/sda1

*********************

- I burned the image and tried to boot : my bios can't boot it. I have none message.

Questions:

- Do I have to leave "vmlinuz' in initrd.cfg file?

- Is it realated with lilo.conf of USB drive ?

- I have 2 installs : one one sda1 and another one sda3. Should it work I have set root=/dev/sda3 in initrd.cfg ?

thanks again.

You mean the CD won't boot? Make sure winimage is keeping it as a bootable CD, to test that try burning my exact iso just to see if that'll boot.

And I assume you mean isolinux.cfg, everything in there looks fine. root just needs to point to the root partition of your linux install...

Yes, it won't boot at all, I just have the BIOS message 'Boot from CD:', the CD is read for 5 secs and then, nothing...

I tried to brun the usbboot.iso : it boots and tell me it can't find the vmlinuz kernel (normal). So it should be your initrd.img that freeze the boot? I use an external USB CD Reader.

Questions:

- Do I have to set kernel to kernel (link) or the full kernel name ?

- Why don't your provide a full iso pour sda1 with provided kernel ?

Thanks.

Yea, it must be your editing of the iso messing up it's burnable-ness.

I'll put them together and test it and post it, I'll put it up in a few min.

Neowin wouldn't upload it (it's 9 megs), and my website has (very) limited bandwidth so I can't upload it there.

Can anyone host it if I email it to them? Or if you want the file just email me ([email protected])

Nervermind, I finally found another solution:

Book your MDK using your rescue disk (F1, then 'rescue').

mkdir sda1

mount /dev/sda1 sda1

chroot sda1

then, use the mkrescue command:

mkrescue --iso

that will geenrate a rescue.iso file.

Burn this image, boot on USB CDROM, that's all. It works for me for sda3.

Oh yea, that would work too :D

Forgot mkrescue would take any modifications you made to the rescue system. Much easier, thanx for the tip. Some distros might not support something like that, so if you're trying some odd system, my instructions should help.

All that time I wasted... Nice solution tho, I was to lazy to make my own firewire initrd with my method, but I think I'll try it with yours.

  • 1 month later...
Oh yea, that would work too :D

Forgot mkrescue would take any modifications you made to the rescue system.  Much easier, thanx for the tip.  Some distros might not support something like that, so if you're trying some odd system, my instructions should help.

All that time I wasted... Nice solution tho, I was to lazy to make my own firewire initrd with my method, but I think I'll try it with yours.

585350512[/snapback]

It didn't work for me! :no:

I tried the mkrescue --iso script on MDK 10.2beta3 (that I installed on sda1) and booted on the CD but I've only seen L 99 99 99 ... on the screen, nothing more !

Then use my method. Try using my iso files, but if that doesn't work, do it from scratch like I did.

I'm no linux expert by any means, so someone else shouldn't have too much trouble with my steps...

edit: Just saw you're using 10.2beta3 ... Which is a different kernel than my iso. So you'll have to do my method from scratch.

Then use my method.  Try using my iso files, but if that doesn't work, do it from scratch like I did.

I'm no linux expert by any means, so someone else shouldn't have too much trouble with my steps...

edit:  Just saw you're using 10.2beta3 ... Which is a different kernel than my iso.  So you'll have to do my method from scratch.

585559086[/snapback]

in fact I think I'm trying something simpler : installing 10.1 on my USB drive first to test your CD and then I will try MDK10.2!

By the way what was your version of MDK 10.1 it is normal MDK with or without last updates, 10.1 community?

one more question : the mandrake installed on the usb drive shoud or should not have a bootloader installed ?

Edited by manouchk

Doesn't matter if a bootloader is on the drive (I had it on and then deleted it by mistake) as it's not used unless you plan on using the external drive with a computer that DOES support usb booting, in which case you won't need to use the cdrom to boot.

I'm not sure what version of mdk it was (It came with PC Format awhile ago). Anyways if the kernel is different you can see in the iso (Unless I renamed it, might've).

Anyways good luck, and feel free to instant message me if you want.

here is a script to build rapidly a booting CD from scratch :

It worked for me (be prudent it writes important files)

#!/bin/sh

#needs syslinux (tested with version 1.76)

d="CD_boot"

rm -rf $d

mkdir $d

cp /usr/lib/syslinux/isolinux.bin $d

#create initrd for USB boot

mkinitrd --preload=ehci-hcd --preload=usb-storage --preload=scsi_mod --preload=sd_mod /boot/usbinitrd.img `uname -r`

#copy kernel (vmlinuz) and initrd file in isolinux directory

cp /boot/vmlinuz $d

cp /boot/usbinitrd.img $d/initrd.img

#create file isolinux.cfg

#assuming kernel file is in isolinux/vmlinuz

#and initrd in file isolinux/initrd.img

cfg=$d/isolinux.cfg

echo "default linux" > $cfg

echo "timeout 0" >> $cfg

echo "label linux" >> $cfg

echo " kernel vmlinuz" >> $cfg

echo " append initrd=initrd.img root=/dev/sda1" >> $cfg

mkisofs -o boot_USB.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table $d

echo "burn CD :"

echo "cdrecord dev=ATAPI:0,0,0 blank=fast"

echo "cdrecord dev=ATAPI:0,0,0 boot_USB.iso"

  • 3 weeks later...

The question is only stupid if you meant using this EXACT method. Of course you're not going to run Windows using a Mandrake disk or linux bootloader... But running windows/dos is possible. If you feel lazy, check out BartPE (A limited version of windows xp that runs off a cd). You might be able to mess with it to make it use a usb disk.

Making Windows XP run from cd on your own would be very hard. Windows 9x/ME though I've managed to kind-of run, just by fooling around. Simpy use a dos bookdisk on cd along with a USB driver (that's the tricky part though...) and install on the usb disk. Then have fun making a bootloader from dos (load dos, init usb driver, then win.exe)

DOS USB resources... http://www.stefan2000.com/darkehorse/PC/DOS/Drivers/USB/

http://www.freedos.org/freedos/news/newsitem/149.html

Just search

Thanks for your prompt reply. What I am really looking for is a solution similar to your scenario where USB boot is not supported by BIOS and I need to be able to use a bootable CD to do so. As it does seem that LILO can boot DOS/Windows 98, I was guessing it might be possible to do so with an approach similar to yours if my goal is to use a CD to boot DOS/Windows 98 from an external USB HDD. Any suggestion?

  • 2 weeks later...

Didn't think about LILO being able to do that, but it should be possible to at least boot ( I don't know if windows would like it).

edit: that's what I kinda tried, except booted from DOS. Windows started, but in messed resolution and didn't work quite right.

Edited by zachman123
  • 3 weeks later...
here is a script to build rapidly a booting CD from scratch  :

It worked for me (be prudent it writes important files)

#!/bin/sh

#needs syslinux (tested with version 1.76)

d="CD_boot"

rm -rf $d

mkdir $d

cp /usr/lib/syslinux/isolinux.bin $d

#create initrd for USB boot

mkinitrd --preload=ehci-hcd --preload=usb-storage --preload=scsi_mod --preload=sd_mod /boot/usbinitrd.img `uname -r`

#copy kernel (vmlinuz) and initrd file in isolinux directory

cp /boot/vmlinuz $d

cp /boot/usbinitrd.img $d/initrd.img

#create file isolinux.cfg

#assuming kernel file is in isolinux/vmlinuz

#and initrd in file isolinux/initrd.img

cfg=$d/isolinux.cfg

echo "default linux" > $cfg

echo "timeout 0" >> $cfg

echo "label linux" >> $cfg

echo " kernel vmlinuz" >> $cfg

echo " append initrd=initrd.img root=/dev/sda1" >> $cfg

mkisofs -o boot_USB.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table $d

echo "burn CD :"

echo "cdrecord dev=ATAPI:0,0,0 blank=fast"

echo "cdrecord dev=ATAPI:0,0,0 boot_USB.iso"

585568604[/snapback]

Your script is perfect and that is what I have done. I am posting this because my problem is related booting from usb-cdrom. This is what is happening:

I am installing Linux (Suse) from my CD (customized) on IBM blade center (BIOS is capable of booting from usb) in which cdrom is a usb device. What exactly happens is this:

During boot, it says grub loading stage 2......

and then instead of loading the menu.lst , it launches the grub shell. Now when I try to set "root ( <tab>", no cd is listed. The only devices listed are fd0 and hd0 (hard disk already has Suse Linux on it (which was installed using standard Suse CD).

This is the command I used to create ISO

mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \

-boot-load-size 4 -boot-info-table -o grub.iso

What I understand is that GRUB automatically sets the root device to (cd) when booted from a CD-ROM

Is there any option in mkisofs or grub in which we can change the default (cd) to usb-cdrom (whatever alias it has) so that stage2 could be loaded successfully.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • I use a Linux laptop every day. I have tried to switch to Linux on my gaming PC which has a 5070 ti. It was not a great experience
    • Alien Isolation 2 will bring a new protagonist and setting, watch the reveal trailer here by Pulasthi Ariyasinghe Only a few weeks ago, Sega and Creative Assembly dropped a teaser for a new Alien Isolation. Today at Summer Game Fest, Alien: Isolation 2 was officially announced with a new trailer while also confirming a whole lot of information about the setting of this survival horror project. Check out the reveal trailer above. Leaving behind the Sevastopol space station, the sequel will take players to a remote colony world. With a Xenomorph (or more) on the loose, players will be navigating both the surface of the weather-ravaged planet as well as "the claustrophobic confines of the Weyland-Yutani outpost of Kurosaki Station." Interestingly, Creative Assembly is leaving behind Amanda Ripley, the daughter of Alien's Ellen Ripley, as the protagonist too. While it hasn't confirmed a name yet, players will be taking the role of a new character for this new adventure. The setting is also being described as a new hunting ground for the Alien. This will have players improvising and developing new tools to aid in their survival and escape, all to avoid "cinema’s deadliest killer." "It has been over a decade since we created the original Alien: Isolation and I am so excited to show everyone the first glimpse of the sequel," says Al Hope, Creative Director at Creative Assembly. "Our dedicated Survival team at Creative Assembly has been working hard to create a new, evolved Isolation experience continuing the legacy of the Alien franchise, making the eponymous killer smarter, the environment harsher and the chance of survival slimmer." Promising the same deadly tension from the original from over a decade ago, Alien: Isolation 2 is in development for PC, Xbox Series X|S, Nintendo Switch 2, and PlayStation 5. A release date has not been announced yet.
    • With how far Tim Apple's head has been up Trump's ass, there's no way this was done reluctantly.
    • Like the article stated, it's written completely from scratch, unlike the umpteen Chromium clones. It got its start as the browser built-in to the also written-from-scratch SerenityOS.
    • Hello, From looking at the screen shots in your motherboard's manual at https://endownload.colorful.cn/EnDownload/MotherBroard/2022/Intel 600/Manual/Intel 600 Series BIOS English/Intel 600 Series BIOS User Guide.pdf, you go to the ADVANCED option at the top of the BIOS (UEFI) menu, then select SECURITY in the list of options on the left.  From there  you can enable and set the Secure Boot mode. Regards, Aryeh Goretsky  
  • Recent Achievements

    • Mentor
      grik went up a rank
      Mentor
    • Dedicated
      JKR earned a badge
      Dedicated
    • One Year In
      CHUNWEI earned a badge
      One Year In
    • Conversation Starter
      FBSPL earned a badge
      Conversation Starter
    • Week One Done
      I2D earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      485
    2. 2
      PsYcHoKiLLa
      270
    3. 3
      Skyfrog
      78
    4. 4
      Steven P.
      68
    5. 5
      +Edouard
      61
  • Tell a friend

    Love Neowin? Tell a friend!