Friday, April 19, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 23004  / 2 Years ago, sat, january 22, 2022, 10:32:41

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?


More From » virtualization

 Answers
7

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"

[#37439] Sunday, January 23, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ntlesslving

Total Points: 123
Total Questions: 109
Total Answers: 113

Location: South Korea
Member since Fri, Sep 11, 2020
4 Years ago
;