Installing Kali Linux using KVM virt-install tool

Kaushal Shriyan kaushalshriyan at gmail.com
Fri Aug 7 14:29:05 UTC 2020


Hi Pavel,

I am running virt-install version 1.5.0 on CentOS Linux release 7.6.1810
(Core) server.

#virt-install --name=kalilinux --file=/linuxkvmaddgbdisk/kalilinux.img
--file-size=50 --nonsparse --vcpu=2 --ram=4096 --network=bridge:br0
--os-type=linux --os-variant=debian9 --graphics none --location
/linuxkvmaddgbdisk/kali-linux-2020.2-installer-amd64.iso,kernel=install.amd/vmlinuz,initrd=install.amd/initrd.gz
--extra-args="console=ttyS0"

ERROR    Error validating install location: Validating install media
'/linuxkvmaddgbdisk/kali-linux-2020.2-installer-amd64.iso,kernel=install.amd/vmlinuz,initrd=install.amd/initrd.gz'
failed: Could not start storage pool: cannot open directory
'/linuxkvmaddgbdisk/kali-linux-2020.2-installer-amd64.iso,kernel=install.amd/vmlinuz,initrd=install.amd':
No such file or directory


#virt-install --name=kalilinux --file=/linuxkvmaddgbdisk/kalilinux.img
--file-size=50 --nonsparse --vcpu=2 --ram=4096 --network=bridge:br0
--os-type=linux --os-variant=debian9 --graphics none --location
/linuxkvmaddgbdisk
kali-linux-2020.2-installer-amd64.iso,kernel=install.amd/gtk/vmlinuz,initrd=install.amd/gtk/initrd.gz
--extra-args="console=ttyS0"
usage: virt-install --name NAME --memory MB STORAGE INSTALL [options]
virt-install: error: unrecognized arguments:
kali-linux-2020.2-installer-amd64.iso,kernel=install.amd/gtk/vmlinuz,initrd=install.amd/gtk/initrd.gz
#

Any help will be highly appreciated and I look forward to hearing from you.
Please let me know if you need any additional details. Thanks in Advance.

Best Regards,

Kaushal


On Fri, Aug 7, 2020 at 5:44 PM Pavel Hrdina <phrdina at redhat.com> wrote:

> On Fri, Aug 07, 2020 at 05:05:48PM +0530, Kaushal Shriyan wrote:
> > On Fri, Aug 7, 2020 at 1:10 PM Erik Skultety <eskultet at redhat.com>
> wrote:
> >
> > > On Wed, Aug 05, 2020 at 10:13:57PM +0530, Kaushal Shriyan wrote:
> > > > On Wed, Aug 5, 2020 at 1:32 PM Pavel Hrdina <phrdina at redhat.com>
> wrote:
> > > >
> > > > > On Wed, Aug 05, 2020 at 06:57:11AM +0530, Kaushal Shriyan wrote:
> > > > > > Hi,
> > > > > >
> > > > > > I am trying to install kali-linux-2020.2-installer-amd64.iso (
> > > > > > https://www.kali.org/downloads/) using KVM virt-install tool
> > > > > >
> > > > > > #virt-install --name=kalilinux
> > > --file=/linuxkvmaddgbdisk/kalilinux.img
> > > > > > --file-size=50 --nonsparse --vcpu=2 --ram=4096
> --network=bridge:br0
> > > > > > --os-type=linux --os-variant=debian9 --graphics none
> > > > > >
> --location=/linuxkvmaddgbdisk/kali-linux-2020.2-installer-amd64.iso
> > > > > > --extra-args="console=ttyS0
> > > > > >
> > > > > > Starting install...
> > > > > > Retrieving file .treeinfo...
> > > > > >
> > > > > >                               |    0 B  00:00:00
> > > > > > Retrieving file content...
> > > > > >
> > > > > >                               |    0 B  00:00:00
> > > > > > Retrieving file info...
> > > > > >
> > > > > >                              |  104 B  00:00:00
> > > > > > Retrieving file info...
> > > > > >
> > > > > >                              |  104 B  00:00:00
> > > > > > Retrieving file info...
> > > > > >
> > > > > >                              |  104 B  00:00:00
> > > > > > ERROR    Could not find an installable distribution at
> > > > > > '/linuxkvmaddgbdisk/kali-linux-2020.2-installer-amd64.iso': The
> URL
> > > could
> > > > > > not be accessed, maybe you mistyped?
> > > > > >
> > > > > > 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 kalilinux
> > > > > > otherwise, please restart your installation.
> > > > > >
> > > > > >
> > > > > > #virt-install --name=kalilinux
> > > --file=/linuxkvmaddgbdisk/kalilinux.img
> > > > > > --file-size=50 --nonsparse --vcpu=2 --ram=4096
> --network=bridge:br0
> > > > > > --os-type=linux --os-variant=debian9 --graphics none
> > > > > > --cdrom=/linuxkvmaddgbdisk/kali-linux-2020.2-installer-amd64.iso
> > > > > > --extra-args="console=ttyS0"
> > > > > > ERROR    --extra-args only work if specified with --location. See
> > > the man
> > > > > > page for examples of using --location with CDROM media
> > > > > >
> > > > > > I did not find kali OS details to provide an option for*
> > > --os-variant=
> > > > > * When
> > > > > > I ran osinfo-query os | grep kali it did not return anything.
> > > > > > Any help will be highly appreciated and I look forward to hearing
> > > from
> > > > > you.
> > > > > > Thanks in advance.
> > > > >
> > > > > Hi,
> > > > >
> > > > > Using --location with ISO image requires specific file to be
> available
> > > > > in the ISO image where virt-install can look to figure out path to
> > > linux
> > > > > kernel and initrd otherwise it is not able to use --location and
> > > > > --extra-args as well.
> > > > >
> > > > > If you look into virt-install man page in the section for
> --location
> > > you
> > > > > can find this example:
> > > > >
> > > > >     Additionally, --location can take 'kernel' and 'initrd' sub
> > > options.
> > > > >     These paths relative to the specified location URL/ISO that
> allow
> > > > >     selecting specific files for kernel/initrd within the install
> tree.
> > > > >     This can be useful if virt-install/ libosinfo doesn't know
> where to
> > > > >     find the kernel in the specified --location.
> > > > >
> > > > >     For example, if you have an ISO that libosinfo doesn't know
> about
> > > > >     called my-unknown.iso, with a kernel at 'kernel/fookernel' and
> > > > >     initrd at 'kernel/fooinitrd', you can make this work with:
> > > > >
> > > > >         --location
> > > > > my-unknown.iso,kernel=kernel/fookernel,initrd=kernel/fooinitrd
> > > > >
> > > > >
> > > > > You can use isoinfo to get the content of your ISO image:
> > > > >
> > > > >     isoinfo -J -i /path/to/your.iso -f
> > > > >
> > > > > and use the --location with kernel and initrd parameters which will
> > > make
> > > > > it work and --extra-args will work as well.
> > > > >
> > > > > Pavel
> > > > >
> > > >
> > > > Hi Pavel,
> > > >
> > > > Thanks for your email and much appreciated. I have pasted the output
> here
> > > > https://paste.centos.org/view/89952d91
> > >
> > > Hi,
> > > ^this URL you provided already expired, consider using longer time
> periods
> > > for pastebin services when posting to a mailing list.
> > >
> > > >
> > > > #virt-install --name=kalilinux
> --file=/linuxkvmaddgbdisk/kalilinux.img
> > > > --file-size=50 --nonsparse --vcpu=2 --ram=4096 --network=bridge:br0
> > > > --os-type=linux --os-variant=debian9 --graphics none
> > > > --location=/linuxkvmaddgbdisk/kali-linux-2020.2-installer-amd64.iso
> > > > --extra-args="console=ttyS0
> > > >
> > > > --location
> my-unknown.iso,kernel=kernel/fookernel,initrd=kernel/fooinitrd
> > > >
> > > > --location
> > > > kali-linux-2020.2-installer-amd64.iso,kernel=kernel/?,initrd=kernel/?
> > > >
> > > > I did not find kali OS details to provide an option for*
> --os-variant=
> > > * When
> > > > I ran osinfo-query os | grep kali it did not return anything. What
> should
> > >
> > > There's over 500 Linux distros out there with the vast majority being
> just
> > > derivatives of the major distributions, so it requires someone who
> cares
> > > about
> > > a specific distro to contribute the required changes to libosinfo and
> > > commit to
> > > maintaining it to keep the information up to date.
> > >
> > > > be the value for --os-variant= as i want to install
> > > > kali-linux-2020.2-installer-amd64.iso (
> https://www.kali.org/downloads/)
> > > > using KVM virt-install tool
> > >
> > > For any practical purposes, Debian 10 should do just fine in terms of
> > > pulling
> > > the recommended VM settings from osinfo-db as Kali is derived from
> Debian.
> > >
> > > Regards,
> > > Erik
> > >
> > >
> > Hi Erik,
> >
> > Thanks Erik for the reply. I am running
> >
> > #virt-install --name=kalilinux --file=/linuxkvmaddgbdisk/kalilinux.img
> > --file-size=50 --nonsparse --vcpu=2 --ram=4096 --network=bridge:br0
> > --os-type=linux --os-variant=debian9 --graphics none
> > --location=/linuxkvmaddgbdisk/kali-linux-2020.2-installer-amd64.iso
> > --extra-args="console=ttyS0"
> >
> > Starting install...
> > Retrieving file .treeinfo...
> >
> >                               |    0 B  00:00:00
> > Retrieving file content...
> >
> >                               |    0 B  00:00:00
> > Retrieving file info...
> >
> >                              |  104 B  00:00:00
> > Retrieving file info...
> >
> >                              |  104 B  00:00:00
> > Retrieving file info...
> >
> >                              |  104 B  00:00:00
> > ERROR    Could not find an installable distribution at
> > '/linuxkvmaddgbdisk/kali-linux-2020.2-installer-amd64.iso': The URL could
> > not be accessed, maybe you mistyped?
> >
> > 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 kalilinux
> > otherwise, please restart your installation.
> >
> > #virt-install --accelerate --hvm --connect qemu:///system --cdrom
> > /linuxkvmaddgbdisk/kali-linux-2020.2-installer-amd64.iso --name kalilinux
> > --ram 4096 --disk path=/linuxkvmaddgbdisk/kalilinux.img,size=50
> > --os-variant debian9 --graphics none --os-type linux
> > --extra-args="console=ttyS0"
> > ERROR    --extra-args only work if specified with --location. See the man
> > page for examples of using --location with CDROM media
> >
> > I have pasted the output of the below command in
> http://sprunge.us/IdsF8Y
> >
> > #isoinfo -J -i kali-linux-2020.2-installer-amd64.iso
> >
> > I am not sure if I understand about --location
> >
> kali-linux-2020.2-installer-amd64.iso,kernel=kernel/*?*,initrd=kernel/*?* as
> > per the pastebin http://sprunge.us/IdsF8Y
>
> So based on this output the correct usage of --location should be
>
> --location
> kali-linux-2020.2-installer-amd64.iso,kernel=install.amd/vmlinuz,initrd=install.amd/initrd.gz
>
> Usually the names are vmlinuz for kernel and initrd for init ram disk.
>
> It looks like that in that ISO image there is another set of
> kernel+initrd:
>
>     install.amd/gtk/vmlinuz
>     install.amd/gtk/initrd.gz
>
> so I guess you need to try which one will work for you.
>
> For this specific reason virt-install need to have a file that will list
> where to look for kernel and initrd as you can see the paths are
> different for each distribution and sometimes even for different type of
> ISO images for the same distribution so it would be insane to cover all
> the possible cases. I would not be surprised if in some cases the file
> names would be completely different.
>
> Pavel
>
> > Any help will be highly appreciated and I look forward to hearing from
> you.
> > Please let me know if you need any additional details. Thanks in Advance.
> >
> > Best Regards,
> >
> > Kaushal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20200807/e4875a5b/attachment.htm>


More information about the libvirt-users mailing list