In this post, I will describe the process of creating a desktop iso for unattended installation. I have tried this with 12.04 as well as with a daily build for 14.04. 32 or 64bit does not matter.
So first of all download a desktop
image of Ubuntu.
Meanwhile install isomaster
# apt-get install isomaster
Start isomaster and open the downloaded desktop image. In the bottom window open the "isolinux" folder. Edit the "txt.cfg" file, that is in that folder. Insert or update the following lines:
default autoinstall
label autoinstall
menu label ^Autoinstall1
kernel /casper/vmlinuz.efi
append url=http://YOUR-URL-TO-PRESEEDFILE automatic-ubiquity \ locale=de_DE.UTF-8 boot=casper initrd=/casper/initrd.lz quiet \ splash noprompt auto=true --
The interesting part here is the url parameter. With a url you are more flexible, than adding the preseed file onto the iso image. In other words, you can change your pressed file, without the need of creating a new iso image.
Now save the txt.cfg file and then the iso file. By the way, if you do not want to create a new iso file, you could actually edit the menu entry at boot time by pressing tab.
The next step is to create the preseed file. Most of it is self-explanatory, like keymap, timezone,...
The password part is interesting, because you can also add an encrypted password using an md5 hash.
(echo -n "password" | md5sum)
The toughest part, was the partitioning section. My script creates a root partition (~30 GB), a swap partition (1 GB) and a data partition (~30 GB). However so far my experience is, that the last partition usually takes up the drive's remaining disk space. So my data partition could be much larger. Yes for my purposes, i do not need a home partition!
The three numbers on the expert_recipe string 28000 10 28000 mean:
28000: minimum size of the partition in megabytes
10: the priority that this partition gets it’s maximum size fulfilled (with lower numbers having a higher priority)
28000: maximum size of the partition in megabytes
Save the file and make it available on the intranet/web, so that your script can be found on boot time. It might help to use the IP-address instead of a domain name.
Last interesting thing here is, the success_command string, which allows additional scripts to run after the main cd installation has finished.
By the way, to find out what can be preseeded you can use
# debconf-get-selections --installer > file
# debconf-get-selections >> file
Here is my file:
d-i debian-installer/locale string de_DE.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/modelcode string pc105
d-i keyboard-configuration/layoutcode string de
d-i keyboard-configuration/xkb-keymap select de
d-i keyboard-configuration/layout string German
d-i keyboard-configuration/variant string German
d-i netcfg/choose_interface select auto
d-i clock-setup/utc boolean true
d-i time/zone string Europe/Berlin
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string 0.at.pool.ntp.org
d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string regularvnode :: 28000 10 28000 ext4 \ $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } \
filesystem{ ext4 } mountpoint{ / } . 1024 100 1024 linux-swap $primary{ } \ method{ swap } format{ } . 28000 50 28000 ext4 $primary{ } method{ format } \ format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ /data } .
d-i partman/confirm_write_new_label boolean trued-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password 5f4dcc3b5aa765d61d8327deb882cf99
d-i passwd/user-fullname string admin
d-i passwd/username string admin
d-i passwd/user-password-crypted password 5f4dcc3b5aa765d61d8327deb882cf99
d-i user-setup/encrypt-home boolean false
d-i apt-setup/restricted boolean true
d-i apt-setup/universe boolean true
tasksel tasksel/first multiselect ubuntu-desktop
d-i pkgsel/include string openssh-server
d-i pkgsel/language-packs multiselect de
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i finish-install/reboot_in_progress note
xserver-xorg xserver-xorg/autodetect_monitor boolean true
#d-i ubiquity/summary string empty
ubiquity ubiquity/summary note
ubiquity ubiquity/reboot boolean true
# This command is run just before the install finishes, but when there is
# still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.
# ubiquity ubiquity/success_command string wget
ubiquity ubiquity/success_command string wget http://URL/preseed/postinst.sh \
-O /root/postinst.sh; in-target /bin/bash /root/postinst.sh
Further reading:
http://cptyesterday.wordpress.com/2012/06/17/notes-on-using-expert_recipe-in-debianubuntu-preseed-files/
https://help.ubuntu.com/lts/installation-guide/i386/appendix-preseed.html
http://www.debian.org/releases/stable/i386/apb.html.en