I am trying to set up an automated installation environment for ubuntu 22.04. We have this already working in production for 20.04 and previous LTS releases for many years. We use pxe/isolinux and a tftp and dhcp server to perform the network and cd boot. And some trickery to get uefi working.
I am unable to find working vmlinuz and initrd images which allow me to start an automated ubuntu 22.04 installation using preseeding and the debian installer (d-i).
I use the following to install 20.04, this does not work on 22.04:
linuxefi /path/to/2004/amd64/linux auto=true priority=critical url= console-setup/layoutcode=us interface=auto
initrdefi /path/to/2004/amd64/initrd.gzI have tried extracting the vmlinuz and initrd.gz images from 22.04 ubuntu CD iso images. However no matter what I try it even fails to find a root filesystem. I am guessing the images do not have d-i and preseed functionality built in anymore?
If such images don't exist how would I go about creating my own? I don't feel too happy migrating to whatever automated installation method canonical wants to enforce. Our whole infrastructure is based on the previously mentioned method and we install multiple OSes in a similar way.
I asked this on serverfault but have had no response so far so I figured this would be a more appropriate place to ask.
11 Answer
Ubuntu has discontinued preseed as of 20.04 according to this
(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 = ""
}
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 = "" } }
}
source "parallels-iso" "ubuntu" { boot_command = [ "<esc><esc><enter><wait>", "/install/vmlinuz noapic ", "preseed/url= .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" { }
}