2

So I'm trying to use cloud-init with minimal image ( https://cloud-images.ubuntu.com/minimal/releases/focal/release/ubuntu-20.04-minimal-cloudimg-amd64.img ) but it does not seem to work at all. The exact same procedure works with the server image ( https://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64.img ).

I'm using with meta-data and user-data with genisoimage -output cloud-init.iso -volid cidata -joliet -rock meta-data user-data.

I then boot it up with virt-install --connect qemu:///system --virt-type kvm --os-type linux --os-variant ubuntu20.04 --disk path=image.qcow2,bus=scsi,format=qcow2 --disk path=cloud-init.iso,device=cdrom --controller type=scsi,model=virtio-scsi --import --network network:default

In user-data I try to debug it with just using runcmd in user-data to touch /debug but when booting it up manually afterwards to investigate there is no such file so runcmd doesn't seem to run at all. Keep in mind that the exact same procedure works fine with the server-cloudimg.Running dpkg -l on the minimal image shows the cloud-init package being installed.

user-data

#cloud-config
runcmd:
 - touch /debug

meta-data

instance-id: iid-0
Andrew
  • 21
  • 2
  • Does `cloud-init status` mention any errors? Does `cloud-init query userdata` show the userdata you passed to it? Is there a `Traceback` or `WARN` in /var/log/cloud-init.log? – falcojr Oct 20 '21 at 03:46
  • So the problem seems to be that ubuntu minimal doesnt support cdrom so I used netboot `-smbios type=1,serial=ds=nocloud-net;s=http://10.10.0.1:8000/` instead and it works when i have a dhcp server but when I try to set it up with a static ip instead it doesnt work. I've tried passing a ip to the bootloader as described in https://askubuntu.com/questions/1360674/assign-ip-to-ubuntu-20-04-during-installation-packer-cloud-init-context but no success. – Andrew Oct 21 '21 at 02:19
  • @Andrew Have you figured it out? I believe I have the same issue on `ubuntu-22.04-minimal-cloudimg-amd64.img` – Shevchuk Jul 07 '22 at 00:02
  • Having a somewhat similar issue if anyone can help: https://askubuntu.com/questions/1428184/cannot-login-to-ubuntu-cloud-image-20-04-on-qemu-neither-console-nor-ssh – Rino Bino Sep 08 '22 at 16:06

1 Answers1

0

In case someone stumble the same problem.

Comment by Andrew is correct. however we can still boot the system for ip assignment.

  • create cidata.iso

    mkisofs -o cidata.iso -V cidata -J -r user-data meta-data

  • create vm.

    sudo virt-install
    --import
    --connect qemu:///system
    --name test
    --ram $MEM
    --vcpus $CPU
    --disk path=/kvm/test.qcow2,size=10
    --disk cidata.iso
    --os-type linux
    --os-variant ubuntu22.04
    --network bridge:virbr0,model=virtio
    --graphics none
    --noautoconsole

in case want to still try netboot. run python3 -m http.server from the folder with user-data & meta-data then append to virt-install cmd.

--sysinfo type=smbios,system_serial=ds=nocloud-net;s=http://_gateway:8000/ //for network boot.

sumanta
  • 101
  • 3