Preseeding the Debian Installer 

KMap happened to mention about preseeding when we were looking for some “automated” Linux installation (and configuration) for the IITM network, so that hostellers in the institute can easily install Linux and start using it straight away.There are a lot of hurdles in the campus network – the Proxy server, restricted NAT access, Proprietary NTLM Authentication for the proxy server, etc – which make Linux installations and configuration of simple utilities under Linux a pain

So we wanted something that’ll autoconfigure these things. (If you see our Linux Users’ Group mailing list you’ll find many mails about NTLM authorization!) And after KMap explained what preseeding could do, I was hooked on to the idea. (I remember that this happened on the last day FossConf 2008, when we were thinking on these lines, inspired by Mr. Arun Khan whom we all spoke to the previous night.) And finally I caught onto the idea again a week and a half. Varun and I did some web-hunting and testing, and we should be able to shortly “release” the preseeded installer, both as CD ISO, netboot ISO (what a waste of a CD), and netboot installer ‘suites’.

There are enough articles on preseeding the Debian Installer:

I found the last two sites very useful. In addition this example-preseed.txt file proved very useful.

I just took that example preseed configuration file and modified it to suit the IITM environment. The contents of the file with all the comments stripped of are here:

debconf debconf/priority string critical
unknown debconf/priority string critical
d-i debconf/priority string critical
d-i debian-installer/locale string en_US
d-i console-tools/archs select at
d-i console-keymaps-at/keymap select us
d-i netcfg/choose_interface select auto
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Configure network manually
d-i netcfg/get_nameservers string
d-i netcfg/get_netmask string
d-i netcfg/get_gateway string
d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string debian
d-i netcfg/get_domain string iitm
d-i netcfg/wireless_wep string
d-i mirror/country string manual
d-i mirror/http/hostname string
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i mirror/suite string testing
d-i clock-setup/utc boolean false
d-i time/zone string Asia/Calcutta
d-i clock-setup/ntp boolean false
d-i partman-auto/init_automatically_partition \
select Guided – use the largest continuous free space
d-i partman-auto/init_automatically_partition seen false
d-i partman-auto/choose_recipe \
select Separate /home partition
d-i partman-auto/choose_recipe seen false
d-i passwd/root-login boolean false
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i apt-setup/use_mirror boolean false
d-i apt-setup/security_host string
d-i apt-setup/local0/repository string \ testing main
d-i apt-setup/local0/comment string
d-i apt-setup/local0/source boolean true
d-i apt-setup/local0/key string
d-i debian-installer/allow_unauthenticated string true
tasksel tasksel/first multiselect standard, web-server, desktop
d-i pkgsel/include string openssh-server cntlm vlc pidgin xchat gimp linuxdcpp firefox
popularity-contest popularity-contest/participate boolean false
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/config/device/driver select vesa
xserver-xorg xserver-xorg/autodetect_monitor boolean true
xserver-xorg xserver-xorg/config/monitor/selection-method \
select medium
xserver-xorg xserver-xorg/config/monitor/mode-list \
select 1024×768 @ 60 Hz
#d-i preseed/late_command string in-target wget -q \ # && tar -xzvf post_install.tar.gz && \ #rm post_install.tar.gz && pushd post_install && ./control.rc && popd

The last three lines which I’ve commented out here are not actually commented in the version on my web server. I’ve commented them out here because they fetch some package from my web server which is not accessible from outside the institute. Also, those lines haven’t been tested (and are going to be tested as I write this blog post).

Now… how do we get the netboot kernel to use this preseed file? You can’t use the preseed/file=<…> kernel parameter because it requires that the file be on the ramdisk. So one way of doing it is to put it on a web server / FTP server and then use preseed/url=<URL> kernel argument, as in (in the GRUB prompt):

kernel /linux preseed/url=

Where the http://&#8230;.cfg should be replaced with the appropriate URL where the installer can find the preseed config file.

The other option is to open up initrd.gz and put it on the ramdisk. Any file named preseed.cfg put in the root of the ramdisk acts as the preseed configuration file, and the debian installer automatically loads it. If you would like to preseed “optionally” in that case, you can probably rename the file to something else, say optional_preseed.cfg and then pass preseed/file=optional_preseed.cfg to the kernel. This method is detailed in this article, in the context of burning the initrd permanently to an ISO. In that case, another option is to just put the ISO on the CDROM and then use preseed/file=<…>