Ubuntu has discontinued preseed as of 20.04 according to this https://discourse.ubuntu.com/t/server-installer-plans-for-20-04-lts/13631
(I'm pretty sure Canonical is trying to keep up with Apple in terms of breaking all the things in the name of progress without regard to users and customers.)
Here is my workaround, which I just got working...
I created a preseed.cfg file with all the things. In my case this preseed.cfg file is generated as a JINJA template to pull secrets in from a secrets store.
Then I created a docker container to serve my preseed.cfg file. It looks kinda like this:
FROM REDACTED_INTERNAL_PATH/base:latest as runtime
USER root
RUN apt-get install nginx sudo -y && \
rm /var/www/html/index.nginx-debian.html && \
rm -rf /etc/update-motd.d/* && \
echo "%service ALL=NOPASSWD: /etc/init.d/nginx" > /etc/sudoers.d/service
COPY preseed.d/entrypoint.sh /opt/
COPY preseed.d/html/*.cfg /var/www/html/
USER service
ENTRYPOINT [ "/opt/entrypoint.sh" ]
3.I have a makefile that builds and runs this docker container to serve my preseed.cfg file.
4. I then use something like the following in packer to boot the 22.04 virtual machine:
variable iso_url {
type = string
default = "https://releases.ubuntu.com/22.04/ubuntu-22.04-live-server-amd64.iso"
}
variable iso_checksum {
type = string
default = "84aeaf7823c8c61baa0ae862d0a06b03409394800000b3235854a6b38eb4856f"
}
variable cpus {
type = number
default = 2
}
variable memory_size {
type = number
default = 4096
}
variable disk_size {
type = number
default = 61440
}
variable ssh_username {
type = string
default = "<redacted>"
}
variable ssh_password {
type = string
default = "<redacted>"
}
packer {
required_plugins {
parallels = {
version = ">= 1.0.1"
source = "github.com/hashicorp/parallels"
}
}
}
source "parallels-iso" "ubuntu" {
boot_command = [
"<esc><esc><enter><wait>",
"/install/vmlinuz noapic ",
"preseed/url=http://{{ .HTTPIP }}:8080/preseed.cfg <wait>",
"debian-installer=en_US ",
"auto locale=en_US",
"kbd-chooser/method=us <wait>",
"hostname={{ .Name }} <wait>",
"fb=false",
"debconf/frontend=noninteractive <wait>",
"keyboard-configuration/modelcode=SKIP ",
"keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA ",
"console-setup/ask_detect=false <wait>",
"initrd=/install/initrd.gz -- <enter><wait>",
]
boot_wait = "10s"
guest_os_type = "ubuntu"
vm_name = "ubuntu_base"
iso_checksum = var.iso_checksum
iso_url = var.iso_url
parallels_tools_flavor = "lin"
shutdown_command = "echo 'shutdown -P now' > shutdown.sh; echo 'vagrant'|sudo -S sh 'shutdown.sh'"
ssh_username = var.ssh_username
ssh_password = var.ssh_password
ssh_timeout = "30s"
ssh_wait_timeout = "10000s"
prlctl = [
["set", "{{.Name}}", "--3d-accelerate", "off"],
["set", "{{.Name}}", "--adaptive-hypervisor", "on"],
["set", "{{.Name}}", "--memsize", var.memory_size],
["set", "{{.Name}}", "--cpus", var.cpus],
["set", "{{.Name}}", "--efi-boot", "off"],
]
}
build {
sources = ["source.parallels-iso.ubuntu"]
provisioner "shell" {
scripts = [ ### REDACTED ###]
}
post-processor "vagrant" {
}
}