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

Incorrect documentation about optional shutdown command

Open Sam13 opened this issue 3 months ago • 0 comments

The documentation about shutdown_command optional behavior (https://developer.hashicorp.com/packer/integrations/hashicorp/qemu/latest/components/builder/qemu#shutdown-configuration) is incorrect.

If left away and shutdown executed in the last provisioning script the QEMU machine will still be forcefully halted. A graceful shutdown is only possible when shutdown_command is provided. Also restarts during provisioning seem to work when shutdown_command provided.

Plugin and Packer version

Packer v1.14.1 QEMU Plugin 1.1.4 QEMU emulator version 7.2.18 (Debian 1:7.2+dfsg-7+deb12u15)

Simplified Packer Buildfile

Non graceful shutdown

source "qemu" "my_image" {
  ...
}
build {
  sources = ["source.qemu.my_image"]
  provisioner "powershell" {
    scripts = [
      "${path.root}/scripts/do-something.ps1"
    ]
  }  
  provisioner "powershell" {
    inline = ["shutdown /s /t 0"]
  }  
}

Graceful shutdown

source "qemu" "my_image" {
  shutdown_command = "shutdown /s /t 0"
  ...
}
build {
  sources = ["source.qemu.my_image"]
  provisioner "powershell" {
    scripts = [
      "${path.root}/scripts/do-something.ps1"
    ]
  }  
}

Operating system and Environment details

Seen this issue when building Linux and Windows images

Sam13 avatar Sep 05 '25 07:09 Sam13