0

When using virt-install to create a guest, CentOS 7.9 cloud image successfully gets an IP address, which can be checked with sudo virsh domifaddr <domain>. However, Ubuntu 20.04 LTS cloud image cannot, it just won't be assigned an IP address, no matter what I do. It successfully boots, and I can see the login prompt using sudo virsh console <domain>, but I can't ssh into it, since no IP is being assigned. I'm using virt-manager's default network. sudo iptables -S shows rules accepting in-going and on-going traffic for the DHCP ports on the host.

Any help is greatly appreciated.

os_user
  • 3
  • 2
  • So that others can try to reproduce the problem, exactly which Ubuntu cloud image did you use? – Michael Hampton Jun 04 '21 at 11:00
  • I tried with both https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img and https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64-disk-kvm.img. – os_user Jun 04 '21 at 14:11
  • I think that KVM image is broken. I can see on its serial console that it claims to have started the network, but it doesn't even attempt to do DHCP. It also fails to start sshd for reasons I don't know yet. And the QEMU guest agent isn't running. If I were an Ubuntu user I'd report these issues on Launchpad. – Michael Hampton Jun 04 '21 at 16:12
  • I would gladly do so. Could you please tell me how you confirmed that the mentioned services are not working (DHCP, sshd and QEMU guest agent)? Since there's no networking. – os_user Jun 05 '21 at 02:49
  • As I said, I looked at the serial console. – Michael Hampton Jun 05 '21 at 11:25

2 Answers2

1

Not only virt-resize but also virt-customize and virt-sysprep, apparently. It seems there is a better compatibility of virt-* with RHEL family (centos, fedora, rhel) - RedHat being the company owning KVM, that might be understable - When using Ubuntu, better stick with cloud-init. after setting up stuff with cloud-init, you can still use libvirt suite to manage the VM.

OpenBSD ssh server may fail to start if you used virt-* for the customization of an ubuntu cloud image because tehre is a missing host ssh key. You can fix that by running ssh-keygen -A within the guest OS (either through virt-customize or cloud-init)

0

Apparently using the virt-resize utility breaks Ubuntu cloud images somehow and it fails to start the DHCP service (needs confirmation). I stopped using virt-resize and started using only qemu-img create instead and providing the size parameter, and now DHCP works as expected and the virtual machine is assigned an IP address.

os_user
  • 3
  • 2