Debian preseeding

From Wildsong
Jump to navigationJump to search

Because installs are too long and complicated.

  1. Answer all the questions and put the answers in a file.
  2. Set up DHCP so it feeds the file to the target machine when it boots.

http://hands.com/d-i/

Contents of preseed file for Jessie: http://d-i.alioth.debian.org/manual/en.i386/apbs04.html

# Depending on what software you choose to install, or if things go wrong
# during the installation process, it's possible that other questions may
# be asked. You can preseed those too, of course. To get a list of every
# possible question that could be asked during an install, do an
# installation, and then run these commands:
#   debconf-get-selections --installer > file
#   debconf-get-selections >> file

DHCP / Web set up

Set DNS to resolve "autoserver" to be my Apache server.

Put the preseed file into d-i/jesse/preseed.cfg

I also set up the server to be a Squid proxy which really speeds things up.

Booting from CD image

Who cares about this when we have PXE boot. Use it. Next section. Skip this.

When the system boots, hit TAB and add this to the kernel boot line:

install keymap=skip-config locale=en_US auto url=autoserver

It's still prompting for hostname/domainname. It even does this when I pass the name on the boot line.

Everything else is good.

PXE boot

Generic instructions are here: https://wiki.debian.org/PXEBootInstall

I installed tftpd-hpa on the server and from a debian mirror, I downloaded and unpacked netboot.tar.gz into /srv/tftp. I used openwrt as the DHCP server with these lines added to /etc/config/dhcp to tell the client what TFTP server to use and what file to grab.

config 'boot'
   option 'name' 'lan'
   option 'filename' 'pxelinux.0'
   option 'servername' 'bellman'
   option 'serveraddress' '192.168.1.2'


This should get you to a Debian installer menu on the target machine's screen.

Select "Advanced options" and then "Automated Install". (There is a short pause here as the required files are downloaded and executed...) When it asks for a URL enter bellman. The installer will expand that to http://bellman.wildsong.biz/d-i/jessie/./preseed.cfg and off it goes! You get one more prompt hit enter to get the default "American English".

The base operating system plus whatever I chose in jessie.cfg will now be installed. At completion the server powers down. Start it up and tell it to boot from the hard drive. At this point you have a working server and you can use Ansible to complete the server provisioning.

Syslinux

Edit some files in /srv/tftp/debian-installer/amd64/boot-screens/

in syslinux.cfg, change the timeout

timeout 5

Create a handsoff.cfg file and put this in it.

label handsoff

menu label ^Hands off kernel debian-installer/amd64/linux append auto=true priority=critical vga=788 initrd=debian-installer/amd64/initrd.gz preseed/url=http://autoserver ---

I think preseed=autoserver would work too. But this way you could use any name in there and not have to set up a DNS entry. On the webserver, place the preseed file here: d-i/jessie/preseed.cfg

Replace the first entry in the menu.cfg with this, I don't care about what the first entry used to be. I just want to override the original selection.

include debian-installer/amd64/boot-screens/handsoff.cfg

Now when I boot the target machine, it pauses for 5 seconds then plunges into installing Linux, no questions asked. This makes headless installs possible - as long as the target is set to PXEboot if there is no OS on its hard drive.

When it's done, the target machine powers off. If it's set to boot from its hard drive, it will come up in Debian at next power up.

Preseed.cfg

I grabbed a sample preseed file and edited in the appropriate root password and startup accounts. That was easy. It was still asking me for a keyboard "American US" so I still so I added this line to my preseed.cfg.

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

If you are having trouble, see what a running system has set by doing 'debconf-get-selections' and searching the output.