Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: Customization of the guest operating system is not supported due to the given reason: Tools is not installed in the GuestOS. #2269

Open
1 of 4 tasks
jbl9999 opened this issue Sep 30, 2024 · 12 comments
Assignees
Labels
question/provider Question: Provider
Milestone

Comments

@jbl9999
Copy link

jbl9999 commented Sep 30, 2024

Community Guidelines

  • I have read and agree to the HashiCorp Community Guidelines .
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform

1.9.6

Terraform Provider

2.9.2

VMware vSphere

7.0.3

Description

When using the vSphere Terraform provider (2.9.2) to deploy VM from template created by packer (1.11.2), i got the following error 👍

Customization of the guest operating system is not supported due to the given reason: Tools is not installed in the GuestOS. Please install the latest version of open-vm-tools or VMware Tools to enable GuestCustomization.

I use kickstart to build VM template and open-vm-tools has been added into, and it is the same behavior.

If I use Vsphere UI to create VM from template, it works, and i can check that open-vm-tools is well installed.
I also notice that perl package has been installed from kickstart.

Affected Resources or Data Sources

resource/vm

Terraform Configuration

provider "vsphere" {
  user = "[email protected]"
  password = "xxx"
  vsphere_server = "XX.XX.XX.XX"
  allow_unverified_ssl = true
}

data "vsphere_datacenter" "datacenter" {
  name = "XXX"
}

data "vsphere_datastore" "datastore" {
  name = "XX"
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

data "vsphere_resource_pool" "pool" {
  name = "XX.XX.XX.XX/Resources"
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

data "vsphere_network" "network" {
  name = "XXX"
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

data "vsphere_virtual_machine" "template" {
  name = "CENTOS-7.9"
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

resource "vsphere_virtual_machine" "vm" {
  name = "terraform-test"
  resource_pool_id = data.vsphere_resource_pool.pool.id
  datastore_id = data.vsphere_datastore.datastore.id
  guest_id = "centos7_64Guest"
  network_interface {
    network_id = data.vsphere_network.network.id
  }
  disk {
    label = "disk0"
    size = 100
    thin_provisioned = false
  }
  clone {
    template_uuid = data.vsphere_virtual_machine.template.id
    customize {
      linux_options {
        host_name = "XX"
        domain = "localhost.localdomain"
      }
      network_interface {
        ipv4_address = "XX.XX.XX.XX"
        ipv4_netmask = 16        
      }
      ipv4_gateway = "XX.XX.XX.XX"
    } 
  }
}

Debug Output

I can't link the debug GitHub log since it's not connected to the internet, but the message is explained above :

Customization of the guest operating system is not supported due to the given reason: Tools is not installed in the GuestOS. Please install the latest version of open-vm-tools or VMware Tools to enable GuestCustomization

$ terraform apply
data.vsphere_datacenter.datacenter: Reading...
data.vsphere_datacenter.datacenter: Read complete after 0s [id=datacenter-1345]
data.vsphere_datastore.datastore: Reading...
data.vsphere_resource_pool.pool: Reading...
data.vsphere_virtual_machine.template: Reading...
data.vsphere_network.network: Reading...
data.vsphere_network.network: Read complete after 0s [id=network-1351]
data.vsphere_datastore.datastore: Read complete after 0s [id=datastore-1358]
data.vsphere_resource_pool.pool: Read complete after 0s [id=resgroup-8]
data.vsphere_virtual_machine.template: Read complete after 0s [id=4214519d-9ee9-5808-5258-fa0279179a82]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:
  + resource "vsphere_virtual_machine" "vm" {
      + annotation                              = (known after apply)
      + boot_retry_delay                        = 10000
      + change_version                          = (known after apply)
      + cpu_limit                               = -1
      + cpu_share_count                         = (known after apply)
      + cpu_share_level                         = "normal"
      + datastore_id                            = "datastore-1358"
      + default_ip_address                      = (known after apply)
      + ept_rvi_mode                            = (known after apply)
      + extra_config_reboot_required            = true
      + firmware                                = "bios"
      + force_power_off                         = true
      + guest_id                                = "centos7_64Guest"
      + guest_ip_addresses                      = (known after apply)
      + hardware_version                        = (known after apply)
      + host_system_id                          = (known after apply)
      + hv_mode                                 = (known after apply)
      + id                                      = (known after apply)
      + ide_controller_count                    = 2
      + imported                                = (known after apply)
      + latency_sensitivity                     = "normal"
      + memory                                  = 1024
      + memory_limit                            = -1
      + memory_share_count                      = (known after apply)
      + memory_share_level                      = "normal"
      + migrate_wait_timeout                    = 30
      + moid                                    = (known after apply)
      + name                                    = "terraform-test"
      + num_cores_per_socket                    = 1
      + num_cpus                                = 1
      + power_state                             = (known after apply)
      + poweron_timeout                         = 300
      + reboot_required                         = (known after apply)
      + resource_pool_id                        = "resgroup-8"
      + run_tools_scripts_after_power_on        = true
      + run_tools_scripts_after_resume          = true
      + run_tools_scripts_before_guest_shutdown = true
      + run_tools_scripts_before_guest_standby  = true
      + sata_controller_count                   = 0
      + scsi_bus_sharing                        = "noSharing"
      + scsi_controller_count                   = 1
      + scsi_type                               = "pvscsi"
      + shutdown_wait_timeout                   = 3
      + storage_policy_id                       = (known after apply)
      + swap_placement_policy                   = "inherit"
      + sync_time_with_host                     = true
      + tools_upgrade_policy                    = "manual"
      + uuid                                    = (known after apply)
      + vapp_transport                          = (known after apply)
      + vmware_tools_status                     = (known after apply)
      + vmx_path                                = (known after apply)
      + wait_for_guest_ip_timeout               = 0
      + wait_for_guest_net_routable             = true
      + wait_for_guest_net_timeout              = 5

      + clone {
          + template_uuid = "4214519d-9ee9-5808-5258-fa0279179a82"
          + timeout       = 30

          + customize {
              + ipv4_gateway = "XX.XX.XX.XX"
              + timeout      = 10

              + linux_options {
                  + domain       = "localhost.localdomain"
                  + host_name    = "YYYYYY"
                  + hw_clock_utc = true
                }

              + network_interface {
                  + ipv4_address = "XX.XX.XX.XX"
                  + ipv4_netmask = 16
                }
            }
        }

      + disk {
          + attach            = false
          + controller_type   = "scsi"
          + datastore_id      = "<computed>"
          + device_address    = (known after apply)
          + disk_mode         = "persistent"
          + disk_sharing      = "sharingNone"
          + eagerly_scrub     = false
          + io_limit          = -1
          + io_reservation    = 0
          + io_share_count    = 0
          + io_share_level    = "normal"
          + keep_on_remove    = false
          + key               = 0
          + label             = "disk0"
          + path              = (known after apply)
          + size              = 100
          + storage_policy_id = (known after apply)
          + thin_provisioned  = false
          + unit_number       = 0
          + uuid              = (known after apply)
          + write_through     = false
        }

      + network_interface {
          + adapter_type          = "vmxnet3"
          + bandwidth_limit       = -1
          + bandwidth_reservation = 0
          + bandwidth_share_count = (known after apply)
          + bandwidth_share_level = "normal"
          + device_address        = (known after apply)
          + key                   = (known after apply)
          + mac_address           = (known after apply)
          + network_id            = "network-1351"
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

vsphere_virtual_machine.vm: Creating...
vsphere_virtual_machine.vm: Still creating... [10s elapsed]
vsphere_virtual_machine.vm: Still creating... [20s elapsed]
vsphere_virtual_machine.vm: Still creating... [30s elapsed]
vsphere_virtual_machine.vm: Still creating... [40s elapsed]
vsphere_virtual_machine.vm: Still creating... [50s elapsed]
vsphere_virtual_machine.vm: Still creating... [1m0s elapsed]
2024-09-30T17:07:17.402+0200 [ERROR] provider.terraform-provider-vsphere_v2.9.2_x5: Response contains error diagnostic: @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_detail="" diagnostic_summary="error sending customization spec: Customization of the guest operating system is not supported due to the given reason: " tf_proto_version=5.6 tf_resource_type=vsphere_virtual_machine @module=sdk.proto diagnostic_severity=ERROR tf_provider_addr=provider tf_req_id=a14c4c28-4f95-c2e4-ed95-a7fd8c5eb9a1 tf_rpc=ApplyResourceChange timestamp="2024-09-30T17:07:17.401+0200"
2024-09-30T17:07:17.473+0200 [ERROR] vertex "vsphere_virtual_machine.vm" error: error sending customization spec: Customization of the guest operating system is not supported due to the given reason:

│ Error: error sending customization spec: Customization of the guest operating system is not supported due to the given reason: 

│   with vsphere_virtual_machine.vm,
│   on example_vsphere.tf line 35, in resource "vsphere_virtual_machine" "vm":
│   35: resource "vsphere_virtual_machine" "vm" {

Panic Output

No response

Expected Behavior

VM created as expected

Actual Behavior

VM destroyed

Steps to Reproduce

As mentionned.

Environment Details

No response

Screenshots

No response

References

No response

@jbl9999 jbl9999 added bug Type: Bug needs-triage Status: Issue Needs Triage labels Sep 30, 2024
Copy link

Hello, jbl9999! 🖐

Thank you for submitting an issue for this provider. The issue will now enter into the issue lifecycle.

If you want to contribute to this project, please review the contributing guidelines and information on submitting pull requests.

@tenthirtyam
Copy link
Collaborator

Is open-vm-tools running?

@tenthirtyam tenthirtyam added question/provider Question: Provider and removed bug Type: Bug needs-triage Status: Issue Needs Triage labels Oct 9, 2024
@tenthirtyam tenthirtyam self-assigned this Oct 9, 2024
@jbl9999
Copy link
Author

jbl9999 commented Oct 9, 2024

Of course vmtoolsd service was running

@tenthirtyam tenthirtyam added the waiting-response Status: Waiting on a Response label Oct 9, 2024
@tenthirtyam tenthirtyam changed the title Customization of the guest operating system is not supported error: Customization of the guest operating system is not supported due to the given reason: Tools is not installed in the GuestOS. Oct 9, 2024
@tenthirtyam
Copy link
Collaborator

Since this is CentOS, is Perl installed along with open-vm-tools?

Can you confirm that customization w/o Terraform works?

@github-actions github-actions bot removed the waiting-response Status: Waiting on a Response label Oct 9, 2024
@tenthirtyam tenthirtyam added the waiting-response Status: Waiting on a Response label Oct 9, 2024
@jbl9999
Copy link
Author

jbl9999 commented Oct 9, 2024

Yes Perl is installed.
Customization w/o meaning ?

@github-actions github-actions bot removed the waiting-response Status: Waiting on a Response label Oct 9, 2024
@tenthirtyam
Copy link
Collaborator

See if you get the same error with the template using the vSphere UI.

@jbl9999
Copy link
Author

jbl9999 commented Oct 9, 2024

As explained in ticket : "If I use Vsphere UI to create VM from template, it works, and i can check that open-vm-tools is well installed"

@tenthirtyam
Copy link
Collaborator

Mind confirming by using:

resource "vsphere_virtual_machine" "vm" {
  name = "terraform-test"
  # ... other configuration ...
  guest_id = data.vsphere_virtual_machine.template.guest_id
  firmware = data.vsphere_virtual_machine.template.firmware
  # ... other configuration ...
}

@tenthirtyam tenthirtyam added the waiting-response Status: Waiting on a Response label Oct 9, 2024
@github-actions github-actions bot removed the waiting-response Status: Waiting on a Response label Oct 9, 2024
@tenthirtyam tenthirtyam added this to the Backlog milestone Oct 9, 2024
@jbl9999
Copy link
Author

jbl9999 commented Oct 9, 2024

I'll test it tomorrow, keep you informed

@tenthirtyam tenthirtyam added the waiting-response Status: Waiting on a Response label Oct 9, 2024
@jbl9999
Copy link
Author

jbl9999 commented Oct 10, 2024

It doesn' work with firmware option, same behavior.

@github-actions github-actions bot removed the waiting-response Status: Waiting on a Response label Oct 10, 2024
@tenthirtyam
Copy link
Collaborator

What about guest_id? I assume it's a match with the template?

@jbl9999
Copy link
Author

jbl9999 commented Oct 10, 2024

Yes it is guest_id = "centos7_64Guest"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question/provider Question: Provider
Projects
None yet
Development

No branches or pull requests

2 participants