I’m struggling a bit to make Packer works on my Proxmox Hypervisor to create a VM template.
I keep on getting hit by the “network autoconfiguration failed” even if my preseed.cfg mentionned to disable the network autoconfig.
It seems like the setup in my preseed.cfg isn’t used. I’ve setup a fix ip address, but it’s keep on hiting this prompt…
Here are my files:
debian12.pkrvars.hcl:
// debian12.pkr.hcl
packer {
required_plugins {
name = {
version = "1.1.6"
source = "github.com/hashicorp/proxmox"
}
}
}
variable "bios_type" {
type = string
}
variable "boot_command" {
type = string
}
variable "boot_wait" {
type = string
}
variable "bridge_firewall" {
type = bool
default = false
}
variable "bridge_name" {
type = string
}
variable "cloud_init" {
type = bool
}
variable "iso_file" {
type = string
}
variable "iso_storage_pool" {
type = string
default = "local"
}
variable "machine_default_type" {
type = string
default = "pc"
}
variable "network_model" {
type = string
default = "virtio"
}
variable "os_type" {
type = string
default = "l26"
}
variable "proxmox_api_token_id" {
type = string
}
variable "proxmox_api_token_secret" {
type = string
sensitive = true
}
variable "proxmox_api_url" {
type = string
}
variable "proxmox_node" {
type = string
}
variable "qemu_agent_activation" {
type = bool
default = true
}
variable "scsi_controller_type" {
type = string
}
variable "ssh_timeout" {
type = string
}
variable "tags" {
type = string
}
variable "io_thread" {
type = bool
}
variable "cpu_type" {
type = string
default = "kvm64"
}
variable "vm_info" {
type = string
}
variable "disk_discard" {
type = bool
default = true
}
variable "disk_format" {
type = string
default = "qcow2"
}
variable "disk_size" {
type = string
default = "16G"
}
variable "disk_type" {
type = string
default = "scsi"
}
variable "nb_core" {
type = number
default = 1
}
variable "nb_cpu" {
type = number
default = 1
}
variable "nb_ram" {
type = number
default = 1024
}
variable "ssh_username" {
type = string
}
variable "ssh_password" {
type = string
}
variable "ssh_handshake_attempts" {
type = number
}
variable "storage_pool" {
type = string
default = "local-lvm"
}
variable "vm_id" {
type = number
default = 99999
}
variable "vm_name" {
type = string
}
locals {
packer_timestamp = formatdate("YYYYMMDD-hhmm", timestamp())
}
source "proxmox-iso" "debian12" {
bios = "${var.bios_type}"
boot_command = ["${var.boot_command}"]
boot_wait = "${var.boot_wait}"
cloud_init = "${var.cloud_init}"
cloud_init_storage_pool = "${var.storage_pool}"
communicator = "ssh"
cores = "${var.nb_core}"
cpu_type = "${var.cpu_type}"
http_directory = "autoinstall"
insecure_skip_tls_verify = true
iso_file = "${var.iso_file}"
machine = "${var.machine_default_type}"
memory = "${var.nb_ram}"
node = "${var.proxmox_node}"
os = "${var.os_type}"
proxmox_url = "${var.proxmox_api_url}"
qemu_agent = "${var.qemu_agent_activation}"
scsi_controller = "${var.scsi_controller_type}"
sockets = "${var.nb_cpu}"
ssh_handshake_attempts = "${var.ssh_handshake_attempts}"
ssh_pty = true
ssh_timeout = "${var.ssh_timeout}"
ssh_username = "${var.ssh_username}"
ssh_password = "${var.ssh_password}"
tags = "${var.tags}"
template_description = "${var.vm_info} - ${local.packer_timestamp}"
token = "${var.proxmox_api_token_secret}"
unmount_iso = true
username = "${var.proxmox_api_token_id}"
vm_id = "${var.vm_id}"
vm_name = "${var.vm_name}"
disks {
discard = "${var.disk_discard}"
disk_size = "${var.disk_size}"
format = "${var.disk_format}"
io_thread = "${var.io_thread}"
storage_pool = "${var.storage_pool}"
type = "${var.disk_type}"
}
network_adapters {
bridge = "${var.bridge_name}"
firewall = "${var.bridge_firewall}"
model = "${var.network_model}"
}
}
build {
sources = ["source.proxmox-iso.debian12"]
}
debian12.pkrvars.hcl:
// custom.pkvars.hcl
bios_type = "seabios"
boot_command = "<esc><wait>auto console-keymaps-at/keymap=fr console-setup/ask_detect=false debconf/frontend=noninteractive fb=false url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<enter>"
boot_wait = "10s"
bridge_name = "vmbr1"
bridge_firewall = false
cloud_init = true
cpu_type = "x86-64-v2-AES"
disk_discard = true
disk_format = "qcow2"
disk_size = "12G"
disk_type = "scsi"
iso_file = "DIR01:iso/debian-12.5.0-amd64-netinst.iso"
machine_default_type = "pc"
nb_core = 1
nb_cpu = 1
nb_ram = 2048
network_model = "virtio"
io_thread = false
os_type = "l26"
proxmox_api_token_id = "packer@pve!packer"
proxmox_api_token_secret = "token_secret"
proxmox_api_url = "http://ip_address:8006/api2/json"
proxmox_node = "node1"
qemu_agent_activation = true
scsi_controller_type = "virtio-scsi-pci"
ssh_handshake_attempts = 6
ssh_timeout = "35m"
ssh_username = "packer"
ssh_password = ""
storage_pool = "DIR01"
tags = "template"
vm_id = 99999
vm_info = "Debian 12 Packer Template"
vm_name = "pckr-deb12"
autoinstall/preseed.cfg:
#_preseed_V1
d-i debian-installer/language string en
d-i debian-installer/country string FR
d-i debian-installer/locale string en_US.UTF-8
d-i localechooser/supported-locales multiselect en_US.UTF-8, fr_FR.UTF-8
d-i keyboard-configuration/xkb-keymap select fr
d-i console-keymaps-at/keymap select fr-latin9
d-i debian-installer/keymap string fr-latin9
# d-i netcfg/dhcp_failed note
# d-i netcfg/dhcp_options select Configure network manually
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/choose_interface select auto
d-i netcfg/get_ipaddress string 10.10.1.250
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 10.10.1.254
d-i netcfg/get_nameservers string 1.1.1.1
d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string pckr-deb12
d-i netcfg/get_domain string local.hommet.net
d-i hw-detect/load_firmware boolean false
d-i mirror/country string FR
d-i mirror/http/hostname string deb.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i passwd/root-login boolean true
d-i passwd/make-user boolean true
d-i passwd/root-password password pouetpouet
d-i passwd/root-password-again password pouetpouet
d-i passwd/user-fullname string jho
d-i passwd/username string jho
d-i passwd/user-password password pouetpouet
d-i passwd/user-password-again password pouetpouet
d-i clock-setup/utc boolean true
d-i time/zone string Europe/Paris
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string 0.fr.pool.ntp.org
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-auto-lvm/guided_size string max
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/choose_recipe select multi
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/mount_style select uuid
d-i base-installer/install-recommends boolean false
d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/use_mirror boolean true
d-i apt-setup/security_host string security.debian.org
tasksel tasksel/first multiselect standard, ssh-server
d-i pkgsel/include string qemu-guest-agent sudo ca-certificates cloud-init
d-i pkgsel/upgrade select safe-upgrade
popularity-contest popularity-contest/participate boolean false
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean false
d-i grub-installer/bootdev string default
d-i finish-install/reboot_in_progress note
d-i cdrom-detect/eject boolean true
If you have any idea how to make it work, let me know.
I can’t understand, I feel like it doesn’t take the preseed.cfg file into consideration.
