packer-plugin-proxmox icon indicating copy to clipboard operation
packer-plugin-proxmox copied to clipboard

VM are not deleted properly on proxmox-iso

Open hc-github-team-packer opened this issue 4 years ago • 1 comments

This issue was originally opened by @ProfDrToast in https://github.com/hashicorp/packer/issues/11249 and has been migrated to this repository. The original issue description is below.


Packer creates a VM and can also connect to it (both ssh and PTY), but in case of an error Packer only stops the VM and does not delete it.

My Packer config:

source "proxmox-iso" "ubuntu-2004" {
  boot_command   = ["<esc><enter><esc><enter><wait2s>", "/casper/vmlinuz ", "initrd=/casper/initrd quiet ", "autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ---", "<enter>"]
  boot_wait      = "5s"
  proxmox_url    = "https://proxmox:8006/api2/json"
  password       = "password"
  username       = "root@pam"
  node           = "pve01"
  insecure_skip_tls_verify = true
  http_directory = "http"
  iso_checksum   = "sha256:f8e3086f3cea0fb3fefb29937ab5ed9d19e767079633960ccb50e76153effc98"
  iso_url        = "http://releases.ubuntu.com/20.04/ubuntu-20.04.3-live-server-amd64.iso"
  iso_storage_pool = "local"
  memory         = 1024
  ssh_password   = "ubuntu"
  ssh_timeout    = "30m"
  ssh_username   = "ubuntu"
  network_adapters {
     model  = "virtio"
     bridge = "vmbr0"
     firewall = false 
     }

}

build {
  sources = ["source.proxmox-iso.ubuntu-2004"]

  provisioner "shell" {
    inline = ["ls /"]
  }

}

Packer Version: Packer v1.7.4 Proxmox Version: 7.0-11

Logfile:

2021/09/04 10:00:30 packer-builder-proxmox-iso plugin: [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
Cancelling build after receiving interrupt
2021/09/04 10:00:35 packer-provisioner-shell plugin: Received interrupt signal (count: 1). Ignoring.
2021/09/04 10:00:35 Cancelling builder after context cancellation context canceled
2021/09/04 10:00:35 packer-builder-proxmox-iso plugin: [WARN] Interrupt detected, quitting waiting for SSH.
2021/09/04 10:00:35 packer-builder-proxmox-iso plugin: [DEBUG] SSH wait cancelled. Exiting loop.
2021/09/04 10:00:35 packer-builder-proxmox-iso plugin: Received interrupt signal (count: 1). Ignoring.
==> proxmox-iso.ubuntu-2004: Stopping VM
==> proxmox-iso.ubuntu-2004: Deleting VM
2021/09/04 10:00:37 [INFO] (telemetry) ending 
==> Wait completed after 3 minutes 53 seconds
2021/09/04 10:00:37 [INFO] (telemetry) Finalizing.
Build 'proxmox-iso.ubuntu-2004' errored after 3 minutes 53 seconds: build was cancelled

==> Wait completed after 3 minutes 53 seconds
Cleanly cancelled builds after being interrupted.
2021/09/04 10:00:37 waiting for all plugin processes to complete...
2021/09/04 10:00:37 /usr/bin/packer: plugin process exited
2021/09/04 10:00:37 /usr/bin/packer: plugin process exited

hc-github-team-packer avatar Sep 06 '21 08:09 hc-github-team-packer

Same here the vsphere prov deletes the packer vm so i think thats a bug

Syntax3rror404 avatar Nov 17 '21 15:11 Syntax3rror404