Hi, How can I pass the ks argument to a guest during install? I am writing an auto install python script,I can use virt-install --location install_tree --extra-args ks=...., but this will active the network, we want to mirror a true DVD install. If use virt-install --cdrom will solve this issue, we have a bad way to pass ks argument,uncompress the ISO,update the syslinux kernel args,then build the ISO again,but this will consume big resource,not a good way. Does someone have good suggestion for me to pass ks arg to kernel while using virt-install --cdrom in python script?
Thanks Liam
On Thu, Feb 04, 2010 at 10:45:37AM +0800, Li Ming wrote:
Hi, How can I pass the ks argument to a guest during install? I am writing an auto install python script,I can use virt-install --location install_tree --extra-args ks=...., but this will active the network, we want to mirror a true DVD install. If use virt-install --cdrom will solve this issue, we have a bad way to pass ks argument,uncompress the ISO,update the syslinux kernel args,then build the ISO again,but this will consume big resource,not a good way. Does someone have good suggestion for me to pass ks arg to kernel while using virt-install --cdrom in python script?
It is only posible to pass kernel boot args when booting off kernel/initrd direction (ie --location). With --cdrom the BIOS is in charge. So if you need to pass args, then you'll have to modify your ISO image to include them directly.
Daniel
On Thu, 2010-02-04 at 10:38 +0000, Daniel P. Berrange wrote:
On Thu, Feb 04, 2010 at 10:45:37AM +0800, Li Ming wrote:
Hi, How can I pass the ks argument to a guest during install? I am writing an auto install python script,I can use virt-install --location install_tree --extra-args ks=...., but this will active the network, we want to mirror a true DVD install. If use virt-install --cdrom will solve this issue, we have a bad way to pass ks argument,uncompress the ISO,update the syslinux kernel args,then build the ISO again,but this will consume big resource,not a good way. Does someone have good suggestion for me to pass ks arg to kernel while using virt-install --cdrom in python script?
It is only posible to pass kernel boot args when booting off kernel/initrd direction (ie --location). With --cdrom the BIOS is in charge. So if you need to pass args, then you'll have to modify your ISO image to include them directly.
We can certainly try modifying the ISO image itself, but we'd prefer leaving the ISO image pristine if possible.
Does the KVM autotest suite have any workarounds or example methods for modifying the boot args when booting an ISO image? Perhaps running virt-viewer and _somehow_ issuing keyboard events to adjust the boot args appropriately? Or, can an ISO be mounted as a disk in the guest and modified somehow using libguestfs?
Thanks, James
On 02/04/2010 03:51 PM, James Laska wrote:
On Thu, 2010-02-04 at 10:38 +0000, Daniel P. Berrange wrote:
On Thu, Feb 04, 2010 at 10:45:37AM +0800, Li Ming wrote:
Hi, How can I pass the ks argument to a guest during install? I am writing an auto install python script,I can use virt-install --location install_tree --extra-args ks=...., but this will active the network, we want to mirror a true DVD install. If use virt-install --cdrom will solve this issue, we have a bad way to pass ks argument,uncompress the ISO,update the syslinux kernel args,then build the ISO again,but this will consume big resource,not a good way. Does someone have good suggestion for me to pass ks arg to kernel while using virt-install --cdrom in python script?
It is only posible to pass kernel boot args when booting off kernel/initrd direction (ie --location). With --cdrom the BIOS is in charge. So if you need to pass args, then you'll have to modify your ISO image to include them directly.
We can certainly try modifying the ISO image itself, but we'd prefer leaving the ISO image pristine if possible.
Does the KVM autotest suite have any workarounds or example methods for modifying the boot args when booting an ISO image? Perhaps running
KVM autotest uses qemu directly and there is no issue there, -cdrom do tell the bios where to boot from but -kernel still has the right effect.
virt-viewer and _somehow_ issuing keyboard events to adjust the boot args appropriately? Or, can an ISO be mounted as a disk in the guest and modified somehow using libguestfs?
Thanks, James
virt mailing list virt@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/virt
On 02/08/2010 01:03 PM, Dor Laor wrote:
On 02/04/2010 03:51 PM, James Laska wrote:
On Thu, 2010-02-04 at 10:38 +0000, Daniel P. Berrange wrote:
On Thu, Feb 04, 2010 at 10:45:37AM +0800, Li Ming wrote:
Hi, How can I pass the ks argument to a guest during install? I am writing an auto install python script,I can use virt-install --location install_tree --extra-args ks=...., but this will active the network, we want to mirror a true DVD install. If use virt-install --cdrom will solve this issue, we have a bad way to pass ks argument,uncompress the ISO,update the syslinux kernel args,then build the ISO again,but this will consume big resource,not a good way. Does someone have good suggestion for me to pass ks arg to kernel while using virt-install --cdrom in python script?
It is only posible to pass kernel boot args when booting off kernel/initrd direction (ie --location). With --cdrom the BIOS is in charge. So if you need to pass args, then you'll have to modify your ISO image to include them directly.
We can certainly try modifying the ISO image itself, but we'd prefer leaving the ISO image pristine if possible.
Does the KVM autotest suite have any workarounds or example methods for modifying the boot args when booting an ISO image? Perhaps running
KVM autotest uses qemu directly and there is no issue there, -cdrom do tell the bios where to boot from but -kernel still has the right effect.
Here is Lucas's answer (CCed) about how it works with kvm autotest, note that it's different and the ks parameters go through pxe config:
" Here is how autotest works to perform CD based unattended installs:
Linux guests/kickstart: * qemu boots over the network in usermode, using the pxelinux boot loader, which is served on qemu builtin tftp server.
There is a preparation script, called unattended.py, that picks vmlinux and initrd.img from the CD and puts them under the tftp server directory, also writing a pxe boot entry config
pxe_config = open(pxe_config_path, 'w') pxe_config.write('DEFAULT pxeboot\n') pxe_config.write('TIMEOUT 20\n') pxe_config.write('PROMPT 0\n') pxe_config.write('LABEL pxeboot\n') pxe_config.write(' KERNEL vmlinuz\n') pxe_config.write(' KERNEL vmlinuz\n') pxe_config.write(' APPEND initrd=initrd.img %s\n' % self.kernel_args)
The pxelinux boot entry informs kernel params, in those params we inform that a kickstart is going to be used, and that kickstart resides on the floppy:
02/07 22:49:50 DEBUG| utils:0105| [stdout] kernel_args: ks=floppy nicdelay=60
Command line looks like:
/usr/local/autotest/tests/kvm/qemu -name 'vm1' -monitor unix:/tmp/monitor-20100207-221920-Q1pS,server,nowait -drive file=/tmp/kvm_autotest_root/images/rhel5-64.qcow2,if=ide -net nic,vlan=0,model=rtl8139,macaddr=52:54:00:12:36:40 -net user,vlan=0 -m 1024 -smp 2 -drive file=/tmp/kvm_autotest_root/isos/linux/RHEL-5.4-x86_64-DVD.iso,index=2,media=cdrom -fda /usr/local/autotest/tests/kvm/images/floppy.img -tftp /usr/local/autotest/tests/kvm/images/tftpboot -boot d -bootp /pxelinux.0 -boot n -redir tcp:5000::22 -vnc :0
The kickstart in its turn specifies the cdrom as the source for the installation.
So yes, in this case, both floppy and cdrom parameters are just providing a IDE cdrom and a floppy, the vm is not booting from there, but rather from the network.
Windows guests/answer files: * qemu boots over the cd, and windows cds will look for floppies during the boot process, if they find floppies then they will look for an answer file, if they find it, they proceed with automated installation.
Bottom line, we used a slightly convoluted system to specify a kickstart in the floppy, mostly because I wanted to keep the same mechanism (unattended file in the floppy for both windows and linux).
So this could be a suggestion for the guy wanting to specify the kernel arguments.
Let me know if that explanation was good enough and if you want me to lend a hand on this,
Lucas "
virt-viewer and _somehow_ issuing keyboard events to adjust the boot args appropriately? Or, can an ISO be mounted as a disk in the guest and modified somehow using libguestfs?
Thanks, James
virt mailing list virt@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/virt
virt mailing list virt@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/virt
On 02/08/2010 08:29 PM, Dor Laor wrote:
On 02/08/2010 01:03 PM, Dor Laor wrote:
On 02/04/2010 03:51 PM, James Laska wrote:
On Thu, 2010-02-04 at 10:38 +0000, Daniel P. Berrange wrote:
On Thu, Feb 04, 2010 at 10:45:37AM +0800, Li Ming wrote:
Hi, How can I pass the ks argument to a guest during install? I am writing an auto install python script,I can use virt-install --location install_tree --extra-args ks=...., but this will active the network, we want to mirror a true DVD install. If use virt-install --cdrom will solve this issue, we have a bad way to pass ks argument,uncompress the ISO,update the syslinux kernel args,then build the ISO again,but this will consume big resource,not a good way. Does someone have good suggestion for me to pass ks arg to kernel while using virt-install --cdrom in python script?
It is only posible to pass kernel boot args when booting off kernel/initrd direction (ie --location). With --cdrom the BIOS is in charge. So if you need to pass args, then you'll have to modify your ISO image to include them directly.
We can certainly try modifying the ISO image itself, but we'd prefer leaving the ISO image pristine if possible.
Does the KVM autotest suite have any workarounds or example methods for modifying the boot args when booting an ISO image? Perhaps running
KVM autotest uses qemu directly and there is no issue there, -cdrom do tell the bios where to boot from but -kernel still has the right effect.
Here is Lucas's answer (CCed) about how it works with kvm autotest, note that it's different and the ks parameters go through pxe config:
" Here is how autotest works to perform CD based unattended installs:
Linux guests/kickstart:
- qemu boots over the network in usermode, using the pxelinux boot
loader, which is served on qemu builtin tftp server.
There is a preparation script, called unattended.py, that picks vmlinux and initrd.img from the CD and puts them under the tftp server directory, also writing a pxe boot entry config
pxe_config = open(pxe_config_path, 'w') pxe_config.write('DEFAULT pxeboot\n') pxe_config.write('TIMEOUT 20\n') pxe_config.write('PROMPT 0\n') pxe_config.write('LABEL pxeboot\n') pxe_config.write(' KERNEL vmlinuz\n') pxe_config.write(' KERNEL vmlinuz\n') pxe_config.write(' APPEND initrd=initrd.img %s\n' % self.kernel_args)
The pxelinux boot entry informs kernel params, in those params we inform that a kickstart is going to be used, and that kickstart resides on the floppy:
02/07 22:49:50 DEBUG| utils:0105| [stdout] kernel_args: ks=floppy nicdelay=60
Command line looks like:
/usr/local/autotest/tests/kvm/qemu -name 'vm1' -monitor unix:/tmp/monitor-20100207-221920-Q1pS,server,nowait -drive file=/tmp/kvm_autotest_root/images/rhel5-64.qcow2,if=ide -net nic,vlan=0,model=rtl8139,macaddr=52:54:00:12:36:40 -net user,vlan=0 -m 1024 -smp 2 -drive file=/tmp/kvm_autotest_root/isos/linux/RHEL-5.4-x86_64-DVD.iso,index=2,media=cdrom -fda /usr/local/autotest/tests/kvm/images/floppy.img -tftp /usr/local/autotest/tests/kvm/images/tftpboot -boot d -bootp /pxelinux.0 -boot n -redir tcp:5000::22 -vnc :0
The kickstart in its turn specifies the cdrom as the source for the installation.
So yes, in this case, both floppy and cdrom parameters are just providing a IDE cdrom and a floppy, the vm is not booting from there, but rather from the network.
Windows guests/answer files:
- qemu boots over the cd, and windows cds will look for floppies during
the boot process, if they find floppies then they will look for an answer file, if they find it, they proceed with automated installation.
Bottom line, we used a slightly convoluted system to specify a kickstart in the floppy, mostly because I wanted to keep the same mechanism (unattended file in the floppy for both windows and linux).
So this could be a suggestion for the guy wanting to specify the kernel arguments.
Let me know if that explanation was good enough and if you want me to lend a hand on this,
Lucas "
virt-viewer and _somehow_ issuing keyboard events to adjust the boot args appropriately? Or, can an ISO be mounted as a disk in the guest and modified somehow using libguestfs?
Thanks, James
I tested,this method works.The network was not activated,because the pxe install can help download boot file and start system,this is before the system can active network.But this method needs to setup a tftp server,and copy the pxelinux.0 to tftp server root directory,if the tester did not install tftp server or syslinux, the install will fail, this will demand that the host and the guest VM are the same system? because pxelinux.0 is located in host system. The vmlinuz and initrd.img also have to be copied from iso to tftp directory and the default config file need to be created. I will compare these methods and choose the best one. Lucas,thanks for your help!!
Liam
On Tue, 2010-02-09 at 18:26 +0800, Li Ming wrote:
I tested,this method works.The network was not activated,because the pxe install can help download boot file and start system,this is before the system can active network.But this method needs to setup a tftp server,and copy the pxelinux.0 to tftp server root directory,if the tester did not install tftp server or syslinux, the install will fail,
Just a little correction, you don't need to install a tftp server, qemu has a built in tftp server, that you pass with option -tftp (this way you can just specify a directory and say 'here qemu, pick this dir and make it the tftproot), so you just really need syslinux to be installed.
this will demand that the host and the guest VM are the same system?
Yes, unfortunately. This happens by design of the kvm test.
You can allways look for alternate solutions, such as having a cobbler server on your laboratory and make your vms managed by cobbler. We thought about it at some point, but the simplicity of using syslinux + the builtin qemu tftp server won.
because pxelinux.0 is located in host system. The vmlinuz and initrd.img also have to be copied from iso to tftp directory and the default config file need to be created. I will compare these methods and choose the best one. Lucas,thanks for your help!!
You are welcome, I am allways available to help on freenode, OFTC or internal irc channels (lmr or some variations of it).
Lucas
On Thu, Feb 04, 2010 at 10:45:37AM +0800, Li Ming wrote:
Hi, How can I pass the ks argument to a guest during install? I am writing an auto install python script,I can use virt-install --location install_tree --extra-args ks=...., but this will active the network, we want to mirror a true DVD install. If use virt-install --cdrom will solve this issue, we have a bad way to pass ks argument,uncompress the ISO,update the syslinux kernel args,then build the ISO again,but this will consume big resource,not a good way. Does someone have good suggestion for me to pass ks arg to kernel while using virt-install --cdrom in python script?
Sorry for the latest reply. Here is another possibility:
http://rwmj.wordpress.com/2010/02/01/libguestfs-python-example/#content
Rich.
On Thu, 2010-02-25 at 11:57 +0000, Richard W.M. Jones wrote:
On Thu, Feb 04, 2010 at 10:45:37AM +0800, Li Ming wrote:
Hi, How can I pass the ks argument to a guest during install? I am writing an auto install python script,I can use virt-install --location install_tree --extra-args ks=...., but this will active the network, we want to mirror a true DVD install. If use virt-install --cdrom will solve this issue, we have a bad way to pass ks argument,uncompress the ISO,update the syslinux kernel args,then build the ISO again,but this will consume big resource,not a good way. Does someone have good suggestion for me to pass ks arg to kernel while using virt-install --cdrom in python script?
Sorry for the latest reply. Here is another possibility:
http://rwmj.wordpress.com/2010/02/01/libguestfs-python-example/#content
Thanks Richard! I believe Liam is using your libguestfs suggestion to make the kickstart file available to the network-less DVD/CD installing system. It works rather nicely, thanks for the tip!
The next roadblock was booting the DVD/CD install while providing the proper boot arguments ("ks=hd:vda:/ks.cfg"). An aside, I wonder if it makes sense to request that anaconda automatically use a kickstart if /ks.cfg exists. Until then, we are using dogtail to start virt-viewer, and provide the correct boot arguments to the installer.
Thanks, James