Dual Boot openSUSE USB Stick Installer

In the latest round of upgrades and new installs of openSUSE around here I decided to take a different approach and use the network install and install from a USB stick rather than a DVD. While I was at it I decided that I'd try to make a dual boot installer that would allow me to install either the 32-bit or 64-bit version of the latest openSUSE (version 11.3) from the same USB stick.

First we need to download the openSUSE network installer images:

$ mkdir opensuse
$ cd opensuse
$ wget http://download.opensuse.org/distribution/11.3/iso/openSUSE-11.3-NET-i586.iso
$ wget http://download.opensuse.org/distribution/11.3/iso/openSUSE-11.3-NET-x86_64.iso

These refer to the 32-bit NET installer and the 64-bit NET installer.

Both of the openSUSE installers above are already bootable, but the idea here is to be able to run either one, so we want to boot the USB stick independent of either installer and be shown a menu that allows us to select the installer to run. To do this we'll use syslinux, which you'll probably need to install. Assuming you're using openSUSE to build the installer, install syslinux with the following command:

$ zypper in syslinux

Plug in your USB stick if you haven't already done so and find out what its device file is, you can do this by looking at the messages at the end of /var/log/messages or by mounting the stick and typing the mount command to view what's mounted and where. The device file should have the form /dev/sdX, where the X will be different depending on how many drives your system has. Once you know the device file you should unmount the drive if it's mounted.

The first step is to create a number of partitions on the drive. I use fdisk for this but any partitioning tool should work. Create the following partitions:

  • Partion 1: Size: 20MB, Type: FAT16 (type code: 4)
  • Partion 2: Size: 200MB, Type: FAT32 (type code: c)
  • Partion 3: Size: 200MB, Type: FAT32 (type code: c)

The first partition is used to hold our menu for selecting the installer to boot. The 2nd and 3rd partions are used to hold the individual openSUSE installers.

Now format the partitions:

$ mkfs.msdos /dev/sdX1
$ mkfs.vfat /dev/sdX2
$ mkfs.vfat /dev/sdX3

Now we need to mount each of the openSUSE installer images and create bootable disks using the mkbootdisk script that's included with the installer.

First the 64-bit installer:

$ mount openSUSE-11.3-NET-x86_64.iso /mnt -o loop
$ /mnt/boot/x86_64/mkbootdisk --64 --partition /dev/sdX2 /mnt
$ umount /mnt

Then the 32-bit installer:

$ mount openSUSE-11.3-NET-i586.iso /mnt -o loop
$ /mnt/boot/i386/mkbootdisk --32 --partition /dev/sdX3 /mnt
$ umount /mnt

The mkbootdisk command expects a --32 or --64 option to specify the bitness of things, the --partition option to tell where the bootable image is going to be created, and the source directory for the files that are to be copied to the bootable image (in our case /mnt).

Now that we've got the openSUSE installers on the USB stick we install our menu by installing syslinux on the first partition. Then we have to mount the partition and copy the syslinux menu program, chain loader program, and our configuration files to it (see below and the attachments).

$ syslinux /dev/sdX1
$ mount /dev/sdX1 /mnt
$ cp /usr/share/syslinux/chain.c32 /mnt
$ cp /usr/share/syslinux/menu.c32 /mnt
$ cp syslinux.cfg /mnt
$ cp menu.cfg /mnt

Now use fdisk or another partitioning tool to make sure that only the first partition is active and bootable.

When syslinux boots a partition it looks for a config file to tell it what to do, this is the syslinux.cfg we copied above. Our syslinux.cfg contains:

default opensuse
prompt  0

label opensuse
  com32 menu.c32
  append /menu.cfg

The above tells syslinux that the default (and only) boot option is "opensuse" and that we don't want syslinux to display its boot: prompt. The opensuse option boots the "com32" program "menu.c32" which we copied to the USB stick above. So here, rather than booting Linux, we're booting a helper program that comes with syslinux. This helper program, as you've probably already guessed since it's named menu, displays a menu. The append /menu.cfg option here adds the name of the menu configuration file to the end of the command line that executes the menu program. The menu configuration file contains our menu:

default  harddisk
prompt   1
timeout  600

MENU TITLE openSUSE Installers

label harddisk
  MENU LABEL Boot from Hard Disk
  localboot 0x80

label start64
  MENU LABEL Start 64 bit openSUSE installer
  com32 chain.c32
  append boot 2

label start32
  MENU LABEL Start 32 bit openSUSE installer
  com32 chain.c32
  append boot 3

Here we can see our boot options, one to boot from the harddisk, which is the default and happens after the timeout of 60.0 seonds. The other options are to boot the 32-bit openSUSE installer and to boot the 64-bit openSUSE installer.

When booting one of the openSUSE installers the boot is done by executing another syslinux helper program: chain.c32 (which we also copied to the USB stick above). This helper program boots another boot loader by loading the MBR of another disk or partition. The append options to each of the chain loaded installers specifies what partition to boot use: append boot 2 boots the 64-bit installer on partition 2 and append boot 3 does the 32-bit installer on partition 3.

At this point your new dual boot openSUSE installer should be ready to run, except for one possible caveat: if the MBR on your USB stick isn't valid you'll need to install a new MBR. Test it, if it doesn't boot, then try copying a new MBR to the USB stick with the following command:

$ dd if=usr/share/syslinux/mbr.bin of=/dev/sdX bs=440 count=1

If all goes well you should see the following when you boot the USB stick:


If you have a big enough USB stick you could also create full installers by using the DVD installers instead of the NET installers.

Note that most of the above commands will need to be run as root, so be careful. Also note that if you are not using openSUSE to create the installers the path to the syslinux files may be different.

p.s. The openSUSE NET installers worked without issue.


Mitch Frazier is an Associate Editor for Linux Journal.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I wanted to create new USB

starach's picture

I wanted to create new USB Installer from DVD but when I type command:
/mnt/boot/i386/mkbootdisk --32 --partition /dev/sdc2 /mnt
I'm getting fallowing error:
disk /dev/sdc, partition /dev/sdc2
must be 16 bit FAT

Here is the part inside mkbootdisk that is responsible for this check.

  for (`fsck.vfat -v $part 2>/dev/null`) {
    if(/(\d+)\s+bytes\s+per\s+cluster/) {
      $bpc = $1;
    if(/FATs,\s+(\d+)\s+bit\s+entries/) {
      $fatsize = $1;

  die "not a FAT file system\n" unless $bpc >= 512 && $fatsize >= 12;

  die "must be 16 bit FAT\n" unless $fatsize == 16;

And here is response of fsck.vfat -v /dev/sdc2

dosfsck 3.0.9 (31 Jan 2010)
dosfsck 3.0.9, 31 Jan 2010, FAT32, LFN
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "mkdosfs"
Media byte 0xf8 (hard disk)
       512 bytes per logical sector
      4096 bytes per cluster
        32 reserved sectors
First FAT starts at byte 16384 (sector 32)
         2 FATs, 32 bit entries
   7790592 bytes per FAT (= 15216 sectors)
Root directory start at cluster 2 (arbitrary size)
Data area starts at byte 15597568 (sector 30464)
   1946812 data clusters (7974141952 bytes)
62 sectors/track, 247 heads
         0 hidden sectors
  15604966 sectors total
Checking for unused clusters.
Checking free cluster summary.
/dev/sdb2: 0 files, 1/1946812 clusters

If I understand regular expressions correctly it takes "2 FATs, 32 bit entries" One more thing - sdc2 is 5GB partition

Fat 16

Mitch Frazier's picture

Try forcing the partition to be FAT16 when you create it by passing '-F 16' to mkfs.vfat (or mkdosfs). Although that may not work with a 5GB partition (I'm not sure if the 2GB limit for FAT16 is still valid or not).

Mitch Frazier is an Associate Editor for Linux Journal.

DVD Installer

Mitch Frazier's picture

Note that as I look back at the article it could be that I misspoke when I said you could do this with the DVD installer. Could be that only the CD installer will work. There may be a way around this but since I haven't tested it I can't be sure.

Mitch Frazier is an Associate Editor for Linux Journal.

I already tried that with -F

starach's picture

I already tried that with -F 16 option and it didn't worked unfortunately.

mkbootdisk claims for a FAT 16

Georges's picture

I've been searching how to put the 64 iso boot disk on a stick.
Thank you very much!
I experience a small problem :
On a 8Gb usb stick, I have followed your instructions, as I want to put a full net install and a full install, I just partitioned with the following :
Disk /dev/sdc: 8004 MB, 8004829184 bytes
247 heads, 62 sectors/track, 1020 cylinders
Units = cylinders of 15314 * 512 = 7840768 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa391d308

Device Boot Start End Blocks Id System
/dev/sdc1 1 20 153109 4 FAT16 <32M
/dev/sdc2 21 200 1378260 c W95 FAT32 (LBA)
/dev/sdc3 201 1020 6278740 c W95 FAT32 (LBA)

I have formatted all the partitions as per the instructions :
# mkfs.msdos -n os64boot /dev/sdc1
# mkfs.vfat -n os64net /dev/sdc2
# mkfs.vfat -n os64full /dev/sdc3

I have mounted both iso's (net and full) :
/dev/loop0 on /mnt/os64 type iso9660 (ro)
/dev/loop1 on /mnt/os64net type iso9660 (ro)

Then when I do (net install)
jupiter:~ # /mnt/os64net/boot/x86_64/mkbootdisk --64 --partition /dev/sdc2 /mnt/os64net/
disk /dev/sdc, partition /dev/sdc2
must be 16 bit FAT
Or (Full install) :
jupiter:~ # /mnt/os64/boot/x86_64/mkbootdisk --64 --partition /dev/sdc3 /mnt/os64/
disk /dev/sdc, partition /dev/sdc3
must be 16 bit FAT
jupiter:~ #

Do you have any clue of what I did wrong ?

Fat 16

Mitch Frazier's picture

The partition needs to be FAT16. But that may not be possible with a partition size greater than 2GB.

Mitch Frazier is an Associate Editor for Linux Journal.


Mitch Frazier's picture

Ditto my comment above about possibly incorrectly stating that you could do this with the DVD installer. It may only work with the CD installer.

Mitch Frazier is an Associate Editor for Linux Journal.

Booting from harddisk isn't working.

starach's picture

Great job. I was looking for a explanation like that for some time. The only thing is that it don't want to boot from hard drive. Even from inside NET installers. I just triggers loader from USB. Any ideas what may be causing that?

One more thing I would like to ask. Its about partitioning. The thing is I want to add more features on my 8 GB USB. One is DVD installer you mentioned in your article. The thing is that maximum amount of main partitions is 4. How to set it up so I could use extended partitions and get total amount of 5 partitions.

Best Regards and once again thank you.

Boot from harddisk

Mitch Frazier's picture

The "localboot" option is known to be a bit unreliable. Another option is to simply use the chain loader to boot the hard drive. The following suggestion:

LABEL cont
  MENU LABEL Continue Bootup
  KERNEL chain.c32
  APPEND hd0 0

comes from here.

As far as partitions go it should be pretty simple: according to the syslinux wiki page on using the chain loader you should be able to create normal extended partitions and use numbers of 5 and up to reference them when booting.

Mitch Frazier is an Associate Editor for Linux Journal.

It still doesn't work for me.

starach's picture

It still doesn't work for me. It just shows

Booting ...
SYSLINUX 3.86 0x4c31e9d2 EBIOS Copyright (C) 1994-2010 H. Peter Anvin et al

And goes back to USB loader.


Mitch Frazier's picture

Did you try "hd1"? Could be that the BIOS is reporting "hd0" as the USB stick and the actual hard drive is now "hd1".

Mitch Frazier is an Associate Editor for Linux Journal.

Now it says Booting... Error

starach's picture

Now it says

Error ao carregar o sistema operativo

Which probably means something like Error operation system not found. Its really weird cause in most distributions, I have seen that booting from hard drive works as it should.

Boot HD

Mitch Frazier's picture

You didn't mention that you were trying to boot that operating system. Try this:

LABEL unfriendly
  MENU LABEL Boot Unfriendly O/S
  KERNEL chain.c32
  APPEND hd0 ntldr=/NTLDR

If that doesn't work try "hd1".

Mitch Frazier is an Associate Editor for Linux Journal.

Yes that system. :] Although

starach's picture

Yes that system. :] Although it worked I still have problems running Crapdows from NTLDR. I was hoping that this boot loader will be able to boot any operating system without so called New Technology Loader help. It was actually just curiosity I can always reboot machine from loader stage.



John &quot;S&quot;'s picture

Perfect timing - I've been struggling with how to morph the SuSE net boot .iso's into bootable USB stick images. Thank you very much!

Nice tip

Doug.Roberts's picture


Very nice suggestion for a dual boot installer. As a side note, I never warmed up to SUsE, starting back in the days when they still used the silly capitalization for their name. One of our clusters at work was built with Suse, and it just seems funky; nothing was where it was in other distros that I had worked with. Part of my dislike of Suse is no doubt that you like what you are used to, Mint 9 being my current favorite. Suse certainly has a following though, so it must be pretty solid.


What You're Used To

Mitch Frazier's picture

There's an important point in what you say: "what you are used to". A friend of mine who some years ago worked for Sun Microsystems used to say how people would beat them up over why Solaris was so much harder to use than Windows. Yet, when he tried to do anything with a Windows machine it was a constant struggle compared to Solaris because it wasn't what he knew.

On the one hand a consistent Linux would be nice, a version where everything is where it is everywhere else, a version that always works the same even when it works incorrectly, a version where nobody innovated... and we could call it Windows.

Mitch Frazier is an Associate Editor for Linux Journal.


Doug.Roberts's picture

I agree that competition is a good thing, Mitch. All the Linux distros out there contending with each other have a general strengthening effect.

There is one disadvantage to having this proliferation of Linux offerings to choose from, however: it makes it confusing for new users to select one. They might talk to a Fedora fan who claims that Fedora is the best thing since sliced bread. And then get the very same story (repurposed) from a K/Ubuntu fanboi.

The Linux competition has even benefited M$ And Mac users -- there can be no slacking off when the competition is just around the corner waiting to gobble up market share. I credit a little bit of Windows 7's polish -- as compared to Vista, anyhow -- with the pressure that Redmond perceives from that "Linux cancer".