cpu_type broken since 1.2.2
Overview of the Issue
When provisioning the VM from packer cpu_type is not being passed to proxmox resulting in all hosts taking the default value regardless of cpu_type setting. This works in 1.2.1
Suspected Cause
proxmox-api-go defines QemuCPU as
type QemuCPU struct {
Affinity *[]uint `json:"affinity,omitempty"`
Cores *QemuCpuCores `json:"cores,omitempty"` // Required during creation
Flags *CpuFlags `json:"flags,omitempty"`
Limit *CpuLimit `json:"limit,omitempty"`
Numa *bool `json:"numa,omitempty"`
Sockets *QemuCpuSockets `json:"sockets,omitempty"`
Type *CpuType `json:"type,omitempty"`
Units *CpuUnits `json:"units,omitempty"`
VirtualCores *CpuVirtualCores `json:"vcores,omitempty"`
}
In change https://github.com/hashicorp/packer-plugin-proxmox/commit/75dded5bd17410b4e5d4a5624c52621ac9acf370, in step_start_vm.go CpuType is not passed through in the config.
While I can spot the issue, my skills at committing are lacking. Don't blame me, I'm just a sysadmin. :)
Reproduction Steps
Set cpu_type = "x86-64-v3" within proxmox-iso source section. The resulting VM will have type kvm64
Plugin and Packer version
Packer v1.11.2 packer-plugin-proxmox_v1.2.2
Simplified Packer Buildfile
Very simple testing
packer {
required_plugins {
name = {
version = "~> 1"
source = "github.com/hashicorp/proxmox"
}
}
}
variable "proxmox_username" {
default = env("PROXMOX_USER")
}
variable "proxmox_token" {
default = env("PROXMOX_TOKEN")
}
source "proxmox-iso" "oraclelinux-9_5" {
proxmox_url = "https://192.168.1.181:8006/api2/json"
insecure_skip_tls_verify = true
username = "${var.proxmox_username}"
token = "${var.proxmox_token}"
node = "pm1"
vm_name = "oraclelinux-9.5"
template_description = "Oracle Linux 9.5 Image"
cores = "1"
cpu_type = "x86-64-v3"
memory = "2048"
os = "l26"
qemu_agent = true
boot_iso {
type = "sata"
iso_url = "https://yum.oracle.com/ISOS/OracleLinux/OL9/u5/x86_64/OracleLinux-R9-U5-x86_64-dvd.iso"
iso_storage_pool = "fractal"
unmount = true
iso_checksum = "sha256:c2fa76c502cf1d93dfbd084d494d963ab7ea0a6f5535a083b8547b34037e88e1"
iso_download_pve = true
}
disks {
disk_size = "20G"
storage_pool = "fractal"
type = "sata"
format = "qcow2"
}
network_adapters {
model = "virtio"
bridge = "vmbr0"
firewall = "false"
}
cloud_init = true
cloud_init_storage_pool = "fractal"
boot_command = [
"<up>",
"<tab><wait>",
" text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg",
"<wait><wait><wait><wait><wait><wait><wait><wait><wait><wait><enter>"
]
http_directory = "http"
ssh_username = "packer"
ssh_private_key_file = "../id_ed25519"
ssh_timeout = "30m"
ssh_pty = true
task_timeout = "10m"
}
build {
name = "oraclelinux-9.5"
sources = ["source.proxmox-iso.oraclelinux-9_5"]
provisioner "shell" {
script = "scripts/cleanup.sh"
}
}
Operating system and Environment details
Running packer on M1 silicon, MacOS 15.1.1
Log Fragments and crash.log files
No relevant logs
The same for me, cpu_type parameter does not work in 1.2.2 :(
The is also occurring for me. Explicitly setting the type does nothing. This is critical for RHEL and RHEL-based builds, which will kernel panic when not set to host: https://forum.proxmox.com/threads/kernel-panic-installing-rocky-or-almalinux.114885/
Can confirm this bug is still present. Any machine that is created by packer is using the default kvm64 cpu_type.
Hello,
Thank you for your work on this project. I believe I have identified a potential source of the issue. After reviewing the code, I think the problem might come from the file builder/proxmox/common/step_start_vm.go, in version 1.2.1, there was a QemuCpu field that allowed setting the CPUType. However, it seems that this field was omitted in version 1.2.2.
Was this omission intentional, or could it be an oversight?
Thank you for your feedback and for all the work you’ve done!
Same here, can also confirm that the issue (still) exists. Downgrading to v1.2.1 does the trick for me.
Thanks for pointing out, @nicocau.
Hey, @mpywell it appears that commit authored by you might have introduced a regression. Would you like to address it? Committer: @lbajolet-hashicorp, it appears we have a PR if you'd like to review it.
This bug is preventing us from upgrading the plugin for Ludus.
I also ran into the same issue and had to downgrade to 1.2.1 for it to work
me too. had to downgrade to 1.2.1 for it to work
Ditto, downgrade fixed it for now.
problem still exists Packer v1.12.0
Here is when everything went broken:
CPUType variable is never configured.
@aalmenar, This was pointed out above
The fix https://github.com/hashicorp/packer-plugin-proxmox/pull/308 was made quite a while ago, but it hasn't been fully approved yet.
Hi team,
I’m running into the issue described here where cpu_type isn’t being passed to Proxmox in v1.2.2, forcing all my VMs to use the default value instead of what’s set in my Packer templates. Downgrading to 1.2.1 fixes it, but I can’t downgrade since 1.2.2 includes critical fixes I need. I noticed some users mentioned a fix was committed—could you please review and approve it for an official release? Right now, I’m stuck manually updating the cpu_type on every VM after provisioning, which is a pain. Thanks!
Is there date when the updated version will be released fixing cpu_type issue ?
This makes it impossible to build against proxmox since RHEL/Alma kernel panics...seems to take a long time to add a single line to the code.
I compiled it myself with this one line added just add the line from https://github.com/hashicorp/packer-plugin-proxmox/pull/308/commits/4caccd783728ff123b82850c8e1a2fff7316a1e5 in builder/proxmox/common/step_start_vm.go
Now that IBM owns Hashicorp maybe we can hope for better RHEL support....?
I got tired of waiting, forked it, fixed the CPU issue, and created a release. You can check it out here: https://github.com/hashicorp/packer-plugin-proxmox/compare/main...badsectorlabs:packer-plugin-proxmox:main
And use it with
packer plugins remove github.com/hashicorp/proxmox v1.2.2
packer plugins install github.com/badsectorlabs/proxmox v1.2.3
Is this plugin still maintained?
The fix that many community members here have called out as the solution to this issue was released today https://github.com/hashicorp/packer-plugin-proxmox/releases/tag/v1.2.3, please let us know if you are still experiencing this issue in v1.2.3
Thanks for the fix. I can approve that the v1.2.3 is now generating the correct CpuType
Given that confirmation I'll close this issue, please feel free to re-open or open a new issue linking to this one if you still experience this bug
But now I have to use boot = "c" boot = "order=scsi0;net0;ide0" is not working anymore
The fix that many community members here have called out as the solution to this issue was released today https://github.com/hashicorp/packer-plugin-proxmox/releases/tag/v1.2.3, please let us know if you are still experiencing this issue in v1.2.3
Now the cpu flags doesn't work, prior to 1.2.3 I could use following cpu type: "host,flags=+md-clear;+pcid;+spec-ctrl;+ssbd;+aes" Now it doesn't work anymore.