How do I boot Ubuntu Cloud images in vmware?
This answer is based on the NoCloud README from CloudInit and gives you cloud-init on VMWare player.
Create the file "meta-data", using "localhost" as a guaranteed-to-resolve hostname to avoid DNS timeouts that make sudo take ages in a local hypervisor environment:
local-hostname: localhost
Create the file "user-data" file for CloudInit info. This one sets password to ubuntu, and asks me to change it on first login:
#cloud-config
password: ubuntu
Generate seed.iso from these files:
genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
Attach "seed.iso" to the VM before first boot (set it to connect on start), and when grub appears, also add this kernel parameter for the first boot:
ds=nocloud-net
The machine will boot and configure itself. For future boots, we need to edit edit /etc/default/grub
and run sudo update-grub
to tell it we are not in EC2 (no cloud metadata service):
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0 ds=nocloud"
Related videos on Youtube
KB.
Updated on September 18, 2022Comments
-
KB. over 1 year
I want to run an Ubuntu cloud image on on VMWare.
I just need to know how to set the OVF properties in a way that VMWare understands in order to pass parameters to cloud-init.
What I've done
Install VMWare Player 4.0.4, using the vmware workstation 8.0.2 / player 4.0.2 fix for linux 3.2+ patch to get around the compilation failure for virtual ethernet module.
Download precise-server-cloudimg-amd64.ovf, and also the precise-server-cloudimg-amd64.img file (compressed QCOW2 format, 220MB)
Convert the image from QCOW2 to VMDK:
qemu-img convert -O vmdk precise-server-cloudimg-amd64-disk1.img disk.vmdk
Edit the OVF
<File>
element to change the ovf:href and ovf:size to match the output of qemu-img:<File ovf:href="disk.vmdk" ovf:id="file1" ovf:size="689569792"/>
Edit the
<Disk>
element to set sparse VMDK format and desired capacity in bytes (8GB here):<Disk ovf:capacity="8589934592" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#sparse"/>
Remove all the
<Property>
elements because vmplayer does not recognise them.Configure the VirtualHardwareSection section to set CPU and RAM to taste.
Either run the OVF in vmplayer, or convert to vmx and run the vmx:
ovftools custom.ovf mymachine.vmx vmplayer mymachine.vmx
Unfortunately I can't log in as "ubuntu" at the prompt because the OVF properties haven't been provided to cloud-init. How should I do this?
-
Admin almost 12 yearsHave you tried downloading the "boot floppy .iso" (2Mb) and mount that as the CDROM? This will give you a grub prompt that allows you to also edit the command line. I've successfully made cloud images boot on VirtualBox using this technique.
-
Admin almost 12 yearsNo, but I think I'm going to try putting the "OVF Environment" XML file in an ISO that's mounted during first boot.
-
-
KB. almost 12 yearsNot keen on using extlinux, or modifying the image prior to boot. The cloud image comes compressed in qcow2 format, which you can't mount directly.
-
RandyMartini almost 6 yearsDoes adding ds=nocloud-net;s=10.10.0.1:8000 set it to pull the info from the url?
-
alchemy over 2 yearsHmm, this is progress for trying to use the new Ova format. Have you had success with that? Do you get a Grub menu after using qemu-img? I have to use Direct Boot options in Virt-manager to point to the kernel files but with similar boot parameters. Here's my notes on that if your interested: askubuntu.com/a/1376185/795299