Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find out the boot command for Packer?

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?

like image 799
Golo Roden Avatar asked Jul 12 '15 17:07

Golo Roden


People also ask

What is Packer command?

The packer build command takes a template and runs all the builds within it in order to generate a set of artifacts. The various builds specified within a template are executed in parallel, unless otherwise specified. And the artifacts that are created will be outputted at the end of the build.

Can Packer create ISO?

The VirtualBox Packer builder is able to create VirtualBox virtual machines and export them in the OVF format, starting from an ISO image. The builder builds a virtual machine by creating a new virtual machine from scratch, booting it, installing an OS, provisioning software within the OS, then shutting it down.

What is a packer template?

A Packer template is a configuration file that defines the image you want to build and how to build it. Packer templates use the Hashicorp Configuration Language (HCL). Create a new directory named packer_tutorial . This directory will contain your Packer template for this tutorial.


1 Answers

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.

like image 101
Stefan Scherer Avatar answered Sep 19 '22 08:09

Stefan Scherer