You are not logged in.
Hi guys,
KVM/libvirt is working great for me if I create a new VM manually - i.e. boot the VM from a Linux install ISO, and use the virt-manager GUI or connect via VNC to manually click through the install.
This approach doesn't scale very well though. Using KVM/libvirt on CentOS, I've got used to being able to script entirely unattended installs via Kickstart files and the serial console interface to the VM.
On a CentOS 6 host, for example, I can do something like this:
sudo virt-install --name=myGuestVM --ram=2048 --vcpus=1 --os-variant=rhel6 --nographics \
--location http://mirrors.kernel.org/centos/6/os/x86_64 --network=bridge=br0,model=virtio \
--disk path=/dev/mapper/kvm-myGuestVM--root,bus=virtio --disk path=/dev/mapper/kvm-myGuestVM--swap,bus=virtio \
--initrd-inject="/tmp/myGuestVM.ks" --extra-args="ks=file:/myGuestVM.ks console=tty0 console=ttyS0,115200"Obviously I create the LVM partitions first, and point to a valid KickStart file.
I then go and have a coffee, while the new VM is installed automatically over the network with the latest CentOS 6 OS, and come back to a working new VM.
But running the exact same process on my (fully updated) Arch machine results in an error that I just cannot track down:
Starting install...
Retrieving file .treeinfo... | 728 B 00:00 !!!
Retrieving file vmlinuz... | 7.9 MB 00:05 !!!
Retrieving file initrd.img... | 64 MB 00:26 !!!
ERROR [Errno 2] No such file or directory
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start myGuestVM
otherwise, please restart your installation.Since the VM was never initialised, that virsh line obviously doesn't work.
Using the "-d" (debug) switch for virt-install doesn't help much, either:
Starting install...
[Sun, 16 Mar 2014 16:13:23 virt-install 24109] DEBUG (distroinstaller:412) Using scratchdir=/var/lib/libvirt/boot
[Sun, 16 Mar 2014 16:13:23 virt-install 24109] DEBUG (urlfetcher:293) Finding distro store for location=http://mirrors.kernel.org/centos/6/os/x86_64
[Sun, 16 Mar 2014 16:13:23 virt-install 24109] DEBUG (urlfetcher:99) Fetching URI: http://mirrors.kernel.org/centos/6/os/x86_64.treeinfo
[Sun, 16 Mar 2014 16:13:23 virt-install 24109] DEBUG (urlfetcher:110) Saved file to /var/lib/libvirt/boot/virtinst-.treeinfo.ESVS8P
Retrieving file .treeinfo... | 728 B 00:00 !!!
[Sun, 16 Mar 2014 16:13:23 virt-install 24109] DEBUG (urlfetcher:99) Fetching URI: http://mirrors.kernel.org/centos/6/os/x86_64/images/pxeboot/vmlinuz
[Sun, 16 Mar 2014 16:13:27 virt-install 24109] DEBUG (urlfetcher:110) Saved file to /var/lib/libvirt/boot/virtinst-vmlinuz.BdtxS7
Retrieving file vmlinuz... | 7.9 MB 00:03 !!!
[Sun, 16 Mar 2014 16:13:27 virt-install 24109] DEBUG (urlfetcher:99) Fetching URI: http://mirrors.kernel.org/centos/6/os/x86_64/images/pxeboot/initrd.img
[Sun, 16 Mar 2014 16:13:54 virt-install 24109] DEBUG (urlfetcher:110) Saved file to /var/lib/libvirt/boot/virtinst-initrd.img.p7kQH2
Retrieving file initrd.img... | 64 MB 00:26 !!!
[Sun, 16 Mar 2014 16:13:54 virt-install 24109] DEBUG (distroinstaller:233) Copying /tmp/myGuestVM.ks to the initrd.
[Sun, 16 Mar 2014 16:13:54 virt-install 24109] DEBUG (distroinstaller:236) Appending to the initrd.
[Sun, 16 Mar 2014 16:13:54 virt-install 24109] DEBUG (installer:187) Removing /var/lib/libvirt/boot/virtinst-vmlinuz.BdtxS7
[Sun, 16 Mar 2014 16:13:54 virt-install 24109] DEBUG (installer:187) Removing /var/lib/libvirt/boot/virtinst-initrd.img.p7kQH2
[Sun, 16 Mar 2014 16:13:54 virt-install 24109] DEBUG (cli:234) File "/usr/share/virt-manager/virt-install", line 879, in <module>
sys.exit(main())
File "/usr/share/virt-manager/virt-install", line 873, in main
start_install(guest, continue_inst, options)
File "/usr/share/virt-manager/virt-install", line 591, in start_install
fail(e, do_exit=False)
File "/usr/share/virt-manager/virtinst/cli.py", line 234, in fail
logging.debug("".join(traceback.format_stack()))
[Sun, 16 Mar 2014 16:13:54 virt-install 24109] ERROR (cli:235) [Errno 2] No such file or directory
[Sun, 16 Mar 2014 16:13:54 virt-install 24109] DEBUG (cli:237)
Traceback (most recent call last):
File "/usr/share/virt-manager/virt-install", line 563, in start_install
dom = guest.start_install(meter=meter, noboot=options.noreboot)
File "/usr/share/virt-manager/virtinst/guest.py", line 381, in start_install
self._prepare_install(meter, dry)
File "/usr/share/virt-manager/virtinst/guest.py", line 274, in _prepare_install
util.make_scratchdir(self.conn, self.type))
File "/usr/share/virt-manager/virtinst/installer.py", line 201, in prepare
self._prepare(guest, meter, scratchdir)
File "/usr/share/virt-manager/virtinst/distroinstaller.py", line 438, in _prepare
self._prepare_kernel_url(guest, fetcher)
File "/usr/share/virt-manager/virtinst/distroinstaller.py", line 357, in _prepare_kernel_url
fetcher.scratchdir)
File "/usr/share/virt-manager/virtinst/distroinstaller.py", line 245, in _perform_initrd_injections
cwd=tempdir)
File "/usr/lib/python2.7/subprocess.py", line 709, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1326, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
[Sun, 16 Mar 2014 16:13:54 virt-install 24109] DEBUG (cli:248) Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start myGuestVM
otherwise, please restart your installation.
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start myGuestVM
otherwise, please restart your installation.Any ideas? Or should I just open a bug report?
Last edited by bazzo (2014-03-16 09:25:27)
Offline
I'm getting this error as well. The error seems to be related to --initrd-inject.
The following produces an error
virt-install --connect=qemu:///system \
--location=ftp://ftp.us.debian.org/debian/dists/stable/main/installer-amd64 \
--initrd-inject=/home/myname/tmp/preseed/preseed.cfg \
--extra-args="auto" \
--name debian_stable_preseed --ram=512 \
--disk=pool=default,size=5,format=qcow2,bus=virtioHowever the following starts installing.
virt-install --connect=qemu:///system \
--location=ftp://ftp.us.debian.org/debian/dists/stable/main/installer-amd64 \
--extra-args="auto" \
--name debian_stable_preseed --ram=512 \
--disk=pool=default,size=5,format=qcow2,bus=virtioI might dig into this some more later.
Offline
I figured out a workaround since posting this, at least for CentOS/RHEL installs - if I upload the kickstart file to a web server and load it via HTTP instead of via the initrd, it works fine:
sudo virt-install --name=myGuestVM --ram=2048 --vcpus=1 --os-variant=rhel6 --nographics \
--location http://mirrors.kernel.org/centos/6/os/x86_64 --network=bridge=br0,model=virtio \
--disk path=/dev/mapper/kvm-myGuestVM--root,bus=virtio --disk path=/dev/mapper/kvm-myGuestVM--swap,bus=virtio \
--extra-args="ks=http://10.0.0.101/myGuestVM.ks console=tty0 console=ttyS0,115200"Any attempt to use --initrd-inject brings back that hopelessly vague error though:
ERROR (cli:235) [Errno 2] No such file or directoryI am guessing that libvirt is either unable to load the ks file from /tmp, or unable to open the initrd file in order to modify it. Neither of those things make much sense to me though.
It would be immensely useful if the virt-install error handler would actually report WHICH file or directory it was trying to open...
Offline
Thanks for updating. I also found the same work around. For other people that find this thread, here is an example of preseeding debian stable.
virt-install --connect=qemu:///system \
--location=ftp://ftp.us.debian.org/debian/dists/stable/main/installer-amd64 \
--os-type=linux \
--virt-type=kvm \
--extra-args="\
auto=true priority=critical url=http://192.168.122.1/preseed.cfg" \
--name debian_stable_preseed --ram=512 \
--disk=pool=default,size=5,format=qcow2,bus=virtioI also checked the latest code from the virt-manager repo https://git.fedorahosted.org/git/virt-manager.git . It still has this issue.
Offline
Seems the missing file is cpio.
Installing cpio via pacman fixed the Problem for me.
Should be in the deps from virt-manager in some days.
Greetings
Lucas
Offline
I can confirm that installing the cpio package fixed my issue.
Many, many thanks to Maesto.
Last edited by bazzo (2014-06-23 21:23:23)
Offline