Preseeding the Debian Installer

download Preseeding the Debian Installer

If you can't read please download the document

Transcript of Preseeding the Debian Installer

Preseeding the Debian Installer

and Ubun-too! Brian Pitts http://polibyte.com

Introduction

Preseeding is a way to Answer questions asked during installation Run scripts during installation Customize software installed

Debconf

Software configuration utility Integrated with the package manager debconf-get-selections Use --installer to read from /var/log/installer/cdebconf instead of running system debconf-show dpkg-reconfigure

Format

Only use one whitespace character between type and value! Check format with debconf-set-selections -c preseed.cfg d-i is the owner of questions related to installation Answers to questions with other owners are placed in debconf database of target system

Access Methods

Each run at different times Initrd Local File (CD, USB) Network (HTTP/FTP)

Local File

The media is mounted at /cdrom Add file=/cdrom/preseed.cfg to kernel command line in isolinux.cfg USB is easy to modify since it's r/w ISO is harder. Copy the contents iso, modify it, then regenerate with mkisofs -o new-cd.iso -l -r -D -J -cache-inodes -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat extracted-cd/

Boot Parameters

Any can be specified in format owner:path/to/variable=value auto=true (delay keyboard and locale questions) priority=critical (skip most questions) interface=eth1 (choose network interface) file=/cdrom/preseed.cfg (load local preseed file) url=http://10.0.0.1/preseed.cfg (download preseed file) DEBCONF_DEBUG=5 (syslog and vt4)

Let's see what we can do...

Language and Keyboard

d-i debian-installer/locale string en_US at is almost always a safe keyboard to pick d-i console-keymaps-at/keymap select at

Network

Choose any active link d-i netcfg/choose_interface select auto

Static

Use a static IP address d-i netcfg/disable_dhcp boolean true d-i netcfg/get_nameservers string 10.0.0.1 d-i netcfg/get_ipaddress string 10.0.0.2 d-i netcfg/get_netmask string 255.0.0.0 d-i netcfg/get_gateway string 10.0.0.1 d-i netcfg/confirm_static boolean true d-i netcfg/get_hostname string newbox d-i netcfg/get_domain string example.com

Mirror

d-i mirror/country string US d-i mirror/http/hostname string us.archive.ubuntu.com d-i mirror/http/directory string /ubuntu d-i mirror/http/proxy string http://10.0.0.1:9999

Time

d-i clock-setup/utc boolean true d-i clock-setup/ntp boolean true d-i time/zone string US/Eastern

Partitioning

Don't have to specify disk if there's only one d-i partman-auto/disk string /dev/sda Methods are: "regular", "lvm" and "crypto" d-i partman-auto/method string regular Recipes are "atomic", (/) "home", (/, /home) "multi" (/, /home, /usr, /var, /tmp) d-i partman-auto/choose_recipe select atomic Can define your own recipe

Partitioning

Make it all automatic d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true

Accounts

Skip creating root d-i passwd/root-login boolean false Skip creating regular use d-i passwd/make-user boolean false Set root password d-i passwd/root-password-crypted password [MD5 hash] Create password with echo "example" | mkpasswd -s -m md5

Accounts

Create normal user d-i passwd/user-fullname string Example User d-i passwd/username string example d-i passwd/user-password-crypted password [MD5 hash] Change default id and groups d-i passwd/user-uid string 1010 d-i passwd/user-default-groups string audio video

OEM Mode

In OEM mode when install completes, there is user named oem When you run oem-config-prepare, a script is set to run which deletes the oem user and walsk the end user through account setup

OEM Mode

d-i oem-config/enable boolean true d-i passwd/allow-password-empty boolean true d-i passwd/user-fullname string OEM Configuration (temporary user) d-i passwd/username string oem d-i passwd/user-password string d-i passwd/user-password-again string

Adding Repositories

d-i apt-setup/local0/repository string \ http://example.com/ubuntu jaunty main d-i apt-setup/local0/comment string local server d-i apt-setup/local0/key string http://example.com/key

Installing Software

Tasks are groups of packages List them with tasksel --list-tasks 35 on my ubuntu system tasksel tasksel/first multiselect ubuntu-desktop, lamp-server Install individual packages d-i pkgsel/include string ubuntu-restrictedextras openssh-server

Running Commands

Runs immediately after preseed file is read d-i preseed/early_command string Run before the new system is unmounted from /target d-i preseed/late_command string in-target lets you easily run a command in the new system d-i preseed/late_command string in-target rm / Run a script during preseed d-i preseed/run string example.sh

Chaining Preseeds

Include another preseed file d-i preseed/include string preseed2.cfg Run a command that should return the path to a preseed file, then include that preseed file d-i preseed/include_command string if [ "`hostname`" = newbox ]; then echo newbox.cfg; fi

Ubiquity

Ububtu uses debian-installer on their alternate install CD, but the Desktop CD uses Ubiquity Rather than installing individual packages, it decompresses a squashfs filesystem More like applying a system image than a traditional install. Very fast. Ubiquity can be preseed within limits netcfg, LVM and RAID partitioning, baseinstaller, pkgsel/tasksel, finish-install aren't available

Ubiquity Boot Options

automatic-ubiquity skip screens when all qeustions are preseeded debug-ubiquity output debconf messages to /var/log/installer/debug. Great for figuring out values to preseed. noninteractive don't start X noprompt shutdown without asking to eject CD

Ubiquity Seed Options

Preseed empty to avoid the summary page ubiquity ubiquity/summary note Automatically reboot when the installer completes ubiquity ubiquity/reboot boolean commands to be run on install failure/success ubiquity ubiquity/failure_command string ubiquity ubiquity/failure_command string

Sample Ubiquity Preseed I

# Enable oem mode and set blank password for user with name "oem" d-i oem-config/enable boolean true d-i passwd/allow-password-empty boolean true d-i passwd/user-fullname string OEM Configuration (temporary user) d-i passwd/username string oem d-i passwd/user-password string d-i passwd/user-password-again string # set hostname d-i netcfg/get_hostname string ubuntu # Locale sets language and country. d-i debian-installer/locale string en_US.UTF-8 # Keyboard selection d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us

Sample Ubiquity Preseed II# Controls whether or not the hardware clock is set to UTC. d-i clock-setup/utc boolean true # Set timezone d-i time/zone string America/New_York # Controls whether to use NTP to set the clock during the install # Say no so we don't wait if there's no network connection d-i clock-setup/ntp boolean false # partition the disk # wipe everything and put everything in / d-i partman-auto/method string regular d-i partman-auto/choose_recipe select atomic d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true

Sample Ubiquity Preseed III# run this command after the install # /target is the newly-installed system # oem-config-prepare sets the first run wizard for next login ubiquity ubiquity/success_command string chroot /target oem-config-prepare # preseed this empty to avoid the summary before installation ubiquity ubiquity/summary note # reboot after installation # you will still be prompted "Close the tray and press ENTER to continue?" # unless you add noprompt to the kernel command line ubiquity ubiquity/reboot boolean true

Further Reading

http://d-i.alioth.debian.org/manual/en.i386/apb.htmlhttps://help.ubuntu.com/8.10/installation-guide/i386/appendix-preseed.html

https://wiki.ubuntu.com/DesktopCDOptions https://wiki.ubuntu.com/UbiquityAutomation