5

I want to preseed an Ubuntu 12.04 installer using a custom partitioning recipe. My disk layout is reasonably complex, and so is the recipe syntax itself. Hand-crafting such a recipe seems tedious and error prone.

Is there a tool to simply create a recipe from an existing disk, including its partitions and LVM configuration?

derobert
  • 107,579
  • 20
  • 231
  • 279
Alex
  • 321
  • 1
  • 4
  • 10

4 Answers4

0

I am not entirely sure about what you mean with "preseed". If you are talking about a KickStart or unattended install, one good tool for that is anaconda.

I have used it extensively for unattended installation of RedHatLinux. According to Debian Wiki it is supported at Debian also. Being ubuntu a Debian derivative it should be usable.

You control the partitions with command part.

The basic idea behind an unattended install is that you provide a kickstart config file and anaconda does all the work.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
0

I have found no such tool and don't want to write one. What I did was to treat the expert recipes as standard text files that I edit online with ACE editor. Before sending the recipe to the preseed file in the mako template, I use this function to convert the text into a form ready for debconf.

https://github.com/umeboshi2/paella/blob/master/src/paella/paella/managers/util.py#L25

This function could be expanded to allow you to put comments in the recipe if it is complex enough to need that.

umeboshi
  • 296
  • 1
  • 12
0

You can use Kickstart. An excerpt from https://gist.github.com/ludo/3652811 example:

bootloader --location=mbr
zerombr yes
clearpart --all --initlabel
part /boot --fstype=ext2 --size=64
part swap --size=1024
part / --fstype=ext4 --size=1 --grow
0

Preseed is built into the Debian installer. Kickstart is a similar tool used with RHEL. I'm not aware of any tool like Red Hat's GUI system-config-kickstart tool or Anaconda that allow you to graphically create the configuration file. If you often need to install Debian systems automatically (and maybe over the network) you might want to take a look at FAI - Fully Automatic Installation - it's features go beyond what preseed can do and it has pretty flexibly partitioning capabilities.


But of course you can get the job done using preseed as well. The Debian GNU/Linux Installation Guide says

The easiest way to create a preconfiguration file is to use the example file linked in Section B.4, “Contents of the preconfiguration file (for buster)” as basis and work from there.

An alternative method is to do a manual installation and then, after rebooting, use the debconf-get-selections from the debconf-utils package to dump both the debconf database and the installer's cdebconf database to a single file:

$ echo "#_preseed_V1" > file
$ debconf-get-selections --installer >> file
$ debconf-get-selections >> file

However, a file generated in this manner will have some items that should not be preseeded, and the example file is a better starting place for most users. To check possible values for questions, you can use nano to examine the files in /var/lib/cdebconf while an installation is in progress. View templates.dat for the raw templates and questions.dat for the current values and for the values assigned to variables.

To check if the format of your preconfiguration file is valid before performing an install, you can use the command debconf-set-selections -c preseed.cfg.

If you have already completed the installation I would recommend to check /var/log/installer which might contains the information you need to create the preseed configuration.

Martin Konrad
  • 2,090
  • 2
  • 16
  • 32