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

boot iso url timeout when using iso_download_pve = true #313

Open
Dialgatrainer02 opened this issue Feb 19, 2025 · 1 comment
Open

boot iso url timeout when using iso_download_pve = true #313

Dialgatrainer02 opened this issue Feb 19, 2025 · 1 comment
Labels

Comments

@Dialgatrainer02
Copy link

Dialgatrainer02 commented Feb 19, 2025

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

when using iso_download_pve = true to download isos and skip the extra step of downloading locally first. packer times out but in the pve tasks it still shows the iso downloading. (also add a way to overwrite or reuse an image with the same name as waiting for packer to upload the same image while testing is painful)

Reproduction Steps

build a template with iso download pve on with slow internet and wait for it to timeout then go to proxmox web ui

Plugin and Packer version

v1.12.0

Simplified Packer Buildfile

build a vm using this boot_iso config

boot_iso {
    iso_checksum = "none"
    iso_url = "https://repo.almalinux.org/almalinux/9.5/isos/x86_64/AlmaLinux-9-latest-x86_64-boot.iso"
    iso_download_pve = true
    iso_storage_pool = "local"
    unmount = true
  }

Operating system and Environment details

proxmox version 8.2.2
host os: arch linux
iso image being downloaded almalinux 9.5

Log Fragments and crash.log files

PACKER_LOG=1 packer build -var-file=secrets.auto.pkrvars.hcl server.pkr.hcl
2025/02/19 21:02:11 [INFO] Packer version: 1.12.0 [go1.23.5 linux amd64]
2025/02/19 21:02:11 Detected xdg config directory from env var: /home/olivia/.config
2025/02/19 21:02:11 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2025/02/19 21:02:11 [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/olivia/.packerconfig
2025/02/19 21:02:11 [WARN] Config file doesn't exist: /home/olivia/.packerconfig
2025/02/19 21:02:11 Detected xdg config directory from env var: /home/olivia/.config
2025/02/19 21:02:11 [INFO] Setting cache directory: /home/olivia/.cache/packer
2025/02/19 21:02:11 Detected xdg config directory from env var: /home/olivia/.config
2025/02/19 21:02:11 [TRACE] listing potential installations for "github.com/hashicorp/proxmox" that match "~> 1". plugingetter.ListInstallationsOptions{PluginDirectory:"/home/olivia/.config/packer/plugins", BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000b82080)}}, ReleasesOnly:false}}
2025/02/19 21:02:11 [TRACE] Found the following "github.com/hashicorp/proxmox" installations: [{/home/olivia/.config/packer/plugins/github.com/hashicorp/proxmox/packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 v1.2.2 x5.0}]
2025/02/19 21:02:11 [INFO] found external [-packer-default-plugin-name- clone iso] builders from name plugin
2025/02/19 21:02:11 plugin "/home/olivia/.config/packer/plugins/github.com/hashicorp/proxmox/packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64" does not support Protobuf, forcing use of Gob
2025/02/19 21:02:11 [TRACE] listing potential installations for <nil> that match "". plugingetter.ListInstallationsOptions{PluginDirectory:"/home/olivia/.config/packer/plugins", BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc0000b8600)}}, ReleasesOnly:false}}
2025/02/19 21:02:11 [INFO] found external [-packer-default-plugin-name- clone iso] builders from proxmox plugin
2025/02/19 21:02:11 found external [-packer-default-plugin-name- local] provisioner from ansible plugin
2025/02/19 21:02:11 [INFO] found external [-packer-default-plugin-name-] builders from lxc plugin
2025/02/19 21:02:11 [TRACE] validateValue: not active for pve_endpoint, so skipping
2025/02/19 21:02:11 [TRACE] validateValue: not active for pve_username, so skipping
2025/02/19 21:02:11 [TRACE] validateValue: not active for pve_password, so skipping
2025/02/19 21:02:11 [INFO] Starting external plugin /home/olivia/.config/packer/plugins/github.com/hashicorp/proxmox/packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 start builder iso
2025/02/19 21:02:11 Starting plugin: /home/olivia/.config/packer/plugins/github.com/hashicorp/proxmox/packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 []string{"/home/olivia/.config/packer/plugins/github.com/hashicorp/proxmox/packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64", "start", "builder", "iso"}
2025/02/19 21:02:11 Waiting for RPC address for: /home/olivia/.config/packer/plugins/github.com/hashicorp/proxmox/packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64
2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 Plugin address: unix /tmp/packer-plugin2870632782
2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 Waiting for connection...
2025/02/19 21:02:11 Received unix RPC address for /home/olivia/.config/packer/plugins/github.com/hashicorp/proxmox/packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64: addr is /tmp/packer-plugin2870632782
2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 Serving a plugin connection...
2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 [TRACE] starting builder iso
2025/02/19 21:02:11 [DEBUG] - common: receiving ConfigSpec as gob
2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 Number of sockets 0 is too small, using default: 1
2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 OS not set, using default 'other'
2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 Disk 0 format not set, using default 'raw'
2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 Disk 0 cache mode not set, using default 'none'
2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 SCSI controller not set, using default 'lsi'
2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 Cloud-Init disk type not set, using default 'ide'
2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 boot_iso device type not set, using default type 'ide' and index '2'
2025/02/19 21:02:11 [DEBUG] - common: receiving ConfigSpec as gob
a checksum is highly recommended.

  on server.pkr.hcl line 25:
  (source code not available)

2025/02/19 21:02:11 Build debug mode: false
2025/02/19 21:02:11 Force build: false
2025/02/19 21:02:11 On error: 
2025/02/19 21:02:11 Waiting on builds to complete...
2025/02/19 21:02:11 Starting build run: proxmox-iso.alma-kickstart
2025/02/19 21:02:11 Running builder: proxmox-iso
2025/02/19 21:02:11 [INFO] (telemetry) Starting builder proxmox-iso.alma-kickstart
Warning: A checksum of 'none' was specified. Since ISO files are so big,
a checksum is highly recommended.

  on server.pkr.hcl line 25:
  (source code not available)


proxmox-iso.alma-kickstart: output will be in this color.

2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 using password auth
2025/02/19 21:02:11 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:02:11 [INFO] - beginning download of https://repo.almalinux.org/almalinux/9.5/isos/x86_64/AlmaLinux-9-latest-x86_64-boot.iso to node pve1
2025/02/19 21:03:12 packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64 plugin: 2025/02/19 21:03:12 [ERROR] - failed to download iso from https://repo.almalinux.org/almalinux/9.5/isos/x86_64/AlmaLinux-9-latest-x86_64-boot.iso: Wait timeout for:UPID:pve1:001FD5E8:16CE17AD:67B646A6:download:AlmaLinux-9-latest-x86_64-boot.iso:root@pam:
2025/02/19 21:03:12 [INFO] (telemetry) ending proxmox-iso.alma-kickstart
==> Wait completed after 1 minute 1 second
2025/02/19 21:03:12 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2025/02/19 21:03:12 machine readable: proxmox-iso.alma-kickstart,error []string{"failed to download ISO with all the provided URLs, attempted: https://repo.almalinux.org/almalinux/9.5/isos/x86_64/AlmaLinux-9-latest-x86_64-boot.iso"}
==> Builds finished but no artifacts were created.
2025/02/19 21:03:12 [INFO] (telemetry) Finalizing.
Build 'proxmox-iso.alma-kickstart' errored after 1 minute 1 second: failed to download ISO with all the provided URLs, attempted: https://repo.almalinux.org/almalinux/9.5/isos/x86_64/AlmaLinux-9-latest-x86_64-boot.iso

==> Wait completed after 1 minute 1 second

==> Some builds didn't complete successfully and had errors:
--> proxmox-iso.alma-kickstart: failed to download ISO with all the provided URLs, attempted: https://repo.almalinux.org/almalinux/9.5/isos/x86_64/AlmaLinux-9-latest-x86_64-boot.iso

==> Builds finished but no artifacts were created.
2025/02/19 21:03:13 waiting for all plugin processes to complete...
2025/02/19 21:03:13 /home/olivia/.config/packer/plugins/github.com/hashicorp/proxmox/packer-plugin-proxmox_v1.2.2_x5.0_linux_amd64: plugin process exited

task-pve1-download-2025-02-19T21_01_26Z.log

@JasonBrannon
Copy link

JasonBrannon commented Feb 23, 2025

I ran into a very similar issue, although I don't have slow network speeds or a slow server, it was as if packer did not wait long enough on the acknowledgement from Proxmox confirming the ISO was downloaded.

This is all I added:

Increase the task timeout to allow enough time for a large ISO download.

task_timeout = "10m"

source "proxmox-iso" "ubuntu-template-builder" {
  # Boot command sent to the VM to begin installation.
  boot_command = [
    "c",
    "linux /casper/vmlinuz -- autoinstall ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/'",
    "<enter><wait><wait>",
    "initrd /casper/initrd",
    "<enter><wait><wait>",
    "boot<enter>"
  ]

  # Increase the task timeout to allow enough time for a large ISO download.
  task_timeout = "10m"

  # Time to wait after the boot command is sent.
  boot_wait    = "10s"

  # CPU and memory configuration for the VM.
  cores        = 2
  memory       = 8192  # 8G

  # Disk configuration for the VM. This disk is where the OS will be installed.
  disks {
    disk_size    = "130G"
    format       = var.proxmox_storage_format
    storage_pool = var.proxmox_storage_pool  # Where the VM disk/template will be created.
    type         = "scsi"
  }

  # Network adapter configuration.
  network_adapters {
    bridge = "vmbr0"  # Proxmox network bridge.
  }

  # Proxmox node and API configuration.
  node            = var.proxmox_node
  proxmox_url     = var.proxmox_url
  scsi_controller = "virtio-scsi-single"  # SCSI controller model.

  # SSH configuration for connecting to the VM during provisioning.
  ssh_private_key_file = var.ssh_private_key_file
  ssh_port             = 22
  ssh_timeout          = "30m"
  ssh_username         = "ubuntu"  # Update with the appropriate username.

  # Template information for the final template.
  template_description = var.template_description
  template_name        = var.template_name

  # Proxmox API authentication settings.
  username = var.proxmox_username
  token    = var.proxmox_token

  # Boot ISO configuration. This tells Proxmox where to download and store the ISO.
  boot_iso {
    type             = "scsi"  # Bus type for mounting the ISO.
    # Construct the full ISO download URL from the base URL and file name.
    iso_url          = "${var.ubuntu_iso_base_url}${var.ubuntu_iso_file}"
    unmount          = true  # Unmount the ISO from the VM after installation.
    iso_checksum     = var.ubuntu_image_checksum  # ISO checksum (set to "none" to bypass verification).
    iso_storage_pool = var.proxmox_iso_storage_pool  # Storage pool where the ISO is stored.
    iso_download_pve = true  # Instruct Proxmox to download the ISO directly.
  }

  # HTTP directory for serving additional files (e.g., for cloud-init).
  http_directory           = "ubuntu2404/http"

  # Skip TLS verification if using self-signed certificates.
  insecure_skip_tls_verify = true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants