2.1. Preparing Installation Media

Installation begins before the target machine boots. The media must contain a trustworthy installer, the machine must be able to boot it, and the firmware mode must match the layout the installer will create. Figure 2.1 shows the whole path and the points where a choice changes a later step.

Installation path and decision points

Figure 2.1. The installation path and its main decision points. The right-hand notes describe choices, not additional steps; the diagram is conceptual.

The installer is not one monolithic program. It boots a small environment, detects hardware, loads the components it needs, and then asks questions. Most screens offer a Go Back button, so a wrong mirror or keyboard layout does not require starting over. Disk changes are different: once the partition table and filesystems are written, the previous contents of the selected disk may be gone.

2.1.1. Choosing Installer and Live Images

Debian publishes several kinds of images for amd64. They contain the same installer but differ in how much software they carry and how much they expect to download. The netinst image is the usual choice for a server, a virtual machine, or any installation where the package selection will be customized. It contains the installer and the base system; desktop and server tasks come from a mirror during the task-selection stage.

Image Approximate size Contains Network needed Best for
netinst 756 MB for 13.7 amd64 Installer and base packages Yes, for tasks Servers, virtual machines, custom installs
DVD-1 Several GB Installer and many packages Optional Installations with a poor or absent network
Full DVD/BD set Tens of GB Most of the archive No Rare fully offline installations
Live (GNOME, KDE, Xfce, and others) Several GB A complete desktop session and an installer Optional Evaluating hardware or installing a desktop
netboot Small Installer boot files only Yes PXE and automated fleet installations
hd-media Small Installer boot files plus an ISO on an existing disk No Machines that cannot boot USB or optical media

The size of the netinst image changes with each point release, so use the size and checksum published for the current release rather than the number above. The amd64 architecture covers 64-bit Intel and AMD systems; arm64 covers 64-bit ARM systems. Choose the architecture that matches the target machine, not the architecture of the workstation used to download the image.

Official Debian installation images since Debian 12 include non-free firmware packages, so common Wi-Fi and graphics hardware works without preparing a separate firmware medium. Not every device is covered; if a device still needs firmware that is absent, the installer offers to load it from removable media, as described in Section 2.2.2.

A live image is useful when the first question is whether the hardware works at all: it boots a complete desktop session, exercises the graphics, audio, and network devices, and offers an installer. A live session carries a desktop and its dependencies, while a netinst installation can select only the tasks the machine needs, so a live image is not a substitute for a planned server installation. The rest of this chapter uses the netinst image as the baseline and notes where a DVD or live image changes the procedure.

2.1.2. Verifying Image Checksums and Signatures

A checksum answers a narrow question: does this file have the same bytes as the file described by a particular line in a checksum list? It does not by itself establish who produced the list. Debian therefore publishes the checksum list with a detached signature, and the signature must be checked before the list is trusted. The two checks together establish that an image matches an authenticated list.

The examples keep downloads, checksum files, and practice data in a workspace under john's home directory. Create it; the command is silent when it succeeds, and -m 700 keeps the directory readable only by john.

$ mkdir -m 700 -p ~/debian-handbook/installation

Make the workspace the working directory for the media examples, so the files that follow can be named with short relative paths.

$ cd ~/debian-handbook/installation && pwd
/home/john/debian-handbook/installation

The cd command is silent on success; pwd confirms the shell now works there. ~ expands to /home/john in john's shell. Confirm the ownership and permissions of the workspace as well.

$ ls -ld ~/debian-handbook/installation
drwx------ 2 john john 4096 Nov 18 06:57 /home/john/debian-handbook/installation

Download the signed checksum index for the current amd64 CD images. wget is quiet in this form, so a successful download produces no terminal output.

Option Description
-q Quiet mode; suppress progress and most messages.
-O file Write the downloaded data to file instead of a derived name.
-c Continue a partial download when the server supports it.
$ wget -q -O SHA256SUMS https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/SHA256SUMS

The current directory follows the current point release. Read the lines for the netinst images from the file that is now in the workspace; this is a filter over the downloaded text, not a second download.

$ grep amd64-netinst SHA256SUMS
a7ef94ac2fb9a7fec454552abd629b7cc9d5155c886165a45649f5ce6167e355  debian-13.7.0-amd64-netinst.iso
d33ed0c64bde5ff43445c0c530f9da599954d8585771c55345cb840d7997d4a7  debian-edu-13.7.0-amd64-netinst.iso
d6d4e0d038936230229a66b7c1765452e73c72a962e79dbb99544882295271e8  debian-mac-13.7.0-amd64-netinst.iso

Each line is a 64-character SHA-256 digest, two spaces, and a file name. The first line is the ordinary netinst image, the second is the Debian Edu variant, which adds a menu entry for installing the Debian Edu Pure Blend, and the third is a variant for older Intel Macs that omits some UEFI boot files. These lines change when a point release changes; compare against the index downloaded at the same time, never against a digest memorized from an earlier release.

Download the detached signature for the checksum file. It is silent for the same reason as the first download.

$ wget -q -O SHA256SUMS.sign https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/SHA256SUMS.sign

The verifier needs the keyring that holds the Debian CD signing key. On a Debian workstation it is provided by the debian-keyring package, whose /usr/share/keyrings/debian-role-keys.gpg file collects the keys Debian uses to sign releases and installation media. It is a different keyring from the one that signs APT repositories, so an archive keyring will not verify this file. gpgv checks the signature against the named keyring and writes its result to the terminal as standard error.

Option Description
--keyring file Read trusted keys from file instead of the default keyring.
--status-fd n Write machine-readable status lines to file descriptor n.
--quiet Suppress the normal summary; rely on the exit status.
--verbose Print more detail about the signature and keys.
$ gpgv --keyring /usr/share/keyrings/debian-role-keys.gpg SHA256SUMS.sign SHA256SUMS
gpgv: Signature made Sat Sep 12 16:20:46 2026 UTC
gpgv:                using RSA key DF9B9C49EAA9298432589D76DA87E80D6294BE9B
gpgv: Good signature from "Debian CD signing key <debian-cd@lists.debian.org>"

Good signature means the signature matches the bytes of the checksum file and a key in the named keyring; the keyring supplied by Debian is the trust anchor for this check, and the command exits 0. If the keyring path does not exist, install debian-keyring first and repeat the check.

To see what the signature actually protects, change one character in a copy of the checksum file. The copy is silent, as cp normally is.

$ cp SHA256SUMS SHA256SUMS.tampered

The next command is also silent. sed -i edits the copy in place; the expression replaces the first character of the first line - the first digit of the netinst digest - with 0, leaving the rest of the file unchanged.

$ sed -i '1s/^[0-9a-f]/0/' SHA256SUMS.tampered

Verify the tampered copy with the same signature.

$ gpgv --keyring /usr/share/keyrings/debian-role-keys.gpg SHA256SUMS.sign SHA256SUMS.tampered
gpgv: Signature made Sat Sep 12 16:20:46 2026 UTC
gpgv:                using RSA key DF9B9C49EAA9298432589D76DA87E80D6294BE9B
gpgv: BAD signature from "Debian CD signing key <debian-cd@lists.debian.org>"

The signature covers the exact bytes of the checksum file, so the single changed character produces BAD signature, and the command exits 1. Never write an image whose checksum index fails this check. Re-verify the original to confirm the download itself is still intact.

$ gpgv --keyring /usr/share/keyrings/debian-role-keys.gpg SHA256SUMS.sign SHA256SUMS
gpgv: Signature made Sat Sep 12 16:20:46 2026 UTC
gpgv:                using RSA key DF9B9C49EAA9298432589D76DA87E80D6294BE9B
gpgv: Good signature from "Debian CD signing key <debian-cd@lists.debian.org>"

Now that the list is authenticated, the image itself can be checked. The following exercise uses a small local file to show how sha256sum --check behaves on a good and on a damaged download; it is a stand-in for the ISO, not an installer image, and the digest printed below is not an installer checksum.

Option Description
--check Read checksum lines and verify the named files.
--ignore-missing Do not fail for files named in the list but absent locally.
--status Produce no output; report only through the exit status.
--quiet During --check, print only failures.

Write the fixture with a redirection. The redirection writes the string to the file; the terminal receives nothing.

$ printf 'Debian installation media verification fixture\n' > installer-media-fixture.img

Compute the fixture's digest.

$ sha256sum installer-media-fixture.img
57a2334dc513069e27f069cac1e55c3d50dd36ac5290f8a9c17565ae16557c23  installer-media-fixture.img

The first field is the digest and the second is the file name, in the same format as the signed index. Save the line in a checksum file with >; the redirection is silent.

$ sha256sum installer-media-fixture.img > installer-media-fixture.sha256

Read the checksum file back and recompute the digest. The result is OK because the file still has the bytes that produced the recorded value.

$ sha256sum --check installer-media-fixture.sha256
installer-media-fixture.img: OK

Now damage the fixture. The >> redirection appends instead of replacing; it also writes nothing to the terminal.

$ printf 'corruption\n' >> installer-media-fixture.img

Check the same checksum file again.

$ sha256sum --check installer-media-fixture.sha256
installer-media-fixture.img: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match

The failure line goes to standard output and the warning to standard error; the command exits 1 because at least one file failed. A mismatch on a real download means the image is incomplete or corrupt. Download it again and repeat both checks - the signature check on the index, then the checksum comparison. A signature failure is more serious than a checksum failure: do not use the image or the index, re-download both, and investigate before writing anything to removable media.

For a real image, put the ISO in the workspace next to the authenticated SHA256SUMS and compute its digest.

$ sha256sum debian-13.7.0-amd64-netinst.iso

The command prints a 64-character digest and the file name; compare it with the signed debian-13.7.0-amd64-netinst.iso line shown earlier. With the image and the index in the same directory, sha256sum --check --ignore-missing SHA256SUMS performs the same comparison and skips entries for images that are not present. The 756 MB image download was outside this example, so no ISO digest is shown here; the fixture digest above must never be used as an installer checksum.

2.1.3. Writing USB Media and Selecting UEFI or Legacy Boot

A Debian CD/DVD image is isohybrid: it can boot from optical media and can also be written directly to a USB stick. Writing it is a whole-device operation. The stick's existing partition table, filesystem, and data are replaced by the image's contents.

Identify the device before writing anything. lsblk lists block devices and their mount points.

Option Description
-o list Select the columns to print, in order.
-f Show filesystem type, label, UUID, and usage.
-d Show disks only, omitting partitions and other children.
-p Show full device paths.
$ lsblk -o NAME,SIZE,MODEL,TRAN,TYPE,MOUNTPOINTS
NAME    SIZE MODEL TRAN   TYPE MOUNTPOINTS
vda     100G       virtio disk 
└─vda1  100G       virtio part /

The example machine has one virtual disk and no removable device, so the TRAN column shows the virtio transport. On the workstation with the USB stick, run the command before and after inserting the stick: the new device with transport usb, a size that matches the stick, and a model string is the candidate. Check size and model rather than the letter, because names such as sdb can change when other devices are added or removed.

Unmount every mounted partition of the stick before writing. The example machine has no removable device, so the following steps are the documented procedure for a workstation that has one. The exact partition name depends on the stick; /dev/sdX1 below stands for the partition observed with lsblk.

$ sudo umount /dev/sdX1

The command is silent when it succeeds and reports an error if the partition was not mounted.

The next command overwrites the entire device, including its partition table. A mistake destroys the data on whatever disk is named. Confirm that /dev/sdX is the USB stick - not the system disk and not a data disk - and that no partition on it is mounted.

$ sudo cp debian-13.7.0-amd64-netinst.iso /dev/sdX

The copy is silent unless it fails; the prompt returns when cp has finished writing. Flush the kernel's cached writes so the stick can be removed safely.

$ sudo sync

This command is also silent. Write to the whole-disk device, /dev/sdb, not to a partition such as /dev/sdb1. Do not use tools that unpack or modify the image: the isohybrid boot record depends on the image being written unchanged.

The firmware mode determines what the installer must create on the disk. The same check works in the installed system and in an installer shell.

$ [ -d /sys/firmware/efi ] && echo UEFI || echo BIOS
BIOS

The directory /sys/firmware/efi exists only when the running kernel was started by UEFI firmware; its absence means the machine booted through BIOS or a legacy compatibility module. The shell operators work as one decision: && runs echo UEFI only if the test succeeds, and || runs the other branch if it does not. The example machine booted through BIOS.

Aspect BIOS/legacy UEFI
Partition table MBR is common; GPT needs a BIOS boot partition GPT with an EFI system partition is typical
Boot loader location GRUB stage 1 in the MBR, more code in the post-MBR gap or /boot GRUB EFI binary on a FAT32 ESP, plus a boot entry in firmware NVRAM
Check /sys/firmware/efi absent; efibootmgr reports no EFI variables /sys/firmware/efi present; efibootmgr -v lists entries
Secure Boot Not applicable Firmware may require a signed shim, GRUB, and kernel

The installer's boot menu offers the same entries in either mode, although the screen and the key used to edit a boot entry differ. On a machine with both modes enabled, choose one deliberately: an installation laid out for UEFI that is later booted in legacy mode, or the reverse, will not find the boot loader it expects. If the stick is not listed as a boot device, enable USB boot in firmware setup and put the stick ahead of the internal disk for the installation boot. Figure 2.2 shows how the two firmware paths converge on the same GRUB menu.

BIOS and UEFI boot paths

Figure 2.2. BIOS/MBR and UEFI/GPT+ESP paths to the GRUB menu. The solid path was observed on the example machine; the UEFI branch is documented and conceptual.

The example machine booted through BIOS and its disk uses an MBR, so the rest of the chapter describes the BIOS path where the boot loader is concerned. A UEFI installation creates an EFI system partition, formats it FAT32, and writes a boot entry into firmware storage; Chapter 7 covers GRUB and firmware entries in detail.