Install Ubuntu 16.04 with libvirt and kickstart

I am currently trying to configure a virtual machine for a problem that I am referring to this question , when I try to start this vm, it does not work from kickstart

def makeKvm(name, conn):
    xmldesc = """
    <domain type="kvm">
    <name>""" + name + """</name>
    <memory unit='GB'>1</memory>
    <vcpu>1</vcpu>
    <os>
      <type arch='x86_64' machine='pc'>hvm</type>
      <kernel>/var/lib/libvirt/media/./casper/vmlinuz.efi</kernel>
      <initrd>/var/lib/libvirt/media/./casper/initrd.lz</initrd>
      <cmdline>console=ttyS0 ks=https://pastebin.com/raw/6TznVUuN</cmdline>
    </os>
    <iothreads>1</iothreads>
    <on_poweroff>destroy</on_poweroff>
    <on_reboot>restart</on_reboot>
    <on_crash>preserve</on_crash>
    <devices>
        <emulator>/usr/bin/qemu-system-x86_64</emulator>
        <disk type='file' device='disk'>
          <driver name='qemu' type='raw'/>
          <source file='/var/lib/libvirt/pool/""" + name + """.img'/>
          <target dev='vda' bus='virtio'/>
        </disk>
        <disk type='file' device='cdrom'>
          <driver name='qemu' type='raw'/>
          <source file='/var/lib/libvirt/iso/ubuntu-16.04.3-desktop-amd64.iso'/>
          <target dev='hdb' bus='virtio'/>
        <readonly/>
        </disk>
        <interface type='bridge'>
          <source bridge='br0'/>
          <model type='virtio'/>
        </interface>
        <input type='mouse' bus='ps2'/>
        <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='en-us'/>
      </devices>
    </domain>
    """
    dom = conn.defineXML(xmldesc)
    return dom

This does not work. When I try to turn on the VM, it stays onBooting from ROM

+4
source share
1 answer

The element is intended to host a compressed Linux kernel image. You have provided a path to the ISO image, so it will never work.

If you want to install an ISO image, then configure a virtual CDROM that points to the ISO image, not the kernel elements / initrd.

+2
source

Source: https://habr.com/ru/post/1694189/


All Articles