1

I need to pass kickstart file to xml for creating a virtual device using virt-install.

<os>
    <type arch="x86_64" machine="pc-i440fx-xenial">hvm</type>
    <loader>/usr/lib/xen/boot/hvmloader</loader>
    <kernal>/boot/vmlinuz-3.10.0-327.el7.x86_64</kernal>
    <initrd>/boot/initrd.img-4.4.0-59-generic</initrd>
    <cmdline>ks=http://ipaddr/try.cfg ip=ip netmask=255.255.255.0</cmdline>
    <bootmenu enable="yes" />
</os>

Is this the right way? I followed the steps given in this tutorial. But I get the following error:

File "/usr/lib64/python2.7/site-packages/libvirt.py", line 1029, in create

if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self) libvirt.libvirtError: unable to stat:

/boot/vmlinuz-3.10.0-327.el7.x86_64: No such file or directory

supraja
  • 13
  • 4

1 Answers1

1

The overall syntax you've used is correct, but you've got some mistakes in the data you've provided. In particular you've provided a kernel image for the <initrd> option - that should be pointing to an initrd image. Also, you generally won't want to be using the kernel+initrd from your host OS /boot directory at all. Rather you'd want to get the kernel+initrd for the OS installer. If you were trying to install Fedora in your guest, you'd grab the files from

http://dl.fedoraproject.org/pub/fedora/linux/releases/25/Server/x86_64/os/images/pxeboot/

and put them in /var/lib/libvirt/images/ and point your XML to those.

DanielB
  • 2,461
  • 1
  • 10
  • 13
  • Thanks @DanielB yes sir that was typo error. I have now edited. But I'm not very clear with what data to put for elements: kernel and initrd. Details: OS- centos-7 linux. Can you explain me in detail ? Thanks. – supraja Jan 23 '17 at 07:05
  • Just download the initrd.img and vmlinuz files from the pxeboot/ directory for the OS in question and save them to /var/lib/libvirt/images. The XML just needs /var/lib/libvirt/images/{vmlinuz file name} /var/lib/libvirt/images/{initrd.img file name} – DanielB Jan 23 '17 at 11:06
  • yes sir. I got it. Thanks. And is it the only way to pass kickstart file through xml ? – supraja Jan 23 '17 at 12:25
  • Yes, using the kernel+initrd+cmdline elements is the only explicit way to do kickstart via the XML. The alternatives would be to take the boot.iso image, unpack it, add a kickstart file and then create a new ISO image from the contents. This is considerably more complex than just use kernel+initrd directly. Or setup a PXE boot server somewhere with the files – DanielB Jan 26 '17 at 11:11