19

Disclaimer :

I now use virt-manager to create and manage my VM and it is really a life saver. It can be used remotely (from a third machine, typically your workstation) if the host does not have graphical display.

The occurrences of vnc in the installation tutorials I found made me think that the "recommended" procedure required X stuff either on host, guest or both. Absolutely not. My mistake. If you are in the same situation, think twice before trying to install the VM from command line.


I'm trying to install a Debian VM in a Debian host using virt-install and I don't know how to pass it the .iso image.

virt-install --connect qemu:///system --virt-type kvm --name prod --ram 6144 --disk /srv/vm/prod.qcow,format=qcow2,size=10 --location=/home/jerome/debian-8.0.0-amd64-netinst.iso --network bridge=br0 --os-type linux --os-variant debianwheezy --extra-args='console=tty0 console=ttyS0,115200n8 serial'

Starting install...
Retrieving file info...                                                                                                                                         |  160 B     00:00 ... 
ERROR    Could not find an installable distribution at '/home/jerome/debian-8.0.0-amd64-netinst.iso'
The location must be the root directory of an install tree.
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start prod
otherwise, please restart your installation.
root@versailles:/etc# 

The solutions I have seen seem quite twisted, like using apache to serve locally the .iso image as if it was from a distant place.

I can't believe it is that complicated. Is it?

man virt-install says:

If you want to use those options with CDROM media, you have a few options:

         * Run virt-install as root and do --location ISO

         * Mount the ISO at a local directory, and do --location DIRECTORY

         * Mount the ISO at a local directory, export that directory over local http, and do --location http://localhost/DIRECTORY

Isn't this what I'm doing?

Someone says he moved the .iso to /cdrom and it worked but I didn't understand exactly what he did and I couldn't reproduce.

I cannot use --cdrom instead of --location as in this question because --extra-args only work if specified with --location.

virt-install --connect qemu:///system --virt-type kvm --name prod --ram 6144 --disk /srv/vm/prod.qcow,format=qcow2,size=10 --cdrom=/home/jerome/debian-8.0.0-amd64-netinst.iso --network bridge=br0 --os-type linux --os-variant debianwheezy --extra-args='console=tty0 console=ttyS0,115200n8 serial'
ERROR    --extra-args only work if specified with --location. See the man page for examples of using --location with CDROM media

Edit:

Log with --debug

virt-install --connect qemu:///system --virt-type kvm --name prod --ram 6144 --disk /srv/vm/prod.qcow,format=qcow2,size=10 --location=/home/jerome/debian-8.0.0-amd64-netinst.iso --network bridge=br0 --os-type linux --os-variant debianwheezy --extra-args='console=tty0 console=ttyS0,115200n8 serial' --debug
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:187) Launched with command line: /usr/share/virt-manager/virt-install --connect qemu:///system --virt-type kvm --name prod --ram 6144 --disk /srv/vm/prod.qcow,format=qcow2,size=10 --location=/home/jerome/debian-8.0.0-amd64-netinst.iso --network bridge=br0 --os-type linux --os-variant debianwheezy --extra-args=console=tty0 console=ttyS0,115200n8 serial --debug
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:195) Requesting libvirt URI qemu:///system
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:199) Received libvirt URI qemu:///system
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (virt-install:193) Requesting virt method 'default', hv type 'kvm'.
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (virt-install:432) Received virt method 'kvm'
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (virt-install:433) Hypervisor name is 'hvm'
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:476) DISPLAY is not set: defaulting to nographics.
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (guest:208) Setting Guest.os_variant to 'debianwheezy'
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (diskbackend:171) Path '/srv/vm' is target for pool 'srv-kvm'. Creating volume 'prod.qcow'.
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (connection:228) Fetching volume XML failed: Storage volume not found: no storage vol with matching path '/media/cdrom0/debian-8.0.0-amd64-netinst.iso'
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (virt-install:551) Guest.has_install_phase: True

Starting install...
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (distroinstaller:417) Using scratchdir=/var/lib/libvirt/boot
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:204) Preparing mount at /var/lib/libvirt/boot/virtinstmnt.srz86f
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:214) mount cmd: ['/bin/mount', '-o', 'ro,loop', '/home/jerome/debian-8.0.0-amd64-netinst.iso', '/var/lib/libvirt/boot/virtinstmnt.srz86f']
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:302) Finding distro store for location=/home/jerome/debian-8.0.0-amd64-netinst.iso
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/.treeinfo
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:325) Prioritizing distro store=<class 'virtinst.urlfetcher.DebianDistro'>
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/current/images/MANIFEST
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/daily/MANIFEST
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/Fedora
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:99) Fetching URI: /var/lib/libvirt/boot/virtinstmnt.srz86f/.disk/info
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:110) Saved file to /var/lib/libvirt/boot/virtinst-info.lZMVqL
Retrieving file info...                                                                                                                                                                                                  |  160 B     00:00 ... 
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:1016) Regex didn't match, not a ALT Linux distro
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/current/images/MANIFEST
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/install/netboot/version.info
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/SL
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/directory.yast
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/CentOS
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/VERSION
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/Server
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/Client
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/RedHat
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/images/pxeboot/vmlinuz
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/images/boot.iso
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/boot/boot.iso
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/current/images/netboot/mini.iso
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/install/images/boot.iso
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:225) Cleaning up mount at /var/lib/libvirt/boot/virtinstmnt.srz86f
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:234)   File "/usr/share/virt-manager/virt-install", line 876, in <module>
    sys.exit(main())
  File "/usr/share/virt-manager/virt-install", line 870, in main
    start_install(guest, continue_inst, options)
  File "/usr/share/virt-manager/virt-install", line 588, 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()))

[mer., 03 juin 2015 17:46:12 virt-install 12991] ERROR (cli:235) Could not find an installable distribution at '/home/jerome/debian-8.0.0-amd64-netinst.iso'
The location must be the root directory of an install tree.
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:237) 
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-install", line 560, in start_install
    dom = guest.start_install(meter=meter, noboot=options.noreboot)
  File "/usr/share/virt-manager/virtinst/guest.py", line 384, in start_install
    self._prepare_install(meter, dry)
  File "/usr/share/virt-manager/virtinst/guest.py", line 277, 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 444, in _prepare
    self._prepare_kernel_url(guest, fetcher)
  File "/usr/share/virt-manager/virtinst/distroinstaller.py", line 347, in _prepare_kernel_url
    store = urlfetcher.getDistroStore(guest, fetcher)
  File "/usr/share/virt-manager/virtinst/urlfetcher.py", line 346, in getDistroStore
    fetcher.location))
ValueError: Could not find an installable distribution at '/home/jerome/debian-8.0.0-amd64-netinst.iso'
The location must be the root directory of an install tree.
[mer., 03 juin 2015 17:46:12 virt-install 12991] 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 prod
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 prod
otherwise, please restart your installation.

It works with --location http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/ but isn't it a bit of a shame to do this when an .iso image is available locally?

  • Loss of traceability : you can't reproduce later being sure you get the exact same source.

  • Multiplicated use of bandwidth from servers/mirrors.

  • Need for internet access.

  • Slower.

3
  • You are right, but you can mitigate some of those drawbacks by building a local package cache server using apt-cacher-ng, or a full mirror using apt-mirror or ftpsync. Actually CD/DVD/BD distribution is only a tiny subset of the great package collection of Debian, it undesirably spoils its benefits and just irritates us. Therefore many people tend to maintain their local mirror and enjoy its completeness from the beginning of the install.
    – yaegashi
    Jun 3, 2015 at 18:03
  • This was fixed in virt-manager 1.4.3 (commit).
    – tom
    Nov 11, 2019 at 10:08
  • You might need to use the kernel=, initrd= suboptions to --install if you are using an ISO with non-standard locations for those files. More detail in the virt-install man page. This is what you would have to do if configuring GRUB to boot off a .iso file. Mar 26, 2021 at 8:41

7 Answers 7

10

This method worked for me:

virt-install --name=centos \
--memory=8196 --vcpus=2 \
--location=/var/lib/libvirt/images/CentOS-7-x86_64-Minimal-1511.iso \
--disk /var/lib/libvirt/images/centos7.qcow2,device=disk,bus=virtio,size=8 \
--network bridge:br0 \
--os-type=linux  \
--nographics \
--extra-args='console=tty0 console=ttyS0,115200n8 serial'
1
8

virt-install tries to extract kernel and initrd files from the ISO image. With --debug you can see the whole activities of it including loop-mounting, searching for those files, etc.

Starting install...
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (Installer:182) scratchdir=/var/lib/libvirt/boot
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:184) Preparing mount at /var/lib/libvirt/boot/virtinstmnt.dwcpql
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (OSDistro:65) Attempting to detect distro:
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/.treeinfo
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/Fedora
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/Server
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/Client
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/RedHat
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/CentOS
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/SL
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/directory.yast
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/current/images/MANIFEST
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/daily/MANIFEST
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/current/images/MANIFEST
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/install/netboot/version.info
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/initrd.gz
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (OSDistro:990) Doesn't look like an Ubuntu Distro.
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/VERSION
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/VERSION
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/boot/platform/i86xpv/kernel/unix
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/platform/i86xpv/kernel/unix
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/STARTUP/XNLOADER.SYS
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/images/pxeboot/vmlinuz
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/images/boot.iso
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/boot/boot.iso
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/current/images/netboot/mini.iso
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/install/images/boot.iso
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:205) Cleaning up mount at /var/lib/libvirt/boot/virtinstmnt.dwcpql
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] ERROR (cli:445) Could not find an installable distribution at '/home/yaegashi/debian-8.0.0-amd64-netinst.iso'

I suppose virt-install doesn't support Debian netinst ISO images with --location (but somehow Ubuntu supported?).

To boot a kernel with --extra-args, virt-install needs to have those kernel and corresponding initrd files. --cdrom simply attaches ISO to the guest's CD drive, that's insufficient to work with --extra-args.

If you want use --extra-args, I recommend you to use "netboot" kernel/initrd files by specifying Debian installer URL of your nearest mirror, like --location http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/ as described in the manual.

3
  • Thanks. Accepting your answer as it looks like there's no simple way but I think this method has issues (question updated accordingly).
    – Jérôme
    Jun 3, 2015 at 16:24
  • That will certainly work, but I don't think it answers the question of how to install from a local iso, which you might need to do if you don't have internet access. Sep 30, 2015 at 22:12
  • Note that this is not a link to an ISO, it's a link to ... a directory structure known to contain ISOs. Took me a few tries to figure this out. Why this works differently on KVM-Debian than KVM-CentOS (which I just moved from) I have no idea, but this works (still, in 2019). Apr 17, 2019 at 7:42
2

The difference is in the iso files that are used.

It's not related to the way virt-install is used (--location used with http URL versus --location used with path to a local iso file).

Here's a command that works when using the Debian online repositories as --location (including getting output to complete the installation until first boot (then two other steps are necessary to finally get into the new VM, but that's another story):

virt-install --virt-type kvm --name test8 --memory 2048 --disk path=/var/lib/libvirt/images/test8-1.qcow2,size=5 --disk path=/var/lib/libvirt/images/test8-2.qcow2,size=2 --location http://ftp.at.debian.org/debian/dists/stable/main/installer-amd64/ --graphics none --extra-args='console tty0 console=ttyS0,115200n8 serial'

You can take the exact same command, but using the above mentioned Centos ISO file as --location, and it works as well (except that the connection to the serial console does not seem to work at first, but in principle the installation starts using --location and the ISO file):

virt-install --virt-type kvm --name test8 --memory 2048 --disk path=/var/lib/libvirt/images/test8-1.qcow2,size=5 --disk path=/var/lib/libvirt/images/test8-2.qcow2,size=2 --location /softwarestorage/CentOS-7-x86_64-Minimal-1511.iso --graphics none --extra-args='console tty0 console=ttyS0,115200n8 serial'

Output is:

Starting install...
Retrieving file .treeinfo...                                                                                                                                                                | 2.2 kB     00:00 ... 
Retrieving file vmlinuz...                                                                                                                                                                  | 9.8 MB     00:00 ... 
Retrieving file initrd.img...                                                                                                                                                               |  73 MB     00:00 ... 
Creating domain...                                                                                                                                                                          |    0 B     00:00     
Connected to domain test8
Escape character is ^]

But if you use the Debian ISO file for --location, you get the error:

virt-install --virt-type kvm --name test8 --memory 2048 --disk path=/var/lib/libvirt/images/test8-1.qcow2,size=5 --disk path=/var/lib/libvirt/images/test8-2.qcow2,size=2 --location /softwarestorage/debian-8.5.0-amd64-CD-1.iso --graphics none --extra-args='console tty0 console=ttyS0,115200n8 serial'

Starting install...
Retrieving file info...                                                                                                                                                                     |  150 B     00:00 ... 
ERROR    Could not find an installable distribution at '/softwarestorage/debian-8.5.0-amd64-CD-1.iso'
The location must be the root directory of an install tree.
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start test8
otherwise, please restart your installation.

IMHO this proves that there's something missing / anything "wrong" with the Debian ISO (not sure at the moment where i got it from, but maybe someone can download a fresh one and repeat the tests...)

2
  • I think you are... very much wrong. In your first example, you're specifying an FTP location, and in your second example, you're specifying a local ISO file. These two approaches differ because with FTP and HTTP URLs, virt-install can "walk" the directory structure looking for initrd.img and kernel.img. With a local ISO, virst-install must first mount the ISO to walk the directory structure, and of course, mount requires root access to mount arbitrary (non-fstab) locations. Jul 3, 2017 at 18:00
  • @DejayClayton: he's right. I've spent all day trying to install Ubuntu 16.04 and 18.04, and Centos 7.1, on a Centos 6 host, using exactly the same mount and export procedure, and --location for all 3. The Centos-6 virt-install doesn't recognise the Ubuntu directory structure, and --debug tells you that. The Centos-7 top level includes a .treeinfo, which is one of the things that virt-install looks for, so it attempts to boot it. But fails later anyway. I am astonised at what a pile of **** this software is.
    – EML
    Jul 27, 2019 at 18:11
1

It's ugly, especially if you want to use kickstart files, but here's what I did to get this process going:

root@kvm:~# virt-install -n rhce2 -r 2048 --vcpus=1 --os-variant=rhel6 --accelerate -v --disk path=/var/lib/libvirt/images/RHCE2.img,size=100 -l /root/centos6.7.iso -x "ks=./ks1.cfg" --nographics

The basic difference between what I did and what you did is that I used the --location tag (-l for short) to point to my iso.

1
  • This is very much wrong. The difference is that he's installing from debian netinstall iso file and you are installing RHCE2.
    – carandraug
    Nov 25, 2016 at 18:00
1

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 ... --location=/srv/software/Debian/debian-10.0.0-amd64-netinst.iso --extra-args='console=tty0 console=ttyS0,115200n8'
0

recently ran into this issue. Simply used a remote installer with --location. I must emphasise that depending on your virsh version, links for remote installers may be outdated in the man page.

I just followed this example and everything ran smoothly: https://www.packet.com/developers/guides/kvm-and-libvirt/

In my case, I changed 'xenial' for 'bionic' in http://us.archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/ and the installation went through. Going to use this method every time from now on.

0

When using --location you need to include the RAM disk and kernel file.

You can use isoinfo -J -i file.iso -l | grep '(initrd|vmlinuz)' to find the corresponding files.

Distro Kernel path RAM disk path
Fedora /isolinux/vmlinuz /isolinux/initrd.img
RHEL5/CentOS5 /isolinux/vmlinuz /isolinux/initrd.img
openSUSE /boot/i386/loader/linux /boot/i386/loader/initrd
Mandriva /i586/isolinux/alt0/vmlinuz /i586/isolinux/alt0/all.rdz
Ubuntu /casper/vmlinuz /casper/initrd.gz or /casper/initrd
Debian /install.386/vmlinuz/ /isolinux/initrd.img

So the --location parameter of virt-install should look like this:

  • For Fedora systems: --location $iso,initrd=live/initrd.img,kernel=pxeboot/vmlinuz
  • For Debian systems: --location $iso,initrd=install/initrd.gz,kernel=install/vmlinuz
iso=/debian.iso

virt-install \
  --disk path=$iso,device=cdrom \
  --location $iso,initrd=install/initrd.gz,kernel=install/vmlinuz \

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .