Debian installer
Debian installer on USB pen-drive using Grub 2
Intro
This tutorial will show how to prepare a USB pen-drive with a bootable Debian Installer image.
NOTE: in the past, we would like to use ISO images named 'unofficial'. Those images from the debian.org site are tagged as unofficial only because they contain non-free firmware usually useful to have something like wireless drivers working without have to do more work. Recently (from Debian Bookworm) non-free drivers are included in the default images and we don't need the 'unofficial' ones anymore.
Take a look at https://cdimage.debian.org/images/release/current/amd64/iso-dvd/ to choose your iso image.
In this example, we will use the stable image from the follow link:
USB pen-drive partition
- partition the pen-drive
If you follow the previous link steps, you should end up with 4 partitions, already formatted.
The first partition is to avoid problems, as the "world" expects the first partition to be a VFAT. You can still use it as a normal pendrive.
The second must configured to use Grub to boot a Debian Installer image, and the third must contain the installer image.
Prepare the second partition for Grub
See Grub#For_BIOS_partition_table_(MBR) and Grub#Configuration
If you follow the previous links steps, you should end up with a bootable pendrive, that can be further configured to boot Debian Installer. Let's do that.
- Edit the content of /tmp/sdX2/boot/grub/menu.cfg :
menuentry "Debian GNU/Linux Install USB iso image with hd-media" { set isofile="/images/debian-install.iso" search --file --no-floppy --set=root $isofile loopback loop $isofile linux /hd-media/gtk/vmlinuz iso-scan/filename=$isofile i915.modeset=1 i915.lvds_channel_mode=2 i915.lvds_use_ssc=0 initrd /hd-media/gtk/initrd.gz }
Moreover, Debian Installer startup files (the vmlinuz kernel and the initrd.gz image) from the iso cdrom expect the use of the iso image as the root filesystem, so they will not work with the iso image inside a partition of the pendrive. To avoid the problem, we can use the hd-media version of those files, that can be copied directly from http://ftp.debian.org/debian/dists/stable/main/installer-amd64/current/images/hd-media/ to a new hd-media folder in the root of the image partition. The previous Grub2 menu.cfg already point to this path. The files are referenced in the official Debian Install manual, see https://www.debian.org/releases/stable/amd64/ch02s04.en.html and https://www.debian.org/releases/stable/amd64/ch04s04.en.html#files-grub for details.
See also the thread https://linux.debian.user.narkive.com/WsE80JNn/booting-debian-10-installer-iso-from-usb to have more details about the problem.
Prepare the third partition for Debian Installer image
If you follow Bootable_pendrive you should end up with a third pendrive partition already formatted, you should only put your Debian Installer image there. Let's do that.
root@host:~# mkdir /tmp/sdX3 root@host:~# mount /dev/sdX3 /tmp/sdX3 root@host:~# mkdir -p /tmp/sdX3/images root@host:~# curl -kLO /tmp/sdX3/images/debian-install.iso https://cdimage.debian.org/images/release/current/amd64/iso-dvd/debian-12.5.0-amd64-DVD-1.iso root@host:~# umount /tmp/sdX3 root@host:~# rmdir /tmp/sdX3