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

500 no such file '/version

Open gabrielcosi opened this issue 8 months ago • 1 comments

Overview of the Issue

Build fails immediately with a "500 no such file '/version'" error. It appears to be an issue with proxmox-api-go

Reproduction Steps

  • Configure a Packer build file with the proxmox-iso builder
  • Set up API token authentication in credentials.pkrvars.hcl, Roles:
Datastore.AllocateSpace Datastore.AllocateTemplate Datastore.Audit Pool.Audit
Sys.Modify VM.Allocate VM.Audit VM.Backup VM.Clone VM.Config.CDROM
VM. Config.CPU VM.Config.Cloudinit VM.Config.Disk VM.Config.HWType
VM.Config.Memory VM.Config.Network VM.Config.Options VM.Console VM.Migrate
VM.Monitor VM.PowerMgmt VM.Snapshot VM.Snapshot.Rollback
  • Run packer build -debug -var-file=credentials.pkrvars.hcl ubuntu-runner.pkr.hcl

Plugin and Packer version

Packer version: 1.12.0 [go1.22.9 darwin arm64] Proxmox plugin version: packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64

Packer Buildfile

Build File
variable "proxmox_api_url" {
    type = string
}

variable "proxmox_api_token_id" {
    type = string
}

variable "proxmox_api_token_secret" {
    type = string
    sensitive = true
}


source "proxmox-iso" "ubuntu-runner" {
  proxmox_url = "${var.proxmox_api_url}"
  username = "${var.proxmox_api_token_id}"
  token = "${var.proxmox_api_token_secret}"
 
  node                     = "alpha"

  vm_id                    = "2000"
  vm_name                  = "ubuntu-runner"
  template_description     = "GitLab Runner template (Ubuntu)"
    
  qemu_agent               = true
  scsi_controller          = "virtio-scsi-pci"

  boot_iso {
    type = "scsi"
    iso_file = "iso-images:iso/ubuntu-24.04.2-live-server-amd64.iso"
    unmount = true
  }
  
  disks {
    disk_size = "20G"
    format = "raw"
    storage_pool = "local-lvm"
    type = "virtio"
  }

  network_adapters {
    model     = "virtio"
    bridge    = "vmbr0"
  }

  cores = "4"
  memory = "8192"

  cloud_init              = true
  cloud_init_storage_pool = "ceph-lvm"
  
  boot_command = [
      "<esc><wait>",
      "e<wait>",
      "<down><down><down><end>",
      "<bs><bs><bs><bs><wait>",
      "autoinstall ds=nocloud-net\\;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ---<wait>",
      "<f10><wait>"
  ]

  boot                    = "c"
  boot_wait               = "10s"
  communicator            = "ssh"

  http_directory          = "http"
  ssh_username            = "ubuntu"
  ssh_password            = "ubuntu"
  ssh_timeout             = "10m"
  ssh_pty                 = true
}

build {
  name = "ubuntu-runner"
  sources = ["source.proxmox-iso.ubuntu-runner"]
  
  provisioner "shell" {
        inline = [
            "while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done",
            "sudo rm /etc/ssh/ssh_host_*",
            "sudo truncate -s 0 /etc/machine-id",
            "sudo apt -y autoremove --purge",
            "sudo apt -y clean",
            "sudo apt -y autoclean",
            "sudo cloud-init clean",
            "sudo rm -f /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg",
            "sudo rm -f /etc/netplan/00-installer-config.yaml",
            "sudo sync"
        ]
    }

    provisioner "file" {
        source = "files/99-pve.cfg"
        destination = "/tmp/99-pve.cfg"
    }

    provisioner "shell" {
        inline = [ "sudo cp /tmp/99-pve.cfg /etc/cloud/cloud.cfg.d/99-pve.cfg" ]
    }

    provisioner "shell" {
        inline = [
            "sudo apt-get install -y ca-certificates curl gnupg lsb-release",
            "curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg",
            "echo \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null",
            "sudo apt-get -y update",
            "sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
        ]
    }
}

Operating system and Environment details

  • macOS 15.4.1 (M3 Max)
  • Proxmox VE 8.4.1

Log Fragments and crash.log files

Logs
2025/04/23 07:40:38 Build debug mode: true
2025/04/23 07:40:38 Force build: false
2025/04/23 07:40:38 On error:
2025/04/23 07:40:38 Debug enabled, so waiting for build to finish: ubuntu-runner.proxmox-iso.ubuntu-runner
2025/04/23 07:40:38 Starting build run: ubuntu-runner.proxmox-iso.ubuntu-runner
2025/04/23 07:40:38 Running builder: proxmox-iso
2025/04/23 07:40:38 [INFO] (telemetry) Starting builder proxmox-iso.ubuntu-runner
Debug mode enabled. Builds will not be parallelized.
ubuntu-runner.proxmox-iso.ubuntu-runner: output will be in this color.

2025/04/23 07:40:38 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/04/23 07:40:38 using token auth
2025/04/23 07:40:38 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/04/23 07:40:38 No CD files specified. CD disk will not be made.
==> ubuntu-runner.proxmox-iso.ubuntu-runner: Pausing after run of step 'StepCreateCD'. Press enter to continue.
2025/04/23 07:40:39 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/04/23 07:40:39 No URLs were provided to Step Download. Continuing...
==> ubuntu-runner.proxmox-iso.ubuntu-runner: Pausing after run of step 'StepDownload'. Press enter to continue.
==> ubuntu-runner.proxmox-iso.ubuntu-runner: Pausing after run of step 'stepUploadISO'. Press enter to continue.
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/04/23 07:40:40 Mapping Disk to virtio0
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/04/23 07:40:40 Mapping ISO to scsi0
==> ubuntu-runner.proxmox-iso.ubuntu-runner: Creating VM
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/04/23 07:40:40 >>>>>>>>>> REQUEST:
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: GET /version HTTP/1.1
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Host: 10.0.10.11:8006
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: User-Agent: Go-http-client/1.1
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Accept: application/json
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Authorization: PVEAPIToken=packer@pam!packer=<sensitive>
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Accept-Encoding: gzip
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin:
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/04/23 07:40:40 <<<<<<<<<< RESULT:
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: HTTP/1.1 500 no such file '/version'
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Connection: close
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Content-Length: 24
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Cache-Control: max-age=0
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Date: Wed, 23 Apr 2025 05:40:40 GMT
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Expires: Wed, 23 Apr 2025 05:40:40 GMT
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Pragma: no-cache
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Server: pve-api-daemon/3.0
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin:
2025/04/23 07:40:40 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: no such file '/version'
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/04/23 07:40:41 >>>>>>>>>> REQUEST:
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: GET /version HTTP/1.1
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Host: 10.0.10.11:8006
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: User-Agent: Go-http-client/1.1
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Accept: application/json
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Authorization: PVEAPIToken=packer@pam!packer=<sensitive>
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Accept-Encoding: gzip
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin:
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/04/23 07:40:41 <<<<<<<<<< RESULT:
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: HTTP/1.1 500 no such file '/version'
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Connection: close
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Content-Length: 24
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Cache-Control: max-age=0
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Date: Wed, 23 Apr 2025 05:40:41 GMT
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Expires: Wed, 23 Apr 2025 05:40:41 GMT
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Pragma: no-cache
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Server: pve-api-daemon/3.0
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin:
2025/04/23 07:40:41 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: no such file '/version'
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/04/23 07:40:43 >>>>>>>>>> REQUEST:
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: GET /version HTTP/1.1
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Host: 10.0.10.11:8006
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: User-Agent: Go-http-client/1.1
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Accept: application/json
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Authorization: PVEAPIToken=packer@pam!packer=<sensitive>
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Accept-Encoding: gzip
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin:
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/04/23 07:40:43 <<<<<<<<<< RESULT:
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: HTTP/1.1 500 no such file '/version'
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Connection: close
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Content-Length: 24
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Cache-Control: max-age=0
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Date: Wed, 23 Apr 2025 05:40:43 GMT
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Expires: Wed, 23 Apr 2025 05:40:43 GMT
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Pragma: no-cache
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: Server: pve-api-daemon/3.0
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin:
2025/04/23 07:40:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: no such file '/version'
==> ubuntu-runner.proxmox-iso.ubuntu-runner: Error creating VM: 500 no such file '/version'
==> ubuntu-runner.proxmox-iso.ubuntu-runner: Pausing before cleanup of step 'stepUploadISO'. Press enter to continue.
==> ubuntu-runner.proxmox-iso.ubuntu-runner: Pausing before cleanup of step 'StepDownload'. Press enter to continue.
==> ubuntu-runner.proxmox-iso.ubuntu-runner: Pausing before cleanup of step 'StepCreateCD'. Press enter to continue.
2025/04/23 07:40:54 [INFO] (telemetry) ending proxmox-iso.ubuntu-runner
2025/04/23 07:40:54 Waiting on builds to complete...
==> Wait completed after 15 seconds 361 milliseconds
2025/04/23 07:40:54 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2025/04/23 07:40:54 machine readable: ubuntu-runner.proxmox-iso.ubuntu-runner,error []string{"Error creating VM: 500 no such file '/version'"}
==> Builds finished but no artifacts were created.
Build 'ubuntu-runner.proxmox-iso.ubuntu-runner' errored after 15 seconds 361 milliseconds: Error creating VM: 500 no such file '/version'

gabrielcosi avatar Apr 23 '25 05:04 gabrielcosi

@gabrielcosi does your Proxmox API URL have "/api2/json" at the end of it.

For Example: https://192.168.0.10:8006/api2/json

I got this error when I forgot the /api2/json at the end, the /version is a subdirectory of the API endpoint and is looking for the version of your PVE server.

Jj1910 avatar Oct 20 '25 23:10 Jj1910