Debian Automated Install

A few days ago in my part of the talk at GTALUG [1] I mentioned using Debian automated install [2] to quickly bring up fully virtualized systems, as one of possible methods of system deployment or testing Ansible scripts.

This idea worked so well that I made a youtube video out of it --

The video is based on the following: preseed file [3] taken from kali linux preseed [4] and gen_iso script [5], the latter is a distilled version EditIso instructions from Debian Wiki [6]

Example usage -- generating an ISO image based on an existing Debian ISO and a preseed.cfg:

./gen_iso.sh -i debian-8.6.0-amd64-CD-1.iso -p presseed.cfg preseeded.iso

Discussion

One major issue with writing automated install answers -- partitioning abilities are somewhat limited, and the scripts quickly grows in complexity for anything beyond simple one- or two- partition layout. If complex partition required, as in cases when installing Debian on bare hardware, it is possible omit answers to partition questions -- the installer will drop into interactive mode, where custom partition will be set up, once that part of the installation is finished, automated install will resume.

Creating preseed file

It is possible to just run a standard installation giving all the answers to the installer, once installation is over, the answers are retrieved using debconf-get-selections tool, a part of debconf-utils package.

# debconf-get-selections --installer > ${HOME}/preseed.cfg
# debconf-get-selections >> ${HOME}/preseed.cfg

The first command important than the second as it generates answers to questions asked during installation, the second command generates all answers to any subsequent package configuration dialog (i.e. complex packages like Postfix, or Postgresql).

One possible issue that might arise in this scenario of generating configuration files -- automated install answers are work only for standard Debian installation, answers recorded in expert mode will cause errors like installation looping infinitely on one of the dialogs, or automated install dropping into regular install mode.

Another way of generating a preseed file, is to modify existing minimal configuration.

Conclusion

Debian automated install is a handy way of getting from bare metal to a running system that can be handed off to Ansible for further configuration. The point of automated install is to fill the niche Ansible currently not servicing, all further system modifications should be done with Ansible as automated install answers quickly become really complicated.

Sources

[1]AGM and Ansible with Myles Braithwaite and Alex Volkov. https://gtalug.org/meeting/2016-10/
[2]Appendix B. Automating the installation using preseeding. https://www.debian.org/releases/jessie/i386/apbs02.html.en
[3]A sample preseed file. https://github.com/myles/2016-10-11-ansible/blob/master/2-testing/03-debian-preseed/iso/preseed.cfg
[4]Kali linux preseed file. https://www.kali.org/dojo/preseed.cfg
[5]gen_iso.sh script for creating ISO images with slipstreamed preseed files. https://github.com/myles/2016-10-11-ansible/blob/master/2-testing/03-debian-preseed/iso/gen_iso.sh
[6]Debian-Installer: How to modify an existing CD image to preseed d-i. https://wiki.debian.org/DebianInstaller/Preseed/EditIso