Image of the glider from the Game of Life by John Conway
Skip to content

Installing Debian via USB

Last night, I wanted to see if I could get Debian Squeeze loaded on my HP Mini 110, so I set out to accomplish the task, and accomplish it I did. As with most netboks, this HP doesn't ship with a CDROM. So, the only way to get an operating system on this guy is either with PXE, or USB (actually, I don't even know if PXE-booting works). So, I grabbed an unused USB thumb drive, and set to work.

Before beginning any installation, you should be very familiar with your hardware, so you know what sort of drivers you'll need for the installation, and if there will be any compatibility issues. Attempting to put Debian on this machine in the past has failed, due to the network driver not shipping with the Lenny kernel. If you have this netbook, the NIC is an Attansic Technology Atheros AR8132/L1c gigabit ethernet adapter. The driver is open source, however, the hardware is so new, that at the time I had purchased the Mini, the driver hadn't been included in the mainline kernel. The wireless is a Broadcom BCM4132, which means the firmware is not open source, and as a result, not included with the Debian installer. So, at the time, there was no way to get this netbook online with Debian. However, with the release of the 2.6.29 kernel, the Aetheros driver needed was included, and the development snapshot of the installer now ships that kernel, so we're good to go with a network installation, and getting the computer online.

All the other hardware that I've tested, I have tested before with different hardware other than the Mini, and worked out of the box. So, the installation should be rather straightforward, and booting in the new system should be on par with a working system.

So, in order to perform a Debian GNU/Linux installation via USB, you need only a few things. First, you must grab a boot.img.gz file from the development snapshot of the installer for your hardware. Because the HP Mini is x86 32-bit, I grabbed mine here. Now, you also need a CD image file (ISO format) which will contain the necessary software and installation procedures for the install. I prefer to do network installs, so I grabbed a netinst ISO here.

The boot.img.gz file will contain a bootable syslinux kernel and initial ramdisk, which means it will have the drivers necessary for your hardware. Of course, I got mine from a development snapshot, so I could get the Atheros NIC driver from the latest kernel, but if you have older hardware, maybe the stable version of the boot.img.gz would work better for you. You just need to get it from any hd-media directory appropriate for your architecture. The ISO on the other hand contains the base software for installing to disk, the partitioner and other parts of the installer necessary for performing the installation. The boot.img.gz just gets you started.

Now that you have both files, you'll need a USB thumb drive that is at least 256MB in size, which shouldn't be a problem these days. Insert the USB drive into a computer with a working Linux operating system, and determine the appropriate device assigned to your newly inserted drive. You can get this information a number of ways. Probably the best way, is to run the following command before you insert the USB drive:

# tail -f -n 0 /var/log/messages

Then, insert the drive. You'll see output from the kernel as it discovers the hardware and assigns a device to the drive. For me, my output was this:

Feb 21 08:22:28 hermes kernel: [46103.644130] usb 1-7: new high speed USB device using ehci_hcd and address 7
Feb 21 08:22:28 hermes kernel: [46103.789569] usb 1-7: New USB device found, idVendor=13fe, idProduct=1e00
Feb 21 08:22:28 hermes kernel: [46103.789586] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb 21 08:22:28 hermes kernel: [46103.789599] usb 1-7: Product: USB DISK 2.0    
Feb 21 08:22:28 hermes kernel: [46103.789609] usb 1-7: Manufacturer:         
Feb 21 08:22:28 hermes kernel: [46103.789618] usb 1-7: SerialNumber: 077904015F40
Feb 21 08:22:28 hermes kernel: [46103.789974] usb 1-7: configuration #1 chosen from 1 choice
Feb 21 08:22:28 hermes kernel: [46103.790939] scsi5 : SCSI emulation for USB Mass Storage devices
Feb 21 08:22:33 hermes kernel: [46108.838495] scsi 5:0:0:0: Direct-Access              USB DISK 2.0     PMAP PQ: 0 ANSI: 0 CCS
Feb 21 08:22:33 hermes kernel: [46109.101380] sd 5:0:0:0: [sdb] 4030464 512-byte logical blocks: (2.06 GB/1.92 GiB)
Feb 21 08:22:33 hermes kernel: [46109.101984] sd 5:0:0:0: [sdb] Write Protect is off
Feb 21 08:22:33 hermes kernel: [46109.107382]  sdb:
Feb 21 08:22:33 hermes kernel: [46109.174851] sd 5:0:0:0: [sdb] Attached SCSI removable disk

So, in my case, the newly inserted drive is /dev/sdb. So, armed with this information, I can now prepare the USB drive. This next step should be handled with caution. If you type in, whether intentionally or accidentally the wrong device, disasterous consequences may abound. As a friend once told me: "read twice, type once". Think what you're doing before you do it. So, at this point, I just need to send the contents of the boot.img.gz file to the new disk. I would not recommend doing it to a partition, but instead doing it to the whole drive. If you inserted your thumb drive, and you noticed in the output that you have a /dev/sdb and /dev/sdb1, then this means you have a partition table outlining a single partition on the drive /dev/sdb. Ignore the partition, work with the drive itself.

Make sure your USB drive is NOT mounted, then type in the following (this next step will remove any existing partitions and data on the drive):

# umount /dev/sdb*
# zcat boot.img.gz > /dev/sdb

This should only take a couple of seconds to finish. At this point, you'll have a FAT16 formatted USB drive with a syslinux install on the drive. You will now need to mount the drive and copy the ISO image to the mount point.

# mount /dev/sdb /mnt
# cp debian-504-i386-netinst.iso /mnt
# sync
# umount /dev/sdb

At this point, you have a fully prepared USB thumb drive with all the necessary bits in place to perform a USB installation on your netbook, or other hardware. When you boot from the USB stick, you'll have the familiar Debian installer interface- automated installation, beginner and expert modes and a rescue environment. Because of this, I would recommend keeping the USB stick close at hand, should you need to troubleshoot your installation any time soon.

When you initialize the installation, the installer will look for an ISO file that contains the Debian software. It will start with /dev/sda, and work it's way device-by-device and partition-by-partition in order, until it finds the ISO file. Because my drive is also recognized as /dev/sdb on my netbook, it only take a couple seconds. After it has found the ISO image, you're ready to install, just like you would if you had booted off a CD.

That's it! Rather straightforward, I think. You only need four times really to complete the job:

  • You computer
  • A USB disk
  • A boot.img.gz file
  • An ISO containing the Debian software

Good luck on your USB installs!

{ 7 } Comments

  1. Debian using Galeon 2.0.7 on Debian GNU/Linux 64 bits | February 21, 2010 at 8:20 pm | Permalink

    Please contribute to this:

    http://wiki.debian.org/InstallingDebianOn

  2. Aaron using Google Chrome 5.0.307.9 on GNU/Linux | February 21, 2010 at 9:27 pm | Permalink

    I would love to contribute, but I just don't have the time. I barely have the time to post to my blog on a weekly basis. Maybe I can get around to it when I'm out of school, but that's still a couple months out

  3. BUGabundo using Google Chrome 5.0.336.0 on GNU/Linux 64 bits | February 22, 2010 at 4:05 am | Permalink

    so much work to re-invent the wheal.
    http://unetbootin.sourceforge.net/
    http://www.netboot.me/
    http://boot.kernel.org/

  4. Aaron using Google Chrome 5.0.322.2 on GNU/Linux 64 bits | February 22, 2010 at 4:10 am | Permalink

    @BUGabundo Yeah, I would agree that the links you provided are far too much work than just typing a few commands at the prompt, and rebooting.

  5. Debianero Rumbero using Debian IceWeasel 3.5.6 on Debian GNU/Linux | February 22, 2010 at 12:39 pm | Permalink

    Another step forward Debian World Domination ;-)

  6. Rambetter using Debian IceWeasel 3.0.6 on Debian GNU/Linux 64 bits | September 1, 2010 at 10:53 pm | Permalink

    I love your tutorial on installing Debian from USB stick. It's wonderfully explained.

  7. Mr. Jan Hearthstone using Firefox 12.0 on GNU/Linux | May 29, 2012 at 3:47 pm | Permalink

    Thank you!
    Hearthstone.

{ 3 } Trackbacks

  1. [...] the task, and accomplish it I did. As with most netboks, this HP doesn’t ship with a CDROM More here Before beginning any installation, you should be very familiar with your hardware, so you know what [...]

  2. [...] Installing Debian via USB [...]

  3. [...] finally, worked: I used (g)parted to erase and partition the stick. Then I followed instructions at http://pthree.org/2010/02/21/installing-debian-via-usb/ and got me a stick that I can install a Debian Squeeze with on wireless, using [...]

    [WORDPRESS HASHCASH] The comment's server IP (74.86.156.58) doesn't match the comment's URL host IP (75.126.162.205) and so is spam.

Post a Comment

Your email is never published nor shared.

Switch to our mobile site