Preseed Debian Squeeze using PXE

2011-07-30 16:28:00 by Saz

At work, we're currently using FAI to install Debian and configure the systems. For a couple of year's, this was a good solution. But time goes on. And so do we. At the moment I'm setting up puppet and preseeding of Debian Squeeze through PXE boot. A couple of things occurred and I'd like to share them with you.

  1. Network configuration in preseed file As we're booting through a network connection, there is absolutely no sense in setting the network configuration in your preseed file. Do this on your 'append' line in your pxe menu. If you try to configure it in your preseed file, it won't install unattended, but asks you for a network interface to use.
  2. Add ``auto=true priority=critical`` to your pxe append line If you don't at this, your installation won't run unattended and will ask you for a hostname and domain name.
  3. Let there be free space in your LVM volume group I wasn't able to keep some space free. The last created partition used up all remaining free space regardless of what was configured in the preseed file. Therefore I've created another logical volume which is called UNUSED and mounted to /unused. I couldn't get it to stay unmounted, as installer was complaining about it. If you know a solution, please let me know.

The preseed file I've created installs a minimal version of Debian Squeeze with as less packages as possible (no extra effort of striping it more down. It's about 600MB). A few additional packages will be installed: less, vim-nox, puppet and lsb-release. In case there goes anything wrong, a usable editor and less are not bad :-) Puppet will configure everything after the base system is installed. So, it must be installed. lsb-release is a requirement for puppet in most of my recipes, to distinguish between different Debian releases (such as Lenny and Squeeze). If puppet doesn't know, which operating system release you're using (especially if you're running Debian), try to install lsb-release and check, if lsbdistcodename is set to the right value if you call facter. Everything you need to set up your PXE boot server, can you find here. For a full documentation about preseeding, click here.

PXE menu entry:

LABEL Install Debian Squeeze

        MENU LABEL Install Debian Squeeze

        KERNEL squeeze-linux

        APPEND initrd=squeeze-initrd.gz auto=true priority=critical url=your-server interface=eth0


        #APPEND initrd= auto=true priority=critical url=your-server interface=eth0

The commented lines will fetch a kernel image and initrd from a HTTP server. If you're pxelinux.0 supports it, you can choose this boot method. Replace squeeze-linux and initrd=squeeze-initrd.gz with the name of your kernel image and initrd.

Preseed file:

#### Contents of the preconfiguration file (for squeeze)

### Localization

d-i debian-installer/language string en

d-i debian-installer/country string DE

d-i debian-installer/locale select en_US.UTF-8

# Keyboard selection.

d-i console-keymaps-at/keymap select us

d-i keyboard-configuration/xkb-keymap select us

### Network configuration

# Any hostname and domain names assigned from dhcp take precedence over

# values set here. However, setting the values still prevents the questions

# from being shown, even if values come from dhcp.

d-i netcfg/get_hostname string unassigned-hostname

d-i netcfg/get_domain string unassigned-domain

# If non-free firmware is needed for the network or other hardware, you can

# configure the installer to always try to load it, without prompting. Or

# change to false to disable asking.

d-i hw-detect/load_firmware boolean true

### Mirror settings

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

# Suite to install.

d-i mirror/suite string squeeze

### Account setup

d-i passwd/root-login boolean true

d-i passwd/make-user boolean false

d-i passwd/root-password-crypted password <YourMd5CryptedRootPassword>

### Clock and time zone setup

d-i clock-setup/utc boolean true

d-i time/zone string UTC

d-i clock-setup/ntp boolean true

d-i clock-setup/ntp-server string

### Partitioning

d-i partman-auto/disk string /dev/sda

d-i partman-auto/method string lvm

d-i partman-lvm/device_remove_lvm boolean true

d-i partman-md/device_remove_md boolean true

d-i partman-lvm/confirm boolean true

d-i partman-auto-lvm/new_vg_name string data

d-i partman-auto/choose_recipe select atomic

d-i partman-auto/expert_recipe string                         \

      boot-root ::                                            \

              200 200 500 xfs                                 \

                      $primary{ } $bootable{ }                \

                      method{ format } format{ }              \

                      use_filesystem{ } filesystem{ xfs }     \

                      mountpoint{ /boot }                     \

              .                                               \

              10000 10000 10240 xfs                           \

                      $lvmok{ }                               \

                      method{ format } format{ }              \

                      use_filesystem{ } filesystem{ xfs }     \

                      mountpoint{ / }                         \

              .                                               \

              2048 2048 4096 linux-swap                       \

                      $lvmok{ }                               \

                      method{ swap } format{ }                \

              .                                               \

              4096 16384 1000000000 xfs                       \

                      $lvmok{ }                               \

                      method{ format } format{ }              \

                      use_filesystem{ } filesystem{ xfs }     \

                      lv_name{ UNUSED }                       \

                      mountpoint{ /unused }                   \


# The full recipe format is documented in the file partman-auto-recipe.txt

# included in the 'debian-installer' package or available from D-I source

# repository. This also documents how to specify settings such as file

# system labels, volume group names and which physical devices to include

# in a volume group.

# This makes partman automatically partition without confirmation, provided

# that you told it what to do using one of the methods above.

d-i partman-partitioning/confirm_write_new_label boolean true

d-i partman/choose_partition select finish

d-i partman/confirm boolean true

d-i partman/confirm_nooverwrite boolean true

### Base system installation

# Configure APT to not install recommended packages by default. Use of this

# option can result in an incomplete system and should only be used by very

# experienced users.

d-i base-installer/install-recommends boolean false

# Select the initramfs generator used to generate the initrd for 2.6 kernels.

d-i base-installer/kernel/linux/initramfs-generators string initramfs-tools

### Apt setup

# You can choose to install non-free and contrib software.

d-i apt-setup/non-free boolean true

d-i apt-setup/contrib boolean true

d-i apt-setup/services-select multiselect security

d-i apt-setup/security_host string

# Additional repositories, local[0-9] available

#d-i apt-setup/local0/repository string \

#       https://your.server/debian squeeze main contrib non-free

#d-i apt-setup/local0/comment string Your local repo

# URL to the public key of the local repository; you must provide a key or

# apt will complain about the unauthenticated repository and so the

# sources.list line will be left commented out

#d-i apt-setup/local0/key string https://your.server/repo-key

### Package selection

tasksel tasksel/first multiselect none

# Individual additional packages to install

d-i pkgsel/include string openssh-server less vim-nox puppet lsb-release

d-i pkgsel/upgrade select full-upgrade

popularity-contest popularity-contest/participate boolean false

d-i grub-installer/only_debian boolean true

### Finishing up the installation

d-i finish-install/reboot_in_progress note

d-i preseed/late_command string in-target sed -i 's/START=no/START=yes/' /etc/default/puppet

The last line will enable Puppet to start on boot. If you need to set a different puppet server name, add another preseed/late_command.

To create your crypted root password use:

printf "r00tme" | mkpasswd -s -m md5

Place the preseed file in $DocumentRootOfYourWebserver/d-i/squeeze and save it as preseed.cfg.


Fork me on GitHub