@bladnor : I saw your reply here and I was very happy with your clear explanation. Can you please help me too. Here are the details.
Packer Version: 1.7.4
vSphere Client version: 6.7.0.48000
Ubuntu version: 20.04.3
Builder Type: vsphere-iso
Here is my builder.
"builders": [
{
"type": "vsphere-iso",
"vcenter_server": "my-vCenter-Server",
"username": "myUser@vsphere.local",
"password": "vSphereUserPwd",
"insecure_connection": "true",
"datacenter": "my-DataCenter",
"cluster": "myCluster",
"datastore": "datastore1",
"guest_os_type": "ubuntu64Guest",
"host": "my-host-name",
"CPUs": 2,
"RAM": 2048,
"RAM_reserve_all": true,
"firmware": "bios",
"disk_controller_type": "pvscsi",
"storage": [{
"disk_size": 20480,
"disk_thin_provisioned":true
}],
"network_adapters": [{
"network": "myVLAN",
"network_card": "vmxnet3"
}],
"name": "Ubuntu-20.04",
"vm_name": "ubuntu-server",
"folder": "MY-FOLDER",
"notes": "Built via Packer",
"convert_to_template": true,
"ssh_username": "myUser",
"ssh_password": "myPwd",
"ssh_timeout": "20m",
"ssh_handshake_attempts": "100000",
"iso_paths": ["[datastore1] ISO/ubuntu-20.04.3-live-server-amd64.iso"],
"iso_checksum": "sha256:f8e3086f3cea0fb3fefb29937ab5ed9d19e767079633960ccb50e76153effc98",
"http_directory": "{{template_dir}}/http",
"cd_files": ["{{template_dir}}/http/user-data", "{{template_dir}}/http/meta-data"],
"cd_label": "cidata",
"create_snapshot": "false",
"boot_wait": "2s",
"boot_command": [
"<esc><esc><esc>",
"<enter><wait>",
"/casper/vmlinuz ",
"root=/dev/sr0 ",
"initrd=/casper/initrd ",
"autoinstall ",
"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/",
"<enter>"
],
"shutdown_command": "echo 'ubuntu'|sudo -S shutdown -P now"
}
]
user-data content is as below
#cloud-config
autoinstall:
version: 1
apt:
geoip: true
preserve_sources_list: false
primary:
- arches: [amd64, i386]
uri: http://gb.archive.ubuntu.com/ubuntu
- arches: [default]
uri: http://ports.ubuntu.com/ubuntu-ports
identity:
hostname: ubuntu-server
username: ubuntu
password: encrypted-password
ssh:
allow-pw: true
install-server: true
locale: en_US
keyboard:
layout: gb
storage:
layout:
name: direct
config:
- type: disk
id: disk0
match:
size: largest
- type: partition
id: boot-partition
device: disk0
size: 500M
- type: partition
id: root-partition
device: disk0
size: -1
late-commands:
- "echo 'Defaults:ubuntu !requiretty' > /target/etc/sudoers.d/ubuntu"
- "echo 'ubuntu ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/ubuntu"
- "chmod 440 /target/etc/sudoers.d/ubuntu"
I have tried so many combinations for boot command, user-data and so on. But I always encounter the following error.
command [‘systemd-cat’, ‘–level-prefix=false’, ‘–identifier=subiquity_log.2014’, ‘.snap/subiquity/2651/usr/bin/python3’, ‘-m’, ‘curtin’, ‘–showtrace’, ‘-c’, ‘/var/log/installer/subiquity-curtin-install.conf’, ‘install’] returned non-zero exit status 3
Can you please help? I am running packer build from another ubuntu 20.04.3 server