Last Updated: February 25, 2016
· destructuring

Building an unattended Ubuntu install disc

An unattended Ubuntu install disc won't ask any questions when it boots up. It gets its inputs from a seed file and will wipe your machine with a new configuration. I build an iso file that I boot VirtualBox guests with to get the base OS installed.

Get an iso of Ubuntu and mount it somewhere. Then rsync the contents to a directory because it gets modified; I'll use mnt/ as an example.

The permissions on the copied Ubuntu aren't friendly to modifications, so fix them up:

mkdir -p mnt/{preseed,isolinux}
chmod u+w mnt/{preseed,isolinux}
chmod u+w mnt/isolinux/isolinux.bin

Copy a custom isolinux.cfg because I haven't figured how to disable all the prompts in the GUI installer so I run the simpler text installer.

rsync -ia isolinux.cfg mnt/isolinux/

The isolinux.cfg looks like this, with a very long last line:

prompt 0
timeout 1
default install
label install
  menu label ^Install Ubuntu
  kernel /install/vmlinuz
  append file=/cdrom/preseed/preseed.cfg debian-installer=en_US locale=en_US fb=false debconf/frontend=noninteractive console-setup/ask_detect=false console-setup/layoutcode=us kbd-chooser/method=us console-keymaps-at/keymap=us netcfg/get_hostname=vagrant netcfg/get_domain=dev priority=critical initrd=/install/initrd.gz quiet --

Then copy over your preseed.cfg (not included here, that's another largish protip) for the install automation:

rsync -ia preseed.cfg mnt/preseed/

Then convert the copied Ubuntu into a bootable iso image:

cd mnt/
mkisofs \
  -r -V "Ubuntu" \
  -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/ \
  -no-emul-boot -boot-load-size 4 -boot-info-table -o ../unattended.iso .