Unattended installation of Ubuntu from USB drive -- Not mounted correctly

I'm doing an unattended installation of Ubuntu-14.04-server with a USB drive on different type of servers (HP Proliant ML110, ML310, ML350).

In some cases, the USB drive is incorrectly mounted on /media instead of /cdrom, making the installation process stop with the following message:

[ Detect and mount CD-ROM ]

Your installation CD-ROM couldn't be mounted. This probably means that the CD-ROM was not in the drive. If so you can insert it an try again.

I managed to identify some cases where this error occurs:

  • on the ML110 and ML310: when the hard drive is empty
  • on the ML350 Gen9: even if the hard drive is partitioned.

I think it comes from the debian-installer that, at an early stage of the installation, tries to mount a partition from the first drive on /media. And then mounts the USB drive in /cdrom.

In the above cases, the hard drive is detected later during the installation process, making the USB drive the first drive and therefore mounting it on /media and not on /cdrom.

For the persons for which a manual intervention is not a problem, I found a workaround that I will describe in an answer below. But for an unattended installation, this is not a solution.

Can we force the installer to mount the USB drive on a specific mont-point?


For the persons for which a manual intervention is not a problem, here is the simple procedure.

  1. Open another terminal tty2 or tty3 by pressing alt+F2 or alt+F3 and press enter
  2. Un-mount the USB drive from /media:

    umount /media/

  3. Identify the USB drive sdX in the device list (sda, sdb, sdc, …)

    ls -l /sys/block/sd* | grep usb

  4. Mount the USB drive to /cdrom

    mount /dev/sdX /cdrom

  5. Go back to the main terminal tty1 by pressing alt+F1 and press yes to retry mounting the "CD-ROM".

As mentioned in the question, this is a workaround which is not a solution for an unattended installation.


I was running into the same issue and finally by luck happened upon a set of slides that allowed me to automate this and there was an accompanying code repository with the full preseed file. https://github.com/uweplonus/adia-install/blob/master/initrd/preseed.cfg#L3

Many people suggest using preseed/early_command umount /media/* but this hasn't worked for quite some time due to the timing of when the preseed portion runs compared to the partitioning.

The correct way to do this is to add the following anywhere in your preseed file that is referenced by the boot command.

d-i partman/early_command string \ USBDEV=$(list-devices usb-partition | sed "s/\(.*\)./\1/");\ BOOTDEV=$(list-devices disk | grep -v "$USBDEV" | head -1);\ debconf-set partman-auto/disk $BOOTDEV;\ debconf-set grub-installer/bootdev $BOOTDEV; \ umount /media;