Preparing the installer

Now that you have an installation image, we are almost ready to roll. But first the image needs to be burned/copied onto a removable medium, from which you can boot, such as a CD/DVD-R(W), or USB stick.

Burning CD or DVD

This one should be an easy task, if you are old enough. Remember the time, when burning disks were as much a part of everyday reality as rewinding VHS tapes was a decade earlier? Yeah, I know, now you feel old, and you blame me for it. But let's face it, if burning a CD sounds like routine, you probably are getting old.

A Compact Disk, or CD. If its sight does not horrify you, you are probably old.

We'll just assume that y'all know what you are doing, when it comes to burning an image to a disk. It could not be simpler: Open the image in the appropriate disk burning tool (software), select the disk drive with the writeable disk, and go.

If you are just too young to have such ancient practical skills (might as well ask you to make stone tools, eh?), or to even know what "burning a disk" means other than throwing it into the fire, read on. USB installations are the way to go and they also tend to be a lot faster.

Preparing a USB flashdrive

Call it "pendrive", "thumb drive", "flash drive", or whatever name you fancy, these little things have been around long enough so that the older ones amongst us have probably also learned how to use them.

A pendrive. If you know what the previous object was, and don't recognise this, you definitely are VERY old.

The following steps will erase all data from your USB drive, so make sure you save/backup anything you might need later.

Choose your operating system to see instructions

On Windows, you will need a software tool to write the downloaded image to disk. The Debian website recommends using Win32 Disk Imager.

Win32 CD Imager Image: Sourceforge.net

Using this software tool is really straightforward. You select the downloaded image file, and your USB device, then press "Write". The tool also allows you to generate and copy a hash (checksum), so that you can verify the image. Ideally, you would already have done this in the previous chapter, but it's never too late.

If you are looking for a more sophisticated tool for greater control, you can try Rufus. A detailed guide about using Rufus can be found in this excellent Lifewire tutorial.

It's worth noting that the Debian manual advises against using tools that can alter the image, so you should only use Rufus if you know what you are doing.

Linux offers many ways to prepare a bootable USB. Debian's hybrid images can be simply copied over, or you can copy files manually. GUI tools that can make the process even simpler, also exist.

Find your USB device

First, you need to find the device your USB stick is mapped to. It will be something like /dev/sdc, or /dev/sdb, etc.

In this tutorial will be marked as dev/sdX, where X should be replaced with the appropriate letter.

To find the appropriate letter, you should insert your USB stick, and mount it if you need to. Then you have many options. The easiest is to type dmesg right after inserting the drive and check the last few lines of output. They would look something like this:

$ dmesg

...

[12425.416613] usb-storage 1-1:1.0: USB Mass Storage device detected
[12425.416822] scsi host6: usb-storage 1-1:1.0
[12425.417022] usbcore: registered new interface driver usb-storage
[12425.433035] usbcore: registered new interface driver uas
[12426.417737] scsi 6:0:0:0: Direct-Access     Generic  Flash Disk       8.07 PQ: 0 ANSI: 2
[12426.418395] sd 6:0:0:0: Attached scsi generic sg3 type 0
[12426.420020] sd 6:0:0:0: [sdc] 8226816 512-byte logical blocks: (4.21 GB/3.92 GiB)
[12426.420648] sd 6:0:0:0: [sdc] Write Protect is off
[12426.420655] sd 6:0:0:0: [sdc] Mode Sense: 03 00 00 00
[12426.421266] sd 6:0:0:0: [sdc] No Caching mode page found
[12426.421271] sd 6:0:0:0: [sdc] Assuming drive cache: write through
[12426.473112]  sdc: sdc1
[12426.476781] sd 6:0:0:0: [sdc] Attached SCSI removable disk
$

The interesting bits come after the line "USB Mass Storage device detected". Dmesg will basically tell you everything you need to know about the device. The most important lines are the one that says: [12426.420648] sd 6:0:0:0: [sdc] Write Protect is off

This single line tells us that the USB device is called sdc, meaning you will refer to is as /dev/sdc (basically wherever /dev/sdX is written, just replace it with /dev/sdc), and that write protection on the device is turned off, so you are good to go. If it says "Write Protect is on", you must turn it off first.

Chances are, your USB drive is not write protected, if you use it regularly (otherwise you could only read from it.) If for any reason write protection would be on, use hdparm to turn it off, like this

sudo umount /dev/sdX
sudo hdparm -r0 /dev/sdX

where /dev/sdX is replaced by the appropriate drive name, as seen above. Then either just remove and re-insert the USB drive, or remount with the mount command.

Always be careful when using low-level tools with elevated privileges!

Finally, copy the image onto the USB

The easiest way is to simply copy the iso image onto the drive. Debian's hybrid images can be booted directly, so this should suffice for most uses. You need to unmount the drive first, copy the image directly to it (not to any partition), which will overwrite its current contents, the call sync to finish any delayed disk writes, like so:

sudo umount /dev/sdX
cp debian-image-file-name.iso /dev/sdX
sync

And you are ready to go.

You do of course have other options. Linux is all about options. But if you want to (and can) go with sophisticated methods which offer many different options, you probably don't need this manual at all.

Manually copying files

This method will give you a little more control over what happens, but in turn, it is a lot more complicated. The official Debian installation guide says:

There is an all-in-one file hd-media/boot.img.gz which contains all the installer files (including the kernel) as well as syslinux and its configuration file.

Problem is, they don't exactly tell you where the above file can be found. To download the file, choose from the following locations:

  • For 64bit architectures, check here
  • For 32 bit architectures, check here

Once you have it, you should extract it to your USB stick

sudo zcat boot.img.gz > /dev/sdX

Then the manual advises to

mount the USB memory stick (mount /dev/sdX /mnt), which will now have a FAT filesystem on it, and copy a Debian ISO image (netinst or full CD) to it. Unmount the stick (umount /mnt) and you are done.

The Debian manual also warns that this method will limit the USB drive's capacity to 1GB, regardless of its physical size. if you want to re-use it, you will need to reformat/repartition it.

GUI tools

There are several GUI tools for burning ISO images to pendrives, one of the most popular being unetbootin. Debian explicitly advises its users not to use tools like unetbootin, for they alter the image.

You might be safer with Ubuntu's Startup Disk Creator, but the best would still be to stick to the command line (see the first option).

More resources

If you are interested in some more sophisticated methods, head over to the Debian website and read the appropriate chapter from the official Debian installation manual. The following link is for the amd64 (64bit CPUs) version of the book, but the instructions should be the same for 32 bit as well.

Link: Preparing Files for USB Memory Stick Booting (Official Debian Handbook)

As your humble author has no access to a Mac (or even a Macbook), these instructions are missing and will remain absent until somebody either gives me a lot of money or donates such a computer.

To be honest, I once thought about buying a Mac. I had the money together. Then I thought better of it, and from the same money I bought a house, a car, went for a long holiday, then from the remainder I bought a powerful PC, which I'm using to write this right now. But I'm sure Macs are worth it.