Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using ks.cfg with virt-install?

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?

like image 709
user4985 Avatar asked Oct 14 '25 03:10

user4985


1 Answers

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

like image 65
ohamada Avatar answered Oct 18 '25 02:10

ohamada



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!