Closed erSitzt closed 2 months ago
Just as an example
ubuntu@rke2-zentrale-infra-agent-1:~$ cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="autoinstall ds=nocloud-net;seedfrom=http://172.16.x.x:8012/"
This is from a VM that was deployed with 22.04.1 iso and updated during autoinstall to 22.04.2... cloud-init still working afterwards
The same is present in VMs deployed with 22.04.2 iso, but those fail with cloud-init, because only nocloud-net
datasource is used
I'd recommend opening this on the project for the Packer Plugin for vSphere and closing this one.
By the way, why not use the VMware datasource that was upstreamed to cloud-init?
@tenthirtyam what do you mean ?
My case looks like almost every example for packer / ubuntu with vmware... autoinstall / subiquity to install ubuntu and create the template cloud-init with VMware datasource when deploying from the template.. <== this is where the problem occurs, so isnt this the upstreamed VMware datasource ???
Try removing nocloud in the boot and then set the cloud-init configuration and the VMware data source during your provisioning phase.
You can find examples in my other project: https://github.com/vmware-samples/packer-examples-for-vsphere/blob/develop/builds/linux/ubuntu/22-04-lts/linux-ubuntu.pkr.hcl
I dont understand, you set the same boot command in your example.
Are you configuring the VMware data source later with a provisioner?
I'm using terraform to deploy the template afterwards. The problem has nothing to do with any datasource, only with the boot_command
remaining as GRUB_CMDLINE_LINUX_DEFAULT
.
There are two bugs at play here
https://bugs.launchpad.net/subiquity/+bug/1956452 and https://github.com/canonical/cloud-init/issues/4977
@tenthirtyam and even your example would cause this issue, as your are using ---
in the beginning of the kernel line
This is my version to avoid the problems
boot_command = [
"c<wait10s>",
"linux /casper/vmlinuz autoinstall ds=\"nocloud-net;seedfrom=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" ---",
"<enter><wait5s>",
"initrd /casper/initrd",
"<enter><wait5s>",
"boot",
"<wait5s><enter><wait300>"
]
Putting it at the end will result in a clean template, without any kernel parameters not needed in the final template.
Maybe there should be a hint in the examples on what ---
does...
Not a bug here
Overview of the Issue
When using Packer to create a vmware template for Ubuntu 22.04 i ran into issues with cloud-init when deploying from that template.
This is my
boot_command
for packerWhen deploying from the created template, cloud-init reads the kernel parameters and sets the datasource to
nocloud-net
ignoring VMware guest extra_config userdata/metadata.This seems to happen with 22.04.02 and later... somehow 22.04.1 even when updated still works with this present.
As these parameters are not really useful after creating the template with packer, i was wondering how and why these end up as the default in the resulting template ? And most examples i could find, do not address this... only a few use
sed
to correct the grub config in a cleanup script at the end of the packer build.Reproduction Steps
Create a packer vmware template using the ubuntu 22.04.x isos
Packer version
From
packer version
1.10Simplified Packer Template
Operating system and Environment details
Ubuntu 22.04 WSL
Log Fragments and crash.log files
Include appropriate log fragments. If the log is longer than a few dozen lines, please include the URL to the gist of the log or use the Github detailed format instead of posting it directly in the issue.
Set the env var
PACKER_LOG=1
for maximum log detail.