Installing Debian distributions from USB sticks – problems and solutions

If you tried to install any distribution which uses Debian-Installer (Debian, Ubuntu and derivatives) using my method for booting multiple CDs from a USB stick (with ext2 partitions) (see also the version with FAT16 partitions, you most likely encountered the error “No common CD-ROM drive was detected.” immediatly after the “Detecting hardware to find CD-ROM drives” screen.

This is, of course, caused by the fact that Debian-Installer looks for CD-ROM drives and tries to mount them using the iso9660 filesystem (the ISO files format). Since we are running from a USB stick, our partitions are formated as ext2 or FAT16, so they will be ignored by Debian-Installer.

There is a quick fix though – Debian-Installer will happily use the files from the /cdrom directory if it is already mounted by the time it tries to check for CD-ROMs! You should follow these steps:

Step 1: Boot the USB stick, select the distribution that you want to install.

Step 2: When the installer asks for the language selection, don’t choose anything and press ALT-F2, then Enter to activate the console.

Step 3: Create /cdrom and mount the USB stick partition to it (/dev/sdc2 and 5 are my partitions, make sure you have the right ones, for example by looking at the log messages in console 4 – press ALT-F4 – or checking what sd* devices were created in /dev):

# ls /dev/sd*
# mkdir /cdrom
# mount -t vfat /dev/sdc2 /cdrom
or
# mount -t ext2 /dev/sdc5 /cdrom

If you get an error message saying “Invalid argument”, the most likely cause is that you run from a ext2 partition but the initrd doesn’t support ext2 filesystems. This is the genius work of Debian developers, and I will provide a fix for it in another blog post.

Step 4: Press ALT-F1 to go back to the installer dialogues and continue installing.

Additional step: If at some point, you get an error from the installer with the message “Failed to determine the codename for the release”, it usually means the installer is trying to access a symlink that is no longer there (most likely cause: you used a FAT16 filesystem, which does not support symlinks).

The solution is simple: take a look at the error messages in console 4 (press ALT-F4) and you will most likely see the installer tried to look for the release name “stable”. Get back to console 2 (press ALT-F2 and Enter to activate it), see what’s in /cdrom/dists and “fix” it:

# cd /cdrom/dists
# ls
lenny
# mv lenny stable

You can now return to the installer (press ALT-F1) and select Retry. The installation should continue correctly.

Credits