Unable to create virtual machine using KVM and Libvirt

Issues related to applications and software problems and general support
Post Reply
User avatar
LuckyTheRabbit
Posts: 2
Joined: 2019/01/15 17:44:53
Location: Austin, Tx
Contact:

Unable to create virtual machine using KVM and Libvirt

Post by LuckyTheRabbit » 2019/10/29 06:47:19

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
"Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing." - Dwight Schrute

User avatar
TrevorH
Forum Moderator
Posts: 27127
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Unable to create virtual machine using KVM and Libvirt

Post by TrevorH » 2019/10/29 12:02:47

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.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
CentOS 5 has been EOL for nearly 3 years and should no longer be used for anything!
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
LuckyTheRabbit
Posts: 2
Joined: 2019/01/15 17:44:53
Location: Austin, Tx
Contact:

Re: Unable to create virtual machine using KVM and Libvirt

Post by LuckyTheRabbit » 2019/10/30 19:48:34

Ah, thanks. That is helpful. I'll see if I can find an install location for CRUX
"Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing." - Dwight Schrute

hunter86_bg
Posts: 1929
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Unable to create virtual machine using KVM and Libvirt

Post by hunter86_bg » 2019/10/31 04:00:00

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.

Post Reply

Return to “CentOS 8 - General Support”