Debian preseeding: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
Because installs are too long and complicated.
Installing Debian can be long and complicated. Preseeding is a method of installing using a network boot configuration and a configuration file.


# Answer all the questions and put the answers in a file.
Since these days I am mostly working with Raspberry Pis I am wondering if it works with them. Ah-- here is a guide: https://forums.raspberrypi.com/viewtopic.php?t=282839
 
Basically, you
 
# Answer all the questions asked during an installation and put the answers in a file.
# Set up DHCP so it feeds the file to the target machine when it boots.
# Set up DHCP so it feeds the file to the target machine when it boots.



Latest revision as of 03:44, 22 May 2024

Installing Debian can be long and complicated. Preseeding is a method of installing using a network boot configuration and a configuration file.

Since these days I am mostly working with Raspberry Pis I am wondering if it works with them. Ah-- here is a guide: https://forums.raspberrypi.com/viewtopic.php?t=282839

Basically, you

  1. Answer all the questions asked during an installation 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

See the git project tarra-repeater where there are edited versions of the preseed and pxelinux files. Refer to the README there for the most up to date information.

DHCP / DNS

Set DNS to resolve "autoserver" to be my web server. I am using nginx in a Docker container.

Web set up

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

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

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.