packer-builder-vsphere icon indicating copy to clipboard operation
packer-builder-vsphere copied to clipboard

Build 'vsphere-iso' errored: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server.

Open dhana594 opened this issue 6 years ago • 28 comments

Hi Team,

We are using packer-builder-vsphere plugin with packer version 1.1.2

Here is our packer.json

{
  "builders": [
    {
      "type": "vsphere-iso",
      "vcenter_server":      "XXX",
      "username":            "XXX",
      "password":            "XXX",
      "insecure_connection": "true",
      "vm_name": "rhel7-packer02",
      "cluster": "XXX",
      "host":     "XXX",
      "datastore": "XXX",
      "guest_os_type": "rhel7_64Guest",
      "ssh_username": "packer",
      "ssh_password": "packer",
      "CPUs":             2,
      "RAM":              4096,
      "RAM_reserve_all": true,
      "disk_size":        32768,
      "network_card": "vmxnet3",
      "network": "XXX",
      "floppy_files":[ "ks.cfg" ],
      "boot_command": 
	[
            "<esc><wait>",
            "vmlinuz initrd=initrd.img net.ifnames=0 biosdevname=0 ",
            "ks=http://<IP>/kickstart/ks1.cfg",
            "<enter>"
        ],
      "iso_paths": [
        "[XYXX] Linux-Iso/rhel-server-7.5-x86_64-boot.iso"
      ]
    }
  ],

  "provisioners": [
    {
      "type": "shell",
      "inline": ["ls /"]
    }
  ]
}

I am facing an issue after running packer build

Packer build log

vsphere-iso output will be in this color.

==> vsphere-iso: Creating VM...
==> vsphere-iso: Customizing hardware...
==> vsphere-iso: Adding CD-ROM drives...
==> vsphere-iso: Creating floppy disk...
    vsphere-iso: Copying files flatly from floppy_files
    vsphere-iso: Copying file: ks.cfg
    vsphere-iso: Done copying files from floppy_files
    vsphere-iso: Collecting paths from floppy_dirs
    vsphere-iso: Resulting paths from floppy_dirs : []
    vsphere-iso: Done copying paths from floppy_dirs
==> vsphere-iso: Uploading created floppy image
==> vsphere-iso: Adding generated Floppy...
==> vsphere-iso: Set boot order...
==> vsphere-iso: Power on VM...
==> vsphere-iso: Waiting 10s for boot...
==> vsphere-iso: Typing boot command...
==> vsphere-iso: Power off VM...
==> vsphere-iso: Destroying VM...
Build 'vsphere-iso' errored: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server.

==> Some builds didn't complete successfully and had errors:
--> vsphere-iso: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server.

==> Builds finished but no artifacts were created.

Any help is appreciated

dhana594 avatar Jun 18 '18 23:06 dhana594

More info, please! What version of vSphere are you using? (6.0, 6.5, 6.7, etc).

And, 2.0 was refactored to use packer > 1.2.0; I'm not sure if it requires that, but what happens if you try with a version of packer >= 1.2.0 ?

ideologysec avatar Jul 17 '18 15:07 ideologysec

Hi Eric,

I am using Packer version : 1.1.2 n our project got completed . We have created images through manually

On 17 July 2018 at 08:22, Eric [email protected] wrote:

More info, please! What version of vSphere are you using? (6.0, 6.5, 6.7, etc).

And, 2.0 was refactored to use packer > 1.2.0; I'm not sure if it requires that, but what happens if you try with a version of packer >= 1.2.0 ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jetbrains-infra/packer-builder-vsphere/issues/126#issuecomment-405621881, or mute the thread https://github.com/notifications/unsubscribe-auth/Ab1ad56t37GfDc7SdsgIvGIm65Db0H3eks5uHgFFgaJpZM4UspNb .

dhana594 avatar Jul 23 '18 00:07 dhana594

I have this issue with packer 1.2.4 and vsphere 6.5. Turns out the ESXi itself is running an older version so that's the issue

fishman avatar Jul 23 '18 16:07 fishman

Hello. Packer v 1.3.1 and vsphere v 6.5.0.20000. I got this error: "Build 'vsphere-iso' errored: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server." but it doesn't matter what i'm trying to print via boot_command, any value of it leads to process crash.

Ufaowl avatar Sep 27 '18 10:09 Ufaowl

Having the same problem. The weird thing is that sometimes it works, sometimes it doesn't. I've gone through the boot command manually step by step and it works.

Packer 1.3.2 Packer vSphere builder 2.1 vSphere 6.7 + ESXi 6.7

Boot command:

"boot_wait": "10s",
"boot_order": "disk,cdrom",
"boot_command": [
    "<wait5><enter><wait><f6><wait><esc><wait>",
    "<bs><bs><bs><bs><bs><bs><bs><bs><bs>",
    "<bs><bs><bs><bs><bs><bs><bs><bs><bs>",
    "<bs><bs><bs><bs><bs><bs><bs><bs><bs>",
    "<bs><bs><bs><bs><bs><bs><bs><bs><bs>",
    "<bs><bs><bs><bs><bs><bs><bs><bs><bs>",
    "<bs><bs><bs><bs><bs><bs><bs><bs><bs>",
    "<bs><bs><bs><bs><bs><bs><bs><bs><bs>",
    "<bs><bs><bs><bs><bs><bs><bs><bs><bs>",
    "<bs><bs><bs><bs><bs><bs><bs><bs><bs>",
    "<bs><bs><bs><bs><bs><bs><bs><bs><bs>",
    "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
    " file=/media/ubuntu-server.seed",
    " initrd=/install/initrd.gz",
    " auto=true",
    " priority=critical",
    " debian-installer/locale=en_US",
    " keyboard-configuration/layoutcode=us",
    " ubiquity/reboot=true",
    " languagechooser/language-name=English",
    " countrychooser/shortlist=US",
    " localechooser/supported-locales=en_US.UTF-8",
    " netcfg/choose_interface=auto",
    "<enter>"
],

Log:

2018/11/28 02:13:48 Preparing build: vsphere-iso
vsphere-iso output will be in this color.

2018/11/28 02:13:48 Waiting on builds to complete...
2018/11/28 02:13:48 Starting build run: vsphere-iso
2018/11/28 02:13:48 Running builder: vsphere-iso
2018/11/28 02:13:48 [INFO] (telemetry) Starting builder vsphere-iso
==> vsphere-iso: Creating VM...
==> vsphere-iso: Customizing hardware...
==> vsphere-iso: Mount ISO images...
==> vsphere-iso: Creating floppy disk...
    vsphere-iso: Copying files flatly from floppy_files
2018/11/28 02:13:50 packer-builder-vsphere-iso: 2018/11/28 02:13:50 Floppy path: /tmp/packer116262531
2018/11/28 02:13:50 packer-builder-vsphere-iso: 2018/11/28 02:13:50 Initializing block device backed by temporary file
2018/11/28 02:13:50 packer-builder-vsphere-iso: 2018/11/28 02:13:50 Formatting the block device with a FAT filesystem...
2018/11/28 02:13:50 packer-builder-vsphere-iso: 2018/11/28 02:13:50 Initializing FAT filesystem on block device
2018/11/28 02:13:50 packer-builder-vsphere-iso: 2018/11/28 02:13:50 Reading the root directory from the filesystem
    vsphere-iso: Copying file: /data/vsphere/files/ubuntu-server.seed
    vsphere-iso: Done copying files from floppy_files
    vsphere-iso: Collecting paths from floppy_dirs
    vsphere-iso: Resulting paths from floppy_dirs : []
    vsphere-iso: Done copying paths from floppy_dirs
==> vsphere-iso: Uploading created floppy image
==> vsphere-iso: Adding generated Floppy...
==> vsphere-iso: Set boot order...
==> vsphere-iso: Power on VM...
==> vsphere-iso: Waiting 10s for boot...
==> vsphere-iso: Typing boot command...
2018/11/28 02:14:08 packer-builder-vsphere-iso: 2018/11/28 02:14:08 Waiting 5 seconds
2018/11/28 02:14:13 packer-builder-vsphere-iso: 2018/11/28 02:14:13 Special code '<enter>' found, replacing with: CodeReturnEnter
==> vsphere-iso: Power off VM...
==> vsphere-iso: Deleting Floppy image ...
2018/11/28 02:14:14 packer-builder-vsphere-iso: 2018/11/28 02:14:14 Deleting floppy disk: /tmp/packer116262531
==> vsphere-iso: Destroying VM...
2018/11/28 02:14:14 [INFO] (telemetry) ending vsphere-iso
2018/11/28 02:14:14 ui error: Build 'vsphere-iso' errored: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server.
2018/11/28 02:14:14 Builds completed. Waiting on interrupt barrier...
2018/11/28 02:14:14 machine readable: error-count []string{"1"}
2018/11/28 02:14:14 ui error:
==> Some builds didn't complete successfully and had errors:
2018/11/28 02:14:14 machine readable: vsphere-iso,error []string{"error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server."
}
2018/11/28 02:14:14 ui error: --> vsphere-iso: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server.
==> Builds finished but no artifacts were created.
2018/11/28 02:14:14 [INFO] (telemetry) Finalizing.
Build 'vsphere-iso' errored: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server.

==> Some builds didn't complete successfully and had errors:
--> vsphere-iso: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server.

==> Builds finished but no artifacts were created.
2018/11/28 02:14:15 waiting for all plugin processes to complete...
2018/11/28 02:14:15 /bin/packer-builder-vsphere-iso: plugin process exited
2018/11/28 02:14:15 /bin/packer: plugin process exited
2018/11/28 02:14:15 /bin/packer: plugin process exited

gaui avatar Nov 28 '18 02:11 gaui

I hit the same issue when applying a Kickstart to centos. I hit the issue on ESXi Host VMware ESXi, 5.5.0, 7504623 but it works on ESXi Host VMware ESXi, 6.5.0, 10175896.

I think if it's not caused by the ESXi Host version then maybe it's a permissions thing...

Packer v1.3.2
packer-builder-vsphere-iso.exe v1.2
==> vsphere-iso: Step "StepBootCommand" failed
==> vsphere-iso: [c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succeeds)? c
==> vsphere-iso: Clear boot order...
==> vsphere-iso: Power off VM...
==> vsphere-iso: Deleting Floppy image ...
==> vsphere-iso: Destroying VM...
Build 'vsphere-iso' errored: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server.

dkirrane avatar Dec 06 '18 13:12 dkirrane

Packer version 1.3.1, packer-builder-vsphere version 2.0. Having the same issue now, and the builder doesn't report anything particularly useful.

recently upgraded to vSphere 6.7, appears to be erroring consistently now. Working with our vSphere admin to logcrawl, check perms, etc, but it appears as though the upgrade might've broke something API-wise.

ideologysec avatar Dec 07 '18 03:12 ideologysec

Issue persists with Packer 1.3.3 and builder v2.1, and being granted full administrator access. So, it appears that something in the vSphere 6.7 API changed, and is breaking the builder (since I don't believe Packer handles vSphere communication directly).

@mkuzmin does this have any relevance? https://github.com/vmware/govmomi/commit/64788667ee840553750ab80bfcc50190bd90562d

ideologysec avatar Dec 12 '18 17:12 ideologysec

I don't have 6.7 yet, and never saw anything similar.

  1. Check vCenter events. each key tap generates a separate vCenter task (Put USB HID scan codes). Sometimes error messages at server side have more details.

  2. enable debug logging (PACKER_LOG=1) and slow down typing by PACKER_KEY_INTERVAL=300ms.

  3. I've updated dependencies to Packer 1.3 and govmomi 0.19. Try fresh binaries from TeamCity.

  4. maybe there are some debug logging at vCenter side, but I was never able to find anything useful there.

mkuzmin avatar Dec 23 '18 09:12 mkuzmin

@mkuzmin I've hit this on VMware ESXi, 6.0.0, 6921384

Nothing in vCenter UI Event Windows. In Recent Tasks Window I just see this:

image

Enabled debugging

export PACKER_LOG=1
export PACKER_LOG_PATH="packerlog.txt"
export PACKER_ON_ERROR=ask
export PACKER_KEY_INTERVAL=300ms

packerlog.txt shows:

2019/01/29 16:11:52 ui: ==> vsphere-iso: Power on VM...
2019/01/29 16:11:53 ui: ==> vsphere-iso: Waiting 10s for boot...
2019/01/29 16:12:03 ui: ==> vsphere-iso: Typing boot command...
2019/01/29 16:12:03 packer-builder-vsphere-iso.exe: 2019/01/29 16:12:03 Special code '<tab>' found, replacing with: CodeTab
2019/01/29 16:12:03 ui error: ==> vsphere-iso: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server.
2019/01/29 16:12:03 ui: ==> vsphere-iso: Step "StepBootCommand" failed

Full log https://gist.github.com/dkirrane/73979e9f7fbf8a1e2e704f6455b15339

dkirrane avatar Jan 29 '19 16:01 dkirrane

Same probleme here... Packer 1.3.5 and vCenter 6.5.0

2019/03/21 09:00:51 [INFO] (telemetry) ending vsphere-iso
2019/03/21 09:00:51 ui error: [1;31mBuild 'vsphere-iso' errored: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server.[0m
2019/03/21 09:00:51 Builds completed. Waiting on interrupt barrier...
2019/03/21 09:00:51 machine readable: error-count []string{"1"}
2019/03/21 09:00:51 ui error: 
==> Some builds didn't complete successfully and had errors:
2019/03/21 09:00:51 machine readable: vsphere-iso,error []string{"error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server."}
2019/03/21 09:00:51 ui error: --> vsphere-iso: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server.
2019/03/21 09:00:51 ui: 
==> Builds finished but no artifacts were created.
2019/03/21 09:00:51 [INFO] (telemetry) Finalizing.

arogarth avatar Mar 21 '19 08:03 arogarth

Issue persists with packer v1.3.5, the jetbrains plugin v2.3 on macos, vSphere v6.7

It's as if the boot_command does nothing whatsoever. I've tried various permutations of the boot command all to no avail.

Really want to get this working, but am completely dead in the water.

log snippet:

2019/04/05 19:43:42 packer-builder-vsphere-iso.macos: 2019/04/05 19:43:42 Deleting floppy disk: /var/folders/48/j6191d8553j_61tkbqxk_68w0000gn/T/packer852014389 2019/04/05 19:43:42 ui: ==> vsphere-iso: Destroying VM... 2019/04/05 19:43:43 [INFO] (telemetry) ending vsphere-iso 2019/04/05 19:43:43 ui error: Build 'vsphere-iso' errored: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server. 2019/04/05 19:43:43 Builds completed. Waiting on interrupt barrier... 2019/04/05 19:43:43 machine readable: error-count []string{"1"} 2019/04/05 19:43:43 ui error: ==> Some builds didn't complete successfully and had errors: 2019/04/05 19:43:43 machine readable: vsphere-iso,error []string{"error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server."} 2019/04/05 19:43:43 ui error: --> vsphere-iso: error typing a boot command: ServerFaultCode: Cannot complete the operation due to an incorrect request to the server. 2019/04/05 19:43:43 ui: ==> Builds finished but no artifacts were created.

gitcdb avatar Apr 06 '19 02:04 gitcdb

@gitcdb Same issue here. Did you get any solution:?

gowthamakanthan avatar Apr 16 '19 10:04 gowthamakanthan

@gowthamakanthan Unfortunately not, no. I had to resort to using the standard vmware-iso package for now with the hopes that this is resolved at some point.

On Tue, 16 Apr 2019 at 03:15, gowthamakanthan [email protected] wrote:

@gitcdb https://github.com/gitcdb Same issue here. Did you get any solution:?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jetbrains-infra/packer-builder-vsphere/issues/126#issuecomment-483599474, or mute the thread https://github.com/notifications/unsubscribe-auth/AvC201VghJHdW_lO3g1dtnSZITgfgbeDks5vhaK8gaJpZM4UspNb .

gitcdb avatar Apr 16 '19 15:04 gitcdb

@gitcdb I have overcome this by installing the latest plugin and packer.

gowthamakanthan avatar Apr 17 '19 10:04 gowthamakanthan

Still erroring on packer 1.4.0 and vsphere-iso 2.1.

@dkirrane you need vSphere 6.5 and higher for boot_commands (and this builder) to work at all, I believe.

@mkuzmin any updates or hope of progress on this? it's completely murdered our pipeline for months now; we're building images manually and that's flat out unscaleable. VMware logs don't provide any useful information that I can find.

EDIT:

  1. Check vCenter events. each key tap generates a separate vCenter task (Put USB HID scan codes). Sometimes error messages at server side have more details.

I no longer see the Put USB HID scan codes event message in vCenter; it seems to be erroring out before the command is even typed.

  1. enable debug logging (PACKER_LOG=1) and slow down typing by PACKER_KEY_INTERVAL=300ms.

PACKER_KEY_INTERVAL=300ms does nothing - the issue doesn't appear to be how fast the codes are being typed, but if they can be typed at all.

Here's my boot_command for an ubuntu18.04 image:

"boot_command": [
        "<enter><wait><f6><wait><esc><wait>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs>",
        "/install/vmlinuz",
        " initrd=/install/initrd.gz",
        " priority=critical",
        " locale=en_US",
        " file=/media/preseed.cfg",
        "<enter>"
],

The Packer debug log doesn't show anything useful:

2019/05/20 19:19:00 [INFO] Packer version: 1.4.0
2019/05/20 19:19:00 Packer Target OS/Arch: darwin amd64
2019/05/20 19:19:00 Built with Go Version: go1.12.4
2019/05/20 19:19:00 Detected home directory from env var: /Users/user
2019/05/20 19:19:00 [DEBUG] Discovered plugin: vsphere-iso = /Users/user/.packer.d/plugins/packer-builder-vsphere-iso.macos

...

2019/05/20 19:19:02 [INFO] (telemetry) Starting builder vsphere-iso
==> vsphere-iso: Creating VM...
==> vsphere-iso: Customizing hardware...
==> vsphere-iso: Mount ISO images...
==> vsphere-iso: Creating floppy disk...
2019/05/20 19:19:05 packer-builder-vsphere-iso.macos: 2019/05/20 19:19:05 Floppy path: /var/folders/79/w39y2v590l91f13m7588clqm0000gp/T/packer107345533
2019/05/20 19:19:05 packer-builder-vsphere-iso.macos: 2019/05/20 19:19:05 Initializing block device backed by temporary file
2019/05/20 19:19:05 packer-builder-vsphere-iso.macos: 2019/05/20 19:19:05 Formatting the block device with a FAT filesystem...
2019/05/20 19:19:05 packer-builder-vsphere-iso.macos: 2019/05/20 19:19:05 Initializing FAT filesystem on block device
2019/05/20 19:19:05 packer-builder-vsphere-iso.macos: 2019/05/20 19:19:05 Reading the root directory from the filesystem
    vsphere-iso: Copying files flatly from floppy_files
    vsphere-iso: Copying file: /Users/user/Developer/Packer/Ubuntu/floppy/preseed.cfg
    vsphere-iso: Done copying files from floppy_files
    vsphere-iso: Collecting paths from floppy_dirs
    vsphere-iso: Resulting paths from floppy_dirs : []
    vsphere-iso: Done copying paths from floppy_dirs
==> vsphere-iso: Uploading created floppy image
==> vsphere-iso: Adding generated Floppy...
==> vsphere-iso: Set boot order...
==> vsphere-iso: Power on VM...
==> vsphere-iso: Waiting 10s for boot...
==> vsphere-iso: Typing boot command...
2019/05/20 19:19:22 packer-builder-vsphere-iso.macos: 2019/05/20 19:19:22 Special code '<enter>' found, replacing with: CodeReturnEnter
==> vsphere-iso: Power off VM...
==> vsphere-iso: Deleting Floppy image ...
2019/05/20 19:19:23 packer-builder-vsphere-iso.macos: 2019/05/20 19:19:23 Deleting floppy disk: /var/folders/79/w39y2v590l91f13m7588clqm0000gp/T/packer107345533
==> vsphere-iso: Destroying VM...
2019/05/20 19:19:24 [INFO] (telemetry) ending vsphere-iso
2019/05/20 19:19:24 ui error: Build 'vsphere-iso' errored: error typing a boot command: ServerFaultCode: Permission to perform this operation was denied.
2019/05/20 19:19:24 Builds completed. Waiting on interrupt barrier...
2019/05/20 19:19:24 machine readable: error-count []string{"1"}
2019/05/20 19:19:24 ui error:
==> Some builds didn't complete successfully and had errors:
2019/05/20 19:19:24 machine readable: vsphere-iso,error []string{"error typing a boot command: ServerFaultCode: Permission to perform this operation was denied."}
2019/05/20 19:19:24 ui error: --> vsphere-iso: error typing a boot command: ServerFaultCode: Permission to perform this operation was denied.
Build 'vsphere-iso' errored: error typing a boot command: ServerFaultCode: Permission to perform this operation was denied.
==> Builds finished but no artifacts were created.
2019/05/20 19:19:24 [INFO] (telemetry) Finalizing.

==> Some builds didn't complete successfully and had errors:
--> vsphere-iso: error typing a boot command: ServerFaultCode: Permission to perform this operation was denied.

==> Builds finished but no artifacts were created.
2019/05/20 19:19:24 waiting for all plugin processes to complete...
2019/05/20 19:19:24 /usr/local/bin/packer: plugin process exited
2019/05/20 19:19:24 /Users/user/.packer.d/plugins/packer-builder-vsphere-iso.macos: plugin process exited
  1. I've updated dependencies to Packer 1.3 and govmomi 0.19. Try fresh binaries from TeamCity.

This issue persists with 2.0 and 2.1 and all versions of packer, as mentioned upthread.

  1. maybe there are some debug logging at vCenter side, but I was never able to find anything useful there.

yeah, as I mentioned above, I haven't found anything in the debug logs from either the raw ESXi host or the vCenter logs.

ideologysec avatar May 21 '19 02:05 ideologysec

@ideologysec Not sure why are you using the boot command like that. Please check the workable boot command below.

{
  "variables": {
  "vsphere_uid": "{{env `vsphere_uid` }}",
  "vsphere_passwd": "{{env `vsphere_passwd` }}",
  "vsphere_vm_name": "null"
  },

  "builders": [
     {
      "type": "vsphere-iso",
      "vcenter_server": "",
      "username": "{{user `vsphere_uid` }}",
      "password": "{{user `vsphere_passwd` }}",
      "insecure_connection": "true",
      "datacenter": "Platform-DC",
      "cluster": "Platform-Cluster",
      "datastore": "nfs_plat_101",
      "network": "vlan23",
      "vm_name": "{{user `vsphere_vm_name` }}",

      "guest_os_type": "centos7_64Guest",

      "ssh_username": "ansible",
      "ssh_private_key_file": "/root/.ssh/ansible",
      "ssh_bastion_host": "",
      "ssh_bastion_username": "ansible",
      "ssh_bastion_private_key_file": "/root/.ssh/ansible",

      "CPUs": 1,
      "RAM": 1024,
      "RAM_reserve_all": false,

      "convert_to_template": true,

      "disk_controller_type": "pvscsi",
      "disk_size": 61200,
      "disk_thin_provisioned": true,
      "network_card": "vmxnet3",

      "iso_paths": [
        "[ISO] linux/CentOS-7-x86_64-Minimal-1810.iso"
      ],
      "iso_checksum": "13675c6f74880e7ff3481b91bdaf925ce81bda8f",
      "iso_checksum_type": "sha1",
      "floppy_files": [
        "{{template_dir}}/ks.cfg"
      ],
      "boot_command": "<esc> <wait> linux inst.text inst.ks=hd:fd0:/ks.cfg <enter>"
        }
    ]
}

And amusing Kickstart file as well.

gowthamakanthan avatar May 21 '19 07:05 gowthamakanthan

@gowthamakanthan Because Ubuntu Server starts with boot args there already; please check the examples in the repo or gaui's boot command upthread. It's a bit different than CentOS. :) My boot command has worked in previous versions, and works on other packer builders.

Even using a CentOS.json with boot_command very similar to your own doesn't work, so I doubt very much that it's the formatting of the boot command.

ideologysec avatar May 21 '19 18:05 ideologysec

I've also run into this problem.

Works in our labb environment running vSphere 6.7 Does not work in production environment running vSphere 6.5

Both use Packer 1.4.1 and vSphere-ISO 2.3

BlackestDawn avatar Jun 17 '19 06:06 BlackestDawn

Same here. vsphere 6.5 packer 1.4.1 vSphere-ISO 2.3

leonrado avatar Jun 21 '19 14:06 leonrado

Was able to get this to work with this combination:

  1. vCenter 6.7 Build 11727113
  2. ESXi 6.7 Build 12986307
  3. vsphere-iso 2.1(?) (is there a way to check this?)
  4. Packer 1.3.2

ez12a avatar Jun 26 '19 23:06 ez12a

Works with packer 1.4.4 and vsphere-iso 2.3 against VMware ESXi, 6.5.0, 13932383 and vCenter 6.7.

@ideologysec thank you for the vSphere version tip above.

smatterchew avatar Oct 16 '19 15:10 smatterchew

Not working with: Packer 1.4.4 vsphere-iso 2.3 ESXI 6.0 U3 vCenter 6.5

BongoEADGC6 avatar Oct 26 '19 15:10 BongoEADGC6

I had this error:

vsphere-iso: error typing a boot command: ServerFaultCode: Permission to perform this operation was denied.

Tested with:

Packer 1.3.4 vSphere-iso 2.3 ESXi 6.7 U3 vCenter 6.7 U3

I was missing the following permission in the Packer role:

Inject USB HID scan codes

Hopefully this helps someone.

ToroNZ avatar Jan 11 '20 01:01 ToroNZ

I found that my previous boot command leads to the USB HID pop-up on vCenter. Packer 1.5.5, vCenter 6.5.0, ESXi 6.5.0

This is a working builder:

        {
            "type": "vsphere-iso",
            "vcenter_server": "{{user `vsphere_vcenter`}}",
            "host":           "{{user `vsphere_host`}}",
            "username":       "{{user `vsphere_username`}}",
            "password":       "{{user `vsphere_password`}}",
            "datacenter":     "{{user `vsphere_datacenter`}}",
            "cluster":        "{{user `vsphere_cluster`}}",
            "datastore":      "{{user `vsphere_datastore`}}",
            "network":        "{{user `vsphere_network`}}",
            "network_card":   "{{user `vsphere_netcard`}}",
            "insecure_connection": true,

            "vm_name": "packer-demo-{{user `build_number`}}",
            "guest_os_type": "ubuntu64Guest",

            "ssh_username": "{{user `ssh_username`}}",
            "ssh_password": "{{user `ssh_password`}}",
            "ssh_timeout": "{{user `ssh_timeout`}}",

            "CPUs": 1,
            "RAM": 1024,
            "disk_size": 10240,

            "disk_thin_provisioned": true,
            "iso_paths": [
              "[{{user `vsphere_datastore`}}] iso/ubuntu-14.04.6-server-amd64.iso"
            ],
            "floppy_files": [
              "./preseed.cfg"
            ],
            "boot_command": [
                "<enter><wait><f6><wait><esc><wait>",
                "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                "<bs><bs><bs>",
                "/install/vmlinuz",
                " initrd=/install/initrd.gz",
                " priority=critical",
                " locale=en_US",
                " preseed/file=/floppy/preseed.cfg",
                "<enter>"
            ]
        },

minhluantran017 avatar Apr 16 '20 14:04 minhluantran017

Sometimes, I get this error when Packer is typing in the boot_command:

==> Some builds didn't complete successfully and had errors: --> vsphere-iso: Error running boot command: error typing a boot command (code, down) 18, false: ServerFaultCode: A general system error occurred: Invalid fault

The error sometimes happens when Packer is typing in the boot_command. Usually, there are already some characters typed in successfully, i.e. the issue here is not a permission to input key presses. The VM remains running after the failure.

Packer: 1.6.5 vSphere: 6.7.0 Build 16616668

dreibh avatar Nov 27 '20 16:11 dreibh

Sometimes, I get this error when Packer is typing in the boot_command:

==> Some builds didn't complete successfully and had errors: --> vsphere-iso: Error running boot command: error typing a boot command (code, down) 18, false: ServerFaultCode: A general system error occurred: Invalid fault

The error sometimes happens when Packer is typing in the boot_command. Usually, there are already some characters typed in successfully, i.e. the issue here is not a permission to input key presses. The VM remains running after the failure.

Packer: 1.6.5 vSphere: 6.7.0 Build 16616668

Same problem here, but only on pfsense template ?

dakiro avatar Nov 28 '20 15:11 dakiro

I'm seeing this intermittently (5-10% of my CI runs), using a Debian Buster packer host, running Packer v1.6.5 on Jenkins v2.249.2, interfacing with vSphere v6.7.0.44000, and a Debian Buster guests, with default settings in packer template for key and keygroup intervals, and the below boot_command.

Incidentally, my Jenkins/Packer host is also running in the same vSphere cluster (with nested virtualization on, obviously), but from reading the other reports, this doesn't seem to be relevant.

Are people having any success with setting longer key intervals? I'm loathe to do that bc the "typing boot command..." stage already takes a seemingly long time. I tend to think that my environment should have one of the lowest latency possible between the packer processes and the vSphere guest process, since it's all going through the internal networking of our vSphere data center (>=30Gbps).

boot_command         = ["<esc><wait>", "install <wait>", "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg <wait>", "debian-installer=en_US.UTF-8 <wait>", "auto <wait>", "locale=en_US.UTF-8 <wait>", "kbd-chooser/method=us <wait>", "keyboard-configuration/xkb-keymap=us <wait>", "netcfg/get_hostname={{ .Name }} <wait>", "netcfg/get_domain=biamp.com <wait>", "fb=false <wait>", "debconf/frontend=noninteractive <wait>", "console-setup/ask_detect=false <wait>", "console-keymaps-at/keymap=us <wait>", "vga=884 <wait>", "grub-installer/bootdev=/dev/sda <wait>", "<enter><wait>"]

(BTW, I've played with several things to try to get the install console to be larger than the default, the above vga=884 being the most recent. Anyone know how to get that working for an env like mine?)

timblaktu avatar Jan 29 '21 16:01 timblaktu