Debian preseed configuration

Finally, the Debian preseed configuration file is:

#### Contents of the preconfiguration file
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string fr_FR

# Keyboard selection.
d-i keyboard-configuration/layoutcode string fr
d-i keyboard-configuration/variantcode select
# To select a variant of the selected layout:
d-i keyboard-configuration/xkb-keymap select fr

### Network configuration
# netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface.
d-i netcfg/choose_interface select auto

# 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 localhost
d-i netcfg/get_domain string localhost

{% if proxy_env is defined %}
### Mirror settings
# Set proxy
d-i mirror/http/proxy string {{ proxy_env['http_proxy'] }}
{% endif %}

# Alternatively: by default, the installer uses CC.archive.ubuntu.com where
# CC is the ISO-3166-2 code for the selected country. You can preseed this
# so that it does so without asking.
d-i mirror/http/mirror select fr.archive.ubuntu.com

### Account setup
# To create a normal user account.
d-i passwd/user-fullname string admin
d-i passwd/username string admin
# Normal user's password, either in clear text
#d-i passwd/user-password password user
#d-i passwd/user-password-again password user
# or encrypted using a crypt(3) hash.
d-i passwd/user-password-crypted password {{ encrypted_password }}

# Set to true if you want to encrypt the first user's home directory.
d-i user-setup/encrypt-home boolean false

### Clock and time zone setup
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true

# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string Europe/Paris

# Controls whether to use NTP to set the clock during the install
#d-i clock-setup/ntp boolean true
# NTP server to use. The default is almost always fine here.
#d-i clock-setup/ntp-server string ntp.example.com

### Partitioning

# use LVM to partition the disk
d-i partman-auto/method string lvm

# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true

# For LVM partitioning, you can select how much of the volume group to use
# for logical volumes.
d-i partman-auto-lvm/guided_size string max

# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home:   separate /home partition
# - multi:  separate /home, /var, and /tmp partitions
#TODO d-i partman-auto/choose_recipe select boot-root
d-i partman-auto/purge_lvm_from_device boolean true
d-i partman-auto-lvm/new_vg_name string vgubuntu

# Creates a small /boot partition, and uses the rest of the space for
# an lvm root partition:
d-i partman-auto/expert_recipe string                         \
    boot-root ::                                              \
        768 768 768 fat32                                     \
            $primary{ }                                       \
            method{ efi } format{ }                           \
        .                                                     \
        1024 1024 1024 ext4                                   \
            $primary{ } $bootable{ }                          \
            method{ format } format{ }                        \
            use_filesystem{ } filesystem{ ext4 }              \
            mountpoint{ /boot }                               \
        .                                                     \
        4000 100 -1 ext4                                      \
            $defaultignore{ }                                 \
            $primary{}                                        \
            method{ lvm } format{ }                           \
            vg_name{ vgubuntu }                               \
        .                                                     \
        4000 100 -1 ext4                                      \
            $defaultignore{ }                                 \
            $lvmok{ }                                         \
            in_vg{ vgubuntu } lv_name{ root }                 \
            method{ format } format{ }                        \
            use_filesystem{ } filesystem{ ext4 }              \
            mountpoint{ / }                                   \
        .                                                     \
# If you just want to change the default filesystem from ext3 to something
# else, you can do that without providing a full recipe.
#d-i partman/default_filesystem string ext4

# 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

### Apt setup
# You can choose to install restricted and universe software, or to install
# software from the backports repository.
d-i apt-setup/restricted boolean true
d-i apt-setup/universe boolean true
#d-i apt-setup/backports boolean true

### Package selection
# Individual additional packages to install
d-i pkgsel/include string openssh-server
# Previous line is not working with Ubiquity
d-i ubiquity/success_command string in-target apt -y install openssh-server

# Some versions of the installer can report back on what software you have
# installed, and what software you use. The default is not to report back,
# but sending reports helps the project determine what software is most
# popular and include it on CDs.
popularity-contest popularity-contest/participate boolean false

### Finishing up the installation
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
# Reboot once finished
d-i ubiquity/reboot boolean true

#### Advanced options
### Running custom commands during the installation

# This command is run as early as possible, just after preseeding is read
# to allow admin as username
d-i preseed/early_command string sed -i.orig 's/^admin$/# &/' /root/usr/lib/ubiquity/user-setup/reserved-usernames

Most of parameters are quite self-explanatory. The partman-auto/expert_recipe rule is to partition the disk into an EFI partition, a small /boot partition and the rest as an LVM volume for /.

A ubiquity/success_command rule has to be provided to install OpenSSH server, the rule pkgsel/include being not followed by the Ubuntu Ubiquity installer.

The rule ubiquity/reboot is also non-standard and is here to reboot once the installation is finished.

Finally, the rule preseed/early_command string is here to allow Ubiquity to configure a user with username admin, which is not allowed by default.

Previous