Page 1 of 1

Unable to create virtual machine using KVM and Libvirt

Posted: 2019/10/29 06:47:19
by LuckyTheRabbit
Hello! I downloaded and installed CentOS 8 earlier today, intending to use it as a hypervisor. I chose the virtual host software selections during the install, and afterwards installed virt-install via

Code: Select all

dnf install virt-install
I'd like to now create a virtual machine using a Linux Crux ISO, however I get an error:

Code: Select all

[nchambers@elixir ~]$ sudo virt-install --name spellbook --description "Test VM" --os-type=Linux --os-variant=generic --ram=1024 --vcpus=2 --disk path=/var/vm/spellbook.img,bus=virtio,size=10 --graphics none --network bridge:br0 --extra-args console=ttyS0 --location /var/lib/libvirt/images/crux-3.5.iso

Starting install...
ERROR    Could not find an installable distribution at '/var/lib/libvirt/images/crux-3.5.iso'

The location must be the root directory of an install tree.
See virt-install man page for various distro examples.
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start spellbook
otherwise, please restart your installation.
If I try with

Code: Select all

--cdrom /var/lib/libvirt/images/crux-3.5.iso
it lets me boot the ISO and then proceeds a couple of lines, but hangs afterwards:

Code: Select all

[nchambers@elixir ~]$ sudo virt-install --name spellbook --description "Test VM" --os-type=Linux --os-variant=generic --ram=1024 --vcpus=2 --disk path=/var/vm/spellbook.img,bus=virtio,size=10 --graphics none --network bridge:br0 --cdrom /var/lib/libvirt/images/crux-3.5.iso
WARNING  CDROM media does not print to the text console by default, so you likely will not see text install output. You might want to use --location. See the man page for examples of using --location with CDROM media

Starting install...
Allocating 'spellbook.img'                                                                                                                                                           |  10 GB  00:00:01
Connected to domain spellbook
Escape character is ^]

ISOLINUX 6.03 2014-10-06  Copyright (C) 1994-2014 H. Peter Anvin et al
boot:
Loading /boot/vmlinuz... ok
Loading /boot/initramfs...ok
^]
Domain installation still in progress. You can reconnect to
the console to complete the installation process.
The ISO appears to be fine:

Code: Select all

[nchambers@elixir ~]$ file /var/lib/libvirt/images/crux-3.5.iso
/var/lib/libvirt/images/crux-3.5.iso: DOS/MBR boot sector; partition 2 : ID=0xef, start-CHS (0x3ff,254,63), end-CHS (0x3ff,254,63), startsector 61648, 4096 sectors
[nchambers@elixir ~]$ md5sum /var/lib/libvirt/images/crux-3.5.iso
eb0c9b75322ba240f229ec9834feddfd  /var/lib/libvirt/images/crux-3.5.iso
Is there an option I need to pass to virt-install for it to properly load the ISO?

OS info:

Code: Select all

[nchambers@elixir ~]$ cat /etc/centos-release
CentOS Linux release 8.0.1905 (Core)
[nchambers@elixir ~]$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"

[nchambers@elixir ~]$ uname -a
Linux elixir.naughtysysadmins.com 4.18.0-80.11.2.el8_0.x86_64 #1 SMP Tue Sep 24 11:32:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Re: Unable to create virtual machine using KVM and Libvirt

Posted: 2019/10/29 12:02:47
by TrevorH
That looks to me like you need to pass parameters like -x "console=ttyS0 nameserver=8.8.8.8 ksdevice=link ip=...

Also, read the man page for --location and especially red the caveat that says "Note that the directory will not be accessible by the guest after initial boot, so the OS installer will need another way to access the rest of the install media". You may need to use a network based location to make this persist to the guest.

Re: Unable to create virtual machine using KVM and Libvirt

Posted: 2019/10/30 19:48:34
by LuckyTheRabbit
Ah, thanks. That is helpful. I'll see if I can find an install location for CRUX

Re: Unable to create virtual machine using KVM and Libvirt

Posted: 2019/10/31 04:00:00
by hunter86_bg
Keep in mind that /var/vm (wheere you want to install your VM) is not a default VM location and SELINUX might cause you troubles.