Using kickstart files with the qm create command?

FreePenCollector

New Member
Jul 9, 2013
10
0
1
Canada
Hello experts,

So after consulting the manual and google, I've found that I should be able to create a new vm, using a kickstart file, using the qm create [...] --args command. Unfortunately I'm having trouble getting this to work correctly.

I'm currently trying:

Code:
qm create 143 --name testKS1 --net0 e1000 --bootdisk ide0 --ostype l26 -ide0 lvmGroup1:4 format=raw --onboot no --sockets 1 --args -append ks=url/path/to/file.ks
Which fails as such:

Code:
400 wrong number of arguments

So how should I be formatting my command to successfully pass along a ks file to the installation? Is there an alternative, perhaps better, way to accomplish this?

There is a ton of information on how to accomplish what I want with virt-install, but I understand virt is not compatible with proxmox. Also I wish to use kickstart files for vm creation in this way such that I can recycle some scripts I had previously used on my xen machine.

(The best source of info I have found, and what I've based my current method on can be found here: http://stackoverflow.com/questions/...t-parameters-when-creating-vms-on-proxmox-2-x)
 
Code:
qm create 143 --name testKS1 --net0 e1000 --bootdisk ide0 --ostype l26 -ide0 lvmGroup1:4,format=raw --onboot no --sockets 1 --args '-append ks=url/path/to/file.ks'
 
Thank you dietmar!

This has allowed me to create the vm, having it show up in proxmox, but upon trying to start the vm I get the following error:

Code:
-append only allowed with -kernel option

TASK ERROR: start failed: command '/usr/bin/kvm -id 143 -chardev 'socket,id=qmp,path=/var/run/qemu-server/143.qmp,server,nowait' -mon 'chardev=qmp,mode=control' -vnc unix:/var/run/qemu-server/143.vnc,x509,password -pidfile /var/run/qemu-server/143.pid -daemonize -name testKS1 -smp 'sockets=1,cores=1' -nodefaults -boot 'menu=on' -vga cirrus -k en-us -m 512 -cpuunits 1000 -append 'ks=url/path/to/file.ks' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device  'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -drive 'file=/dev/VolGrp/vm-143-disk-1,if=none,id=drive-ide0,aio=native,cache=none' -device 'ide-hd,bus=ide.0,unit=0,drive=drive-ide0,id=ide0,bootindex=100' -netdev 'type=user,id=net0,hostname=testKS1' -device 'e1000,mac=4E:4B:8C:17:62:CE,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300'' failed: exit code 1

So obviously I need to include the -kernel option before the -append option. Looking at the man pages:

Code:
Linux/Multiboot boot specific:

       When using these options, you can use a given Linux or Multiboot kernel
       without installing it in the disk image. It can be useful for easier
       testing of various kernels.


       -kernel bzImage
           Use bzImage as kernel image. The kernel can be either a Linux
           kernel or in multiboot format.


       -append cmdline
           Use cmdline as kernel command line

I'm guessing the kernel I need to specify is the one proxmox is using when I specify "-ostype l26"? Where do I find that?
 
Guys any indication of how this would work? I am trying this:

qm create 102 --name test-kvm-002 --net0 e1000=EA:4C:59:A0:F8:C5,bridge=vmbr0 --bootdisk ide0 --ostype l26 -ide0 local:32,format=qcow2 --onboot no --memory 2048 --sockets 1 --args '-kernel bzImage -append ks=http://192.168.1.62/cblr/svc/op/ks/system/test-kvm-002'

and it creates a KVM vm:

root@wv-proxmox:~# vi /etc/pve/nodes/wv-proxmox/qemu-server/102.conf

args: -kernel bzImage -append ks=http://192.168.1.62/cblr/svc/op/ks/system/test-kvm-002
bootdisk: ide0
ide0: local:102/vm-102-disk-1.qcow2,size=32G
memory: 2048
name: test-kvm-002
net0: e1000=EA:4C:59:A0:F8:C5,bridge=vmbr0
onboot: 0
ostype: l26
sockets: 1

But I can not power it on. please any help would be great
 
I've ran into exactly the same issue.
Attempting to use a kickstart script to setup a newly created VM.

Were you able to find a work around?
 
I use netboot to kickstart and preseed my debian machines. This works perfectly for more than 5 years now.

Boot parameters can be defined on a per mac basis with a decent dhcp server.
 
I use netboot to kickstart and preseed my debian machines. This works perfectly for more than 5 years now.

Boot parameters can be defined on a per mac basis with a decent dhcp server.

So is it like PXE?
Problem is when you are on a larger network and do not control the DHCP service.
 
Yes, it's PXE and yes not controlling the DHCP-Server is a problem indeed.

I also remaster my install-DVDs to include the preseed and kickstart stuff for automatic offline installation. Maybe this is the way to go in your setup. It's very similar to PXE (isolinux vs. pxelinux) but you need to remaster an installation medium.
 
Yes, it's PXE and yes not controlling the DHCP-Server is a problem indeed.

I also remaster my install-DVDs to include the preseed and kickstart stuff for automatic offline installation. Maybe this is the way to go in your setup. It's very similar to PXE (isolinux vs. pxelinux) but you need to remaster an installation medium.

I have no control over network/dhcp.

So that's exactly what I've been doing. Making install DVD images with custom kickstart files.
I now have about 15-17 different ones (server vs client, 6.x vs 7.1, etc).
Images take too much space (15+ at 4 GBytes each). Take relatively too long to change given a minor change (typo, missing requirement, etc).

Been looking for a better way.
 
Last edited:
You can also build a small boot cd with only your kickstart files and then install everything from network or from second original boot cd. This should not a big impact on your storage and keeps things simple.

You can also make a dynamic kickstart creator script on your sever to serve a dynamic generated kickstart file based on the incoming IP or MAC. In such a setup you can emulate a kind of network boot by using local media and loading further files from network.

Maybe there is also a way to use (sys|iso|pxe)linux directly via -kernel and -append to load your configuration file. I tried some googling but nothing came up so far.
 
You can also build a small boot cd with only your kickstart files and then install everything from network or from second original boot cd. This should not a big impact on your storage and keeps things simple.

You can also make a dynamic kickstart creator script on your sever to serve a dynamic generated kickstart file based on the incoming IP or MAC. In such a setup you can emulate a kind of network boot by using local media and loading further files from network.

Maybe there is also a way to use (sys|iso|pxe)linux directly via -kernel and -append to load your configuration file. I tried some googling but nothing came up so far.

Can you elaborate with more details. Like craft a bootable image with grub-entries for loading different kickstart files available?
Wouldn't having a boot image still require rebuilds of said image whenever any included kickstart files change?
And wouldn't boot image have to be different for each major version (e.g. centos 6 vs 7, etc)?

So it saves the store space (which is a concern), but still requires rebuilding boot image(s). Hmmmm.

I would rather rely on something that already exists. Cobbling my own leads to maintenance problems as thing move forward.

As far -kernel and -append param go.
That's what this thread is about. It doesn't work. You can't append without also specifying kernel. But right kernel must be accessible during VM boot.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!