4

I've been trying to get a virtual machine working with a cfg file on centos but unfortunately, I'm getting the error that ks.cfg file does not exist.

Below is the command I ran to enable the VM.

virt-install --name FedoraTest --ram 1024 --disk pool=default,size=10 --location ~/Desktop/CentosOS --initrd-inject ks.cfg --extra-args "ks=file:~/Desktop/ks.cfg"

I am new to the VM setup and am unsure if I'm doing it right.

Any advice on how to fix this will be greatly appreciated.

Also, what does initrd-inject do? And is it possible to save the above command into a file and run the file instead?

user4985
  • 141
  • 2
  • 9

1 Answers1

9

I suppose you have switched the meaning of 'initrd-inject' and 'extra-args' parameters. The initrd-inject should contain path to the ks file in your file system, while in 'extra-args' you should specify kernel to use the injected ks file. See the snippet:

virt-install --connect=qemu:///system \
    --network=bridge:br0 \
    --initrd-inject=/export/rhel.ks \
    --extra-args="ks=file:/rhel.ks console=tty0 console=ttyS0,115200" \
    --name=$domname \
    --disk /export/vmimgs/$domname.img,size=20 \
    --ram 2048 \
    --vcpus=2 \
    --check-cpu \
    --accelerate \
    --hvm \
    --location=$location1 \
    --nographics 

The snippet comes from here

ohamada
  • 101
  • 1