Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

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

Open
dhana594 opened this issue Jun 18, 2018 · 28 comments

Comments

@dhana594
Copy link

dhana594 commented Jun 18, 2018

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

@ideologysec
Copy link

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 ?

@dhana594
Copy link
Author

dhana594 commented Jul 23, 2018 via email

@fishman
Copy link

fishman commented Jul 23, 2018

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

@Ufaowl
Copy link

Ufaowl commented Sep 27, 2018

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.

@gaui
Copy link

gaui commented Nov 28, 2018

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

@dkirrane
Copy link

dkirrane commented Dec 6, 2018

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.

@ideologysec
Copy link

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
Copy link

ideologysec commented Dec 12, 2018

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? vmware/govmomi@6478866

@mkuzmin
Copy link
Contributor

mkuzmin commented Dec 23, 2018

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.

@dkirrane
Copy link

@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

@arogarth
Copy link

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.

@gitcdb
Copy link

gitcdb commented Apr 6, 2019

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.

@gowthamakanthan
Copy link

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

@gitcdb
Copy link

gitcdb commented Apr 16, 2019 via email

@gowthamakanthan
Copy link

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

@ideologysec
Copy link

ideologysec commented May 21, 2019

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.

@gowthamakanthan
Copy link

gowthamakanthan commented May 21, 2019

@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.

@ideologysec
Copy link

ideologysec commented May 21, 2019

@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.

@BlackestDawn
Copy link

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

@leonrado
Copy link

Same here.
vsphere 6.5
packer 1.4.1
vSphere-ISO 2.3

@ez12a
Copy link

ez12a commented Jun 26, 2019

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

@smatterchew
Copy link

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.

@BongoEADGC6
Copy link

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

@ToroNZ
Copy link

ToroNZ commented Jan 11, 2020

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.

@minhluantran017
Copy link

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>"
            ]
        },

@dreibh
Copy link

dreibh commented Nov 27, 2020

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

@dakiro
Copy link

dakiro commented Nov 28, 2020

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 ?

@timblaktu
Copy link

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?)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests