jump to navigation

Howto: Syslinux and Grub on one USB drive 16 September, 2008

Posted by aronzak in Grub, Linux, Live Usb.
Tags: , , , , ,
trackback

Intro: This is probably the coolest thing that I have done with USB bootloaders up until this point.Syslinux is an extremely useful tool that can easily and safely be installed to a usb flash drive. It can then be used to boot any version of linux, or even floppy disk images on the drive. But is is limited in that it cannot boot up operating systems on another drive. It can chainload to a working bootloader, but what if it is broken and needs to be fixed. Of course, you can start up a Linux distribution on the usb stick to fix it.

Grub is an extremely versatile tool that is used to boot up almost any operating system other than Windows. It can also be used to modify some files, or install another version of itseld to another hard disk. This is extremely useful if you have a broken grub installation.

Well, you can run boot grub from syslinux. And it’s really easy.

Step one: Stick syslinux on a drive. See this guide for easy installation of Puppy Linux.

Step two: Download a file called grub.exe. It can be found here.

Step three: This is a windows executable file (.exe) that can be run from dos. But the most impressive thing: It’s actually a linux kernel. Plonk it on the root of the drive.

Step four: Start up the usb stick and type “grub.exe’. Then, you’ve got grub. That’s it.

The rest is optional.

– Stick grub.exe in boot/grub and create a syslinux.cfg entry called grub looking like this:

LABEL grub
KERNEL /boot/grub/grub.exe

– Create your own menu.lst.

– Use a hex editor (eg. “khexedit”) and search for “timeout” or “default”. You’ll find the section that is the pretend ‘menu.lst’. You can edit as such.

– Download a useful grub tool chest called SuperGrub Disk (SGD) from here. Extract the .tar.gz onto your usb stick (should be in a folder called boot). NB. This does not work out of the box. SGD uses a customised version of grub that has a command setgrubdevice to set a variable called $grub_device. This is then used in ($grub_device). If you use Grub.exe, it does not understand this, but does not need it, as it already sets root to the correct device. You can use kate (KDE Advanced Text Editor) to remove all references of ($grub_device) (Use find and replace to replace it with nothing). Better is probably the following solution.

Edit: By accident I installed grub onto the device. Interestingly, syslinux still works fine. Syslinux has its main part in the partition of a drive, not the whole drive. Thus, grub can chain to syslinux using “root (hd(x),0) rather than “root (hd(x)”. Syslinux can also chain back to grub itself, (using chain.c32) or start grub.ex.

Advertisements

Comments»

1. Kiran Manandhar - 6 April, 2009

I am using GRUB to access different partitions in my USB key. I have two DOS partitions. One for Windows 98 DOS and another for SysLinux for Offline Windows NT, XP, Vista Password administration. I have third partition for Grub menu. It is working fine.

I have set up OpenSuse 11.1 Linux Live CD on the third partition. I am having a problem to configure Grub to access Syslinux configuration file.

As such I have configured OpenSuse 11.1 Linux Live CD on USB key after updating initrd file and working fine with syslinux boot up.

Any suggestion is welcome !

2. Philip Hands - 15 June, 2009

Partly inspired by your efforts, I’ve come up with a similar solution, that doesn’t need the syslinux stage.

I have a feeling that my approach has some other advantages but in the explosion of combinations I forget what it might be — could it be the ability to usefully boot as a USB-ZIP, or the ability to chainload ISO images?

3. sucipto - 27 May, 2010

i’m lost my grub.exe file thanks for your information….. :D

4. qingchengl - 21 August, 2010

LABEL grub
KERNEL /boot/grub/grub.exe
APPEND –config-file=/boot/hello.lst

use this to specify config file.

zxz - 23 August, 2010

thanks but

APPEND –config-file=/boot/hello.lst

works for me

zxz - 23 August, 2010

—config-file

zxz - 23 August, 2010
--config-file
5. Installing Windows 7 and Ubuntu from the same USB storage device » jebbnet - 12 April, 2011

[…] (thanks to this) on the 1.5GB partition i created the folder “boot” and in there, the folder “grub”. I then […]

6. Brian Minton - 23 December, 2011

grub can also chainload syslinux. Just put grub in the MBR, and make the first partion “active” and put syslinux there.

7. sheim012 - 23 March, 2014

Reblogged this on 備忘錄.

8. http://www.affiliateoftheday.com - 13 June, 2014

Thanks for every other informative site. The place else may I get that kind of information written in such an ideal means?

I’ve a mission that I’m just now operating on, and I’ve
been on the glance out for such info.

9. e-liquid usa - 27 November, 2015

It’s genuinely very complex in this active life to listen news on Television,
so I only use web for that purpose, and get the newest news.

10. turnkey profit - 8 July, 2016

Howdy! Quick question that’s completely off topic. Do you know how to make your
site mobile friendly? My site looks weird when browsing from my iphone.
I’m trying to find a template or plugin that might be
able to fix this issue. If you have any suggestions, please share.
Thank you!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: