4

I'm currently trying to set up a VM the issue I'm having referencing this question when I try and start this vm it doesn't work with the 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 doesn't work. When I try and turn on the VM it stays stuck on Booting from ROM

nadermx
  • 2,596
  • 7
  • 31
  • 66
  • 1
    `kernel` not `kernal` – match Feb 27 '18 at 15:55
  • Now with the "i": `` –  Feb 27 '18 at 16:02
  • fixed the typo, but still errores out – nadermx Feb 27 '18 at 16:09
  • Now you opened the tag with the "e", next step: close the tag also with the "e" –  Feb 27 '18 at 16:12
  • I had done that already didn't update the question, but it's done now – nadermx Feb 27 '18 at 16:14
  • This is not a programming question but one about setup of KVM. Just because you wrap your XML into some alibi lines of Python doesn't make it on-topic. – Ulrich Eckhardt Mar 12 '18 at 19:24
  • @UlrichEckhardt I disagree as in those `alibi lines` there is quite a bit of important information regarding libvirt which is a python library https://stackoverflow.com/a/48995407/4180276 – nadermx Mar 12 '18 at 19:35
  • The alibi lines I meant are the lines that surround the important information, namely the `xmlDesc = ` and the `dom = ...`. In between is configuration, which is used by libvirt to boot a KVM instance. Since KVM starts successfully, I'd say that part works. If whatever you run inside the VM doesn't work and that is controlled by the configuration which is passed through, it's a configuration issue and it doesn't seem to have any relation to programming, in particular not to Python. – Ulrich Eckhardt Mar 12 '18 at 20:15

1 Answers1

2

The element is intended to contain a Linux compressed kernel image. You have provided the path to an ISO image, so this is never going to work.

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

DanielB
  • 2,461
  • 1
  • 10
  • 13