Installing Debian Sarge
from a USB memory stick (USB key)

Many Debian boxes need their floppy and/or CD-ROM drives only for setting up the system and for rescue purposes. If you operate some servers, you will probably already have thought about omitting those drives and using an USB memory stick for installing and (when necessary) for recovering the system. This is also useful for small systems which have no room for unnecessary drives.

Important Note

This page was maintained by me during the development of the Debian Sarge installer. In the meantime, the information contained herein has been integrated into the Debian installation manual:

I want to thank everyone who sent me hints and corrections to this page.


This document applies only to Debian Sarge on the i386 architecture. For a successful installation on such a system, you will need:

Obtaining the files

The files required for booting from a USB stick can be found in the main/installer-i386/current/images directory of the Debian distribution. There you will find some subdirectories for different boot media. If you want to use the USB stick only for booting and then to fetch the packages of the base system over the network (from a Debian mirror), you should change to the netboot directory. If you want to install the base system from a Debian ISO image contained on the USB stick, then choose the hd-media directory.

Preparing the stick

For preparing the USB stick you will need a system where Linux is already running and where USB is supported. You should assure that the usb-storage kernel module is loaded (modprobe usb-storage) and try to find out which SCSI device the USB stick has been mapped to (in this example /dev/sda is used). To write to your stick, you will probably have to turn off its write protection switch.

In order to start the kernel after booting from the USB stick, we will put a boot loader on the stick. Although any boot loader (e.g. LILO) should work, it's convenient to use SYSLINUX, since it uses a FAT16 partition and can be reconfigured by just editing a text file. Any operating system which supports the FAT file system can be used to make changes to the configuration of the boot loader. Since most USB sticks come pre-configured with a single FAT16 partition, you probably won't have to repartition or reformat the stick. If you have to repartition it anyway, start cfdisk or any other partitioning tool and create a FAT16 partition.

Copying the files - the easy way

There is an all-in-one file which contains all the installer files (including the kernel) as well as SYSLINUX and its configuration file. It resides in the hd-media subdirectory of the Debian installer images directory and is called boot.img.gz. You only have to extract it to the FAT partition on your USB stick:

    zcat boot.img.gz >/dev/sda1

Again, take care that you use the correct device name for your USB stick.

After that, mount the partition on your USB memory stick (mount /dev/sda1 /mnt) and copy a Debian netinst or businesscard ISO image to it (please note that the file name must end in .ISO).

Partitionless installation: Instead of /dev/sda1 you may also use /dev/sda as your target. This leaves your stick without a partition table so that it will contain only the file system. The advantage of this method is that you don't have to rely on the existing (and possibly buggy) master boot record (MBR) of your USB stick. But be aware that you won't be able to access your stick using some third-party operating systems.

Copying the files - the more flexible way

If you like more flexibility or just want to know what's going on, you should use the following method to put the files on your stick:

Unless you have already a FAT16 file system on your stick, use

    mkdosfs /dev/sda1

to create one. Take care that you use the correct device name for your USB stick. The mkdosfs command is contained in the dosfstools Debian package.

To put SYSLINUX onto the partition, install the syslinux and mtools packages on your system, and type

    syslinux /dev/sda1

Again, take care that you use the correct device name. The partition must not be mounted when starting SYSLINUX. This procedure writes a boot sector to the partition and creates the file ldlinux.sys which contains the boot loader code.

Note: Although the Debian syslinux package does not officially depend on mtools, it definitely needs mtools to write to the FAT file system.

Mount the USB memory stick (mount /dev/sda1 /mnt), choose a Debian installer subdirectory as explained above and copy the following files to the stick:

If you want to rename the files, please note that SYSLINUX can only process DOS (8.3) file names.

The syslinux.cfg configuration file should contain the following two lines:

default vmlinuz
append initrd=initrd.gz ramdisk_size=10240 root=/dev/rd/0 devfs=mount,dall rw DEBCONF_PRIORITY=medium

The DEBCONF_PRIORITY=medium lets the installer ask some additional questions which might be useful, but you may of course leave this option out.

Now you may put any Debian ISO image (businesscard, netinst or even a full one) onto your stick (if it fits). The file name of such an image must end in ".iso". If you want to install over the network, you will of course skip this step.

Finally the directory listing of the USB stick could look somewhat like this:

drwxr-xr-x    2 root     root        16384 Jan  1  1970 .
drwxr-xr-x   25 root     root         4096 Aug  6 23:03 ..
-rwxr-xr-x    1 root     root      2554051 Nov 10 14:15 initrd.gz
-r-xr-xr-x    1 root     root         7828 Nov 10 14:15 ldlinux.sys
-rwxr-xr-x    1 root     root    117735424 Nov 10 14:16 netinst.iso
-rwxr-xr-x    1 root     root          140 Nov 10 14:16 syslinux.cfg
-rwxr-xr-x    1 root     root       769886 Nov 10 14:16 vmlinuz

When you are done, unmount the USB memory stick (umount /mnt) and activate its write protection switch.


Now connect the USB stick to the target system, boot it, enter the BIOS setup program and change the boot device to USB-ZIP. If everything works, SYSLINUX will load the kernel and the initial ramdisk, and the Debian installer will start.


If your system refuses to boot from the USB stick, the stick may contain an invalid master boot record (MBR). To fix this, use the install-mbr command from the package "mbr" (thanks for this tip to Marco d'Itri). If your USB stick is mapped to /dev/sda, remove the write protection and type

    install-mbr /dev/sda

Important: Don't use install-mbr if you did a partitionless installation as mentioned above.

If you don't have the "mbr" package, you may also use lilo for that purpose (thanks to Henning Verbeek):

   /sbin/lilo -M /dev/sda

Hardware list

The USB based installation has been reported to work on the following systems:


Andreas John (,

I report to make a USB Stick work on a K7VMM Mainboard. There are two things you should take care for:

This particular Board has an AMIBIOS V 1.21.12. The Feature Setup in BIOS-Setup allows you to To enable/disable USB at all but also to enable "USB Device Legacy Support" and support for a "ThumbDrive Suppor for DOS". You will need to enable this to make the stick boot. I guess that there are some BIOSes out, which have similar features, so Keep you eyes open!

Another hint I want to give is that with many BIOSes you may press F8 shortly after POST (Power On Self Test, this is what "beeps" several times if your hardware is corrupt) to get in some kind of boot-menu, which lets you choose your preferred boot drive. There you can see your USB Stick by name. Mine is of type "USB RMD-FDD". If you don't get it there something is wrong with your hardware. If you are able to choose the device, but it doesn't boot, there is probably something wrong with the boot loader. Please check twice if you /dev/sdX device holds all neccessary files: syslinux, initrd, vmlinuz. boot.img.gz I took had no kernel on it! So I copied initrd and vmlinuz from the netboot directory onto /dev/sdX.

Adrian Bader:

I have a MSI K8T-Neo Mainboard (for AMD64) with via K8T800 chipset and it works properly.

It is important to enable these three things: USB in general (which is usually the case), "boot from other devices" and "USB Legacy Support" for "all Devices". Then we can press F11 during the bootup, which pops up the table to select the prefered boot device. There we can select the USB Memory Stick.

Daniel Freedman:

After successfully working through the process, I'd like to offer a key hint/alternative that enabled success on my new IBM Thinkpad X31, when all else specified on the page failed.

It deals with the establishment of the MBR on the USB key to enable initial boot of the filesystem. For various reasons (mainly lack of space on my memory stick), I was not using the monolithic 'zcat boot.img.gz >/dev/sda1' process, but instead the more flexible method of individually copying the files. Unfortunately, when my stick refused to boot, the MBR installation process so detailed did not succeed. I tried 'install-mbr /dev/sda' using Debian's 'mbr' package, but it was to no avail. I continued to try various alternative with 'syslinux -s' for the safe-stupid install, reformatting, etc. The only success I found was through using Syslinux's own simple MBR, rather than that included as part of Debian's 'mbr' package. Unfortunately, the Debian 'syslinux' package inexplicably does not include the 'mbr.bin' file from upstream, so here's what I did:

  1. Get Syslinux source ('wget')
  2. Extract Syslinux MBR file ('tar xjvf syslinux-3.11.tar.bz2 syslinux-3.11/mbr.bin')
  3. Install known good Syslinux MBR on stick ('cat syslinux-3.11/mbr.bin > /dev/sda')

After that, everything worked perfectly...

Wasfi Jaouad:

actually there is no need for an already running Linux. I did it from my XP OS. I used WinImage to write boot.img to my USB pen. For some reason, after writing the image, W$ reported the pen to be FAT32! And "Boot failed". I formated it to FAT (FAT16) and rewrote the image. Then it booted flawlessly. And the fun started (-:

Stefan Kalter:

I have used your howto on making an usb debian installation drive. I found that one addition should be made. I installed as you described in the flexible way and added a netinst iso. It booted and started installing, but when the installer tried to load modules, it stopped, telling me the kernels were not the same. (the loaded on and the one in the netinst iso) It might be wise to mention here that you should use both the latest installer files as well as the latest netinst iso. Both can be found here:

The basic files (vmlinuz and initrd.gz) can be found under "other images (netboot, usb stick, floppy, etc)" , the iso I used was under "netinst (generally 135-175 MB) and businesscard (generally 20-50 MB) CD images".

Last updated: 2008-02-14. Site owner: Pascal Le Bail /