8
votes

If I want to create a virtual machine image using Packer, one option is to download an operating system's ISO image and use that as the base for a custom setup. When doing this, one needs to provide the boot_command, which is an array of strings that tell Packer how to setup the operating system.

Now my question is: How do I find out the correct boot_command steps for a given operating system? Of course I might boot it up manually and write down every single thing I type, but I wonder if there is a more convenient way.

Of course I can also ask Google about it, but is there an "official" way? E.g., are the steps for Ubuntu documented somewhere in the Ubuntu documentation? Or is it actually trial and error, or at least peeking at somebody else's work?

2
Why the downvote, and why the vote for close? I think Packer is very well related to programming, and hence it is not off-topic ...Golo Roden

2 Answers

7
votes

The boot_command depends on OS you want to install and are just the keystrokes that are needed to start an automatted installation.

For Ubuntu/Debian it is called preseeding, for Red Hat/CentOS/SLES there are kickstart files, and other Linux distributions probably have similar features.

For Ubuntu a starting point is the documentation of the Automatic Installation.

Packer normally uses the boot_command in conjunction with the http_directory directory. Ubuntu is booted from ISO, then Packer types in the keystrokes of boot_command and then serves a static HTTP download link with the preseed configuration to do the rest of the installation, eg. installing packages.

The boot_command contain kernel parameters, but can also be used using boot parameters to preseed questions.

0
votes

You will get boot-command for every builder in hashicorp packer site: https://www.packer.io/docs/builders/hyperv/iso. You will get boot-command in Boot Configuration Reference. There are other also for virtualbox, vmware etc