github.com/hashicorp/packer@v1.14.3/website/content/partials/packer-plugin-sdk/bootcommand/BootConfig.mdx (about)

     1  <!-- Code generated from the comments of the BootConfig struct in bootcommand/config.go; DO NOT EDIT MANUALLY -->
     2  
     3  The boot configuration is very important: `boot_command` specifies the keys
     4  to type when the virtual machine is first booted in order to start the OS
     5  installer. This command is typed after boot_wait, which gives the virtual
     6  machine some time to actually load.
     7  
     8  The boot_command is an array of strings. The strings are all typed in
     9  sequence. It is an array only to improve readability within the template.
    10  
    11  There are a set of special keys available. If these are in your boot
    12  command, they will be replaced by the proper key:
    13  
    14  -   `<bs>` - Backspace
    15  
    16  -   `<del>` - Delete
    17  
    18  -   `<enter> <return>` - Simulates an actual "enter" or "return" keypress.
    19  
    20  -   `<esc>` - Simulates pressing the escape key.
    21  
    22  -   `<tab>` - Simulates pressing the tab key.
    23  
    24  -   `<f1> - <f12>` - Simulates pressing a function key.
    25  
    26  -   `<up> <down> <left> <right>` - Simulates pressing an arrow key.
    27  
    28  -   `<spacebar>` - Simulates pressing the spacebar.
    29  
    30  -   `<insert>` - Simulates pressing the insert key.
    31  
    32  -   `<home> <end>` - Simulates pressing the home and end keys.
    33  
    34  -   `<pageUp> <pageDown>` - Simulates pressing the page up and page down
    35      keys.
    36  
    37  -   `<menu>` - Simulates pressing the Menu key.
    38  
    39  -   `<leftAlt> <rightAlt>` - Simulates pressing the alt key.
    40  
    41  -   `<leftCtrl> <rightCtrl>` - Simulates pressing the ctrl key.
    42  
    43  -   `<leftShift> <rightShift>` - Simulates pressing the shift key.
    44  
    45  -   `<leftSuper> <rightSuper>` - Simulates pressing the ⌘ or Windows key.
    46  
    47  -   `<wait> <wait5> <wait10>` - Adds a 1, 5 or 10 second pause before
    48      sending any additional keys. This is useful if you have to generally
    49      wait for the UI to update before typing more.
    50  
    51  -   `<waitXX>` - Add an arbitrary pause before sending any additional keys.
    52      The format of `XX` is a sequence of positive decimal numbers, each with
    53      optional fraction and a unit suffix, such as `300ms`, `1.5h` or `2h45m`.
    54      Valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. For
    55      example `<wait10m>` or `<wait1m20s>`.
    56  
    57  -   `<XXXOn> <XXXOff>` - Any printable keyboard character, and of these
    58       "special" expressions, with the exception of the `<wait>` types, can
    59       also be toggled on or off. For example, to simulate ctrl+c, use
    60       `<leftCtrlOn>c<leftCtrlOff>`. Be sure to release them, otherwise they
    61       will be held down until the machine reboots. To hold the `c` key down,
    62       you would use `<cOn>`. Likewise, `<cOff>` to release.
    63  
    64  -   `{{ .HTTPIP }} {{ .HTTPPort }}` - The IP and port, respectively of an
    65      HTTP server that is started serving the directory specified by the
    66      `http_directory` configuration parameter. If `http_directory` isn't
    67      specified, these will be blank!
    68  
    69  -   `{{ .Name }}` - The name of the VM.
    70  
    71  Example boot command. This is actually a working boot command used to start an
    72  CentOS 6.4 installer:
    73  
    74  In JSON:
    75  
    76  ```json
    77  "boot_command": [
    78      "<tab><wait>",
    79      " ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg<enter>"
    80   ]
    81  ```
    82  
    83  In HCL2:
    84  
    85  ```hcl
    86  boot_command = [
    87      "<tab><wait>",
    88      " ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg<enter>"
    89   ]
    90  ```
    91  
    92  The example shown below is a working boot command used to start an Ubuntu
    93  12.04 installer:
    94  
    95  In JSON:
    96  
    97  ```json
    98  "boot_command": [
    99    "<esc><esc><enter><wait>",
   100    "/install/vmlinuz noapic ",
   101    "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
   102    "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
   103    "hostname={{ .Name }} ",
   104    "fb=false debconf/frontend=noninteractive ",
   105    "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
   106    "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
   107    "initrd=/install/initrd.gz -- <enter>"
   108  ]
   109  ```
   110  
   111  In HCL2:
   112  
   113  ```hcl
   114  boot_command = [
   115    "<esc><esc><enter><wait>",
   116    "/install/vmlinuz noapic ",
   117    "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
   118    "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
   119    "hostname={{ .Name }} ",
   120    "fb=false debconf/frontend=noninteractive ",
   121    "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
   122    "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
   123    "initrd=/install/initrd.gz -- <enter>"
   124  ]
   125  ```
   126  
   127  For more examples of various boot commands, see the sample projects from our
   128  [community templates page](/packer/docs/community-tools#templates).
   129  
   130  <!-- End of code generated from the comments of the BootConfig struct in bootcommand/config.go; -->