In the past we used packer to build BIOS-based Ubuntu 20.04 OVF templates an cloud-init to automate the configuration. This is working without any problems for several years now.
Currently we are busy to use packer to build EFI-based Ubuntu 20.04 OVF templates, but with EFI the cloud-init doesn't configure the Virtual Machine anymore.
I can't find the problem and help is appreciated.
We are using two cloud-init stages:
- During the packer build process
The cloud init scripts are executed on both (BIOS and EFI)
- During the start of the Virtual Machine
The cloud inint scripts are executed on BIOS-based systems only
During the packed build stage and the VM-start the cloud-init scripts are located on the first CDROM drive /dev/sr0
.
After the BIOS based Virtual Machine is started:
Output of /run/cloud-init/ds-identify.log
*SNIP*
ISO9660_DEVS=/dev/sr0=cidata
*SNIP*
The /var/log/cloud-init.log
contains the string:
DataSourceNoCloud.py[DEBUG]: Using data from /dev/sr0
After the EFI based Virtual machine is started:
Output of /run/cloud-init/ds-identify.log
*SNIP*
ISO9660_DEVS=/dev/sr0=cidata
*SNIP*
So the CDROM drive is found and has the correct labels
When I attach the ISO Twice /run/cloud-init/ds-identify.log
contains /dev/sr1 aswell
The /var/log/cloud-init.log
doesn't contain any /dev/sr[x]
string
Full output of /run/cloud-init/ds-identify.log
:
[up 3.93s] ds-identify
policy loaded: mode=enabled report=false found=all maybe=all notfound=disabled
/etc/cloud/cloud.cfg.d/99-installer.cfg set datasource_list:
no datasource_list found, using default: MAAS ConfigDrive NoCloud AltCloud Azure Bigstep CloudSigma CloudStack DigitalOcean Vultr AliYun Ec2 GCE OpenNebula OpenStack OVF SmartOS Scaleway Hetzner IBMCloud Oracle Exoscale RbxCloud UpCloud VMware LXD NWCS
DMI_PRODUCT_NAME=VMware7,1
DMI_SYS_VENDOR=VMware, Inc.
DMI_PRODUCT_SERIAL=VMware-*SNIP*
DMI_PRODUCT_UUID=*SNIP*
PID_1_PRODUCT_NAME=unavailable
DMI_CHASSIS_ASSET_TAG=No Asset Tag
DMI_BOARD_NAME=440BX Desktop Reference Platform
FS_LABELS=cidata
ISO9660_DEVS=/dev/sr0=cidata
KERNEL_CMDLINE=BOOT_IMAGE=/vmlinuz-5.4.0-144-generic root=/dev/mapper/VGsystem-LVroot ro apparmor=0
VIRT=vmware
UNAME_KERNEL_NAME=Linux
UNAME_KERNEL_RELEASE=5.4.0-144-generic
UNAME_KERNEL_VERSION=#161-Ubuntu SMP Fri Feb 3 14:49:04 UTC 2023
UNAME_MACHINE=x86_64
UNAME_NODENAME=cloudsystem1.local.nl
UNAME_OPERATING_SYSTEM=GNU/Linux
DSNAME=
DSLIST=MAAS ConfigDrive NoCloud AltCloud Azure Bigstep CloudSigma CloudStack DigitalOcean Vultr AliYun Ec2 GCE OpenNebula OpenStack OVF SmartOS Scaleway Hetzner IBMCloud Oracle Exoscale RbxCloud UpCloud VMware LXD NWCS
MODE=enabled
ON_FOUND=all
ON_MAYBE=all
ON_NOTFOUND=disabled
pid=593 ppid=569
is_container=false
mode=enabled. returning 0
[up 3.99s] returning 0
What I tried:
- Reboot the system again
- Cleaned up all cloud-init caches
- cloud-init clean; cloud-init init
- created a 'simple' cloud-init script
Nothing solved the problem.
My current configuration file:
root@cloudsystem1:/# mount /dev/sr0 /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
root@cloudsystem1:/# cd /mnt
root@cloudsystem1:/mnt# ls
meta-data user-data
root@cloudsystem1:/mnt# cat meta-data
local-hostname: cloudsystem1
root@cloudsystem1:/mnt# cat user-data
#cloud-config
bootcmd:
- echo "This is een bootcmd test" >> /tmp/IwasHere
fqdn: cloudsystem1.local.nl
groups:
- staff
prefer_fqdn_over_hostname: true
runcmd:
- echo "This is een runcmd test" >> /tmp/IwasHere
users:
- create_groups: false
groups: staff
lock_passwd: true
name: docker
no_user_group: true
ssh_authorized_keys:
- |
ssh-rsa XXXXX0XxXX0XX0XXXXXXXXXXXXXXXXXXXxX/XXXXXXXXxx0XXXXXXXXxxXXXXxXXXX0XXX0XXX/XX+XX00XXXXXXXX0XXxX0XXXXXxX/xXXX0XXxXX0X0XXxXXxXXXX+XXXx00x0xxX0xX0X0XxX0XXXX00X0XxXXX0000XXXX0XXX0XXX/XXXXXXXxXXXxXXXx0X0xXXX0XxXXXX0XXXXXXXXXXXXXxXXXxX+X0Xx0X0XxXXXXX0XXXxXX0XXX0XXXXXxXXXxXx+XXXX0XXXXXX0/XXxXXXXXX0XXXXXXX0XXXXX00XX0XXXXXXXXXXXXXXXXx/XXXXXXX0XX0XXXxX0XXXXXX+XXXXXX0X0XX0XxXX+XXX
sudo: ALL=(ALL) NOPASSWD:ALL
On the BIOS Based systems, the hostname is set, the docker account is created and /tmp/IwasHere
contains the two lines.
Any idea how to solve this problem?