8

I have upgraded my OS to Ubuntu 16.04 and am trying to install an ubuntu 14.04 guest from scratch using my KVM management tool that I have been using successfully on Ubuntu 14.04 for some time now. Unfortunately, it looks like virt-install has changed and no longer accepts the --location parameter with an ISO image as it will output the following error:

Starting install...
ERROR    Could not find an installable distribution at '/home/programster/apps/KVM-Command-Generator/installation_media/Ubuntu_14.04.iso'

The location must be the root directory of an install tree.

However, if I nwo use the --cdrom parameter in place of --location it no longer likes the fact that I have an --extra-args parameter specifying the location of the kickstart/preseed file and that the console is to use ttyS0.

--extra-args "console=ttyS0 ks=http://pastebin.com/raw.php?i=SrTvbt6Z"

At this point, I tried going with just deleting the --extra-args parameter to install from the CD, but if you do this, you can't see any output in the CLI for the installation. I am guessing it wants you to connect via VNC or something which is not ideal.

For reference, the original installation commands were:

qemu-img create -f qcow2 -o preallocation=metadata,lazy_refcounts=on /home/programster/apps/KVM-Command-Generator/vms/ubuntu14.04.img 20G
virt-install --connect qemu:///system  \
--nographics \
--os-type linux \
--accelerate \
--hvm \
--network network=default,model=virtio \
--name ubuntu14.04 \
--os-variant=ubuntu14.04 \
--location /home/programster/apps/KVM-Command-Generator/installation_media/Ubuntu_14.04.iso \
--extra-args "console=ttyS0 ks=http://pastebin.com/raw.php?i=SrTvbt6Z" \
--disk /home/programster/apps/KVM-Command-Generator/vms/ubuntu14.04.img,bus=virtio,format=qcow2 \
--ram 512 \
--vcpus 2

And the new commands are:

qemu-img create -f qcow2 -o preallocation=metadata,lazy_refcounts=on /home/programster/apps/KVM-Command-Generator/vms/ubuntu14.04.img 20G
virt-install --connect qemu:///system  \
--nographics \
--os-type linux \
--accelerate \
--hvm \
--network network=default,model=virtio \
--name ubuntu14.04 \
--os-variant=ubuntu14.04 \
--cdrom /home/programster/apps/KVM-Command-Generator/installation_media/Ubuntu_14.04.iso \
--disk /home/programster/apps/KVM-Command-Generator/vms/ubuntu14.04.img,bus=virtio,format=qcow2 \
--ram 512 \
--vcpus 2

Question

How can I get virt-install to install from a local ISO image with the extra arguments to specify the location of the kickstart/preseed file, and allow me to see the progress and possibly choose options through the CLI rather than using VNC?

Perhaps I have to specify a web url instead of an ISO image to --location, but I would prefer it if I could pass a local location in case the internet is not that great.

Extra Info

5

@Programster - I reported this issue to the virt-manager maintainers on their mailing list. See http://www.redhat.com/archives/virt-tools-list/2016-August/msg00009.html. You can follow that thread for more details. Knowing that this worked in Ubuntu 14.04 and not in Ubuntu 16.04 was key to resolving the problem.

Bottom line, this is fixed now in the master branch of https://github.com/virt-manager/virt-manager.

The commit that fixed it is: https://github.com/virt-manager/virt-manager/commit/3f15a489cda87f8028828d567848193dd2640a43

I'm not sure when this will make it into the various virt-manager packages. But you can grab the source and run virt-install from there. (Note: you'll need to add some packages, and probably should create a Python virtual environment, so you might want to experiment on a VM before messing about with extra packages on a system you need to remain stable and clean.)

| improve this answer | |
  • As of today, in Debian Stable (Stretch) only Version 1.4.0 is included, which is older than this and doesn't include the fix. tracker.debian.org/pkg/virt-manager Newer dot-versions exist, so this is probably not very well maintained – AdamKalisz Aug 22 '18 at 16:17
1

After reading the --location section in the man pages for virt-install, it looks like one should still be able to use location to specify the path to an ISO image, it doesn't work for me. Luckily it gave some examples, of which there was this one listed for Ubuntu:

http://us.archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64/

Using that worked for me so to get it to install Ubuntu 14.04 all I did was change the wily to trusty and Bob's your uncle! I wish that I could install from a local mini.iso but in the meantime this should work for me and others.

| improve this answer | |
0

The following worked for me installing Debian 10 from an Ubuntu 16.04 host system:

cd /usr/share/virt-manager/virtinst/
patch <<.
--- urlfetcher.py.orig 2019-07-25 13:54:37.496567791 +1200
+++ urlfetcher.py      2019-07-25 13:54:43.180373257 +1200
@@ -663,6 +663,8 @@
                 ]
     _hvm_paths = [("pxeboot/vmlinuz",
                     "images/pxeboot/initrd.img"),       # Fedora
+                  ("install.amd/vmlinuz",
+                    "install.amd/initrd.gz"),   # Debian
                 ]
     _iso_paths = ["images/boot.iso",                   # RH/Fedora
                    "boot/boot.iso",                     # Suse
.

virt-install --debug ... --location=/srv/software/Debian/debian-10.0.0-amd64-netinst.iso --extra-args='console=tty0 console=ttyS0,115200n8'
| improve this answer | |
0

I came across the same issue as of this days, some of the previous answers help me find the way to do it. The solution for me was found in the manual of virt-install about iso install, as I was using a net install iso it needed to specify additional kernel and initrd parameters indicating the path within the iso to find them. Thanks to the --debug option I found the code of the installer to understand better what was happening. So finally the provisioning line ended being something like this:

virt-install --name centos7 \
             --virt-type kvm \
             --memory 2048 \
             --vcpus 2 \
             --disk path='/path_to_isos/CentOS-7-x86_64-NetInstall-2003.iso',device=cdrom \
             --disk path=centos7.qcow2,device=disk \
             --location '/path_to_isos/CentOS-7-x86_64-NetInstall-2003.iso',initrd=isolinux/initrd.img,kernel=isolinux/vmlinuz \
             --graphics none \
             --os-type Linux \
             --os-variant centos7.0 \
             --network type=direct,source=enp3s0,source_mode=bridge,model=virtio \ 
             --extra-args 'console=ttyS0,115200n8 serial' \
             --console pty,target_type=serial \
             --debug

The key here is the additional parameters on the location specifying vmlinuz as kernel and initrd.img. To find the path within the iso I've use it the isoinfo command as follows:

$ isoinfo -J -i '/path_to_isos/CentOS-7-x86_64-NetInstall-2003.iso' -l

So I found them in the isolinux folder in this case. Additionally I've defined the disk for the cdrom device so I can access it while installing, but as in this case I was using the network repository I've defined the source as one of the mirrors for CentOS 7 through the text based installation menus. I guess that the source could be the full CD/DVD iso if is needed. Using location enables the extra-args so I can access it with text console for the whole installation process. Hope this helps to complete the answer to the original question.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.