On Thu, Dec 3, 2020 at 8:54 PM Erik Skultety <eskultet at redhat.com> wrote:> On Tue, Dec 01, 2020 at 06:15:55PM +0100, Michal Privoznik wrote: > > On 12/1/20 5:28 PM, Kaushal Shriyan wrote: > > > Hi, > > > > > > I have run the below command to install Kali Linux using > > > linux-2020.4-installer-amd64.iso from https://www.kali.org/downloads/ > > > > > > #virt-install --name kalilinux --memory 4096 --vcpus=2 > > > > --location=/linuxkvmaddgbdisk/kali-linux-2020.4-installer-amd64.iso,kernel=install.amd/gtk/vmlinuz,initrd=install.amd/gtk/initrd.gz > > > --network=bridge:br0 --os-type=linux --os-variant=debian9 > --graphics=none > > > --extra-args "console=ttyS0" -v --disk > > > path=/linuxkvmaddgbdisk/kalilinux.img,size=50 > > > > > > I am not able to get the root login prompt when I run the below > command to > > > set IP and hostname for the guest OS. Am I missing any parameters from > the > > > above virt-install command to install Kali Linux as Guest OS in KVM > > > Hypervisor? > > > > > > > Just a hunch, maybe --extra-args work only for installation and are not > > persistent? I guess installer doesn't persist kernel cmd line passed in > > Exactly, --extra-args is just for convenience of not having to edit the > kernel > cmdline manually when the serial console/GUI window opens with grub. > > Erik > >Hi Erik, Thanks for your reply. I am not sure if I completely understand it. Is there an issue in the below command? Do I need to remove --extra-args "console=ttyS0" in the below command to have ssh console access to the KVM Guest VM? Please suggest. #virt-install --name kalilinux --memory 4096 --vcpus=2 --location=/linuxkvmaddgbdisk/kali-linux-2020.4-installer-amd64.iso,kernel=install.amd/gtk/vmlinuz,initrd=install.amd/gtk/initrd.gz --network=bridge:br0 --os-type=linux --os-variant=debian9 --graphics=none --extra-args "console=ttyS0" -v --disk path=/linuxkvmaddgbdisk/kalilinux.img,size=50 I look forward to hearing from you. Thanks in Advance. Best Regards, Kaushal -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20201204/53c1c223/attachment.htm>
Michal Privoznik
2020-Dec-07 10:13 UTC
Installing Kali Linux as Guest OS in KVM Hypervisor
On 12/4/20 6:26 PM, Kaushal Shriyan wrote:> On Thu, Dec 3, 2020 at 8:54 PM Erik Skultety <eskultet at redhat.com> wrote: > >> On Tue, Dec 01, 2020 at 06:15:55PM +0100, Michal Privoznik wrote: >>> On 12/1/20 5:28 PM, Kaushal Shriyan wrote: >>>> Hi, >>>> >>>> I have run the below command to install Kali Linux using >>>> linux-2020.4-installer-amd64.iso from https://www.kali.org/downloads/ >>>> >>>> #virt-install --name kalilinux --memory 4096 --vcpus=2 >>>> >> --location=/linuxkvmaddgbdisk/kali-linux-2020.4-installer-amd64.iso,kernel=install.amd/gtk/vmlinuz,initrd=install.amd/gtk/initrd.gz >>>> --network=bridge:br0 --os-type=linux --os-variant=debian9 >> --graphics=none >>>> --extra-args "console=ttyS0" -v --disk >>>> path=/linuxkvmaddgbdisk/kalilinux.img,size=50 >>>> >>>> I am not able to get the root login prompt when I run the below >> command to >>>> set IP and hostname for the guest OS. Am I missing any parameters from >> the >>>> above virt-install command to install Kali Linux as Guest OS in KVM >>>> Hypervisor? >>>> >>> >>> Just a hunch, maybe --extra-args work only for installation and are not >>> persistent? I guess installer doesn't persist kernel cmd line passed in >> >> Exactly, --extra-args is just for convenience of not having to edit the >> kernel >> cmdline manually when the serial console/GUI window opens with grub. >> >> Erik >> >> > Hi Erik, > > Thanks for your reply. I am not sure if I completely understand it. Is > there an issue in the below command? Do I need to remove --extra-args > "console=ttyS0" in the below command to have ssh console access to the KVM > Guest VM? Please suggest. > > #virt-install --name kalilinux --memory 4096 --vcpus=2 > --location=/linuxkvmaddgbdisk/kali-linux-2020.4-installer-amd64.iso,kernel=install.amd/gtk/vmlinuz,initrd=install.amd/gtk/initrd.gz > --network=bridge:br0 --os-type=linux --os-variant=debian9 --graphics=none > --extra-args "console=ttyS0" -v --disk > path=/linuxkvmaddgbdisk/kalilinux.img,size=50 > > I look forward to hearing from you. Thanks in Advance.For accessing your guest via SSH you do not need a serial console. SSH works over network, not serial consoles. And those --extra-args: just take virtualization out of the picture for a second. You bought yourself a new desktop and want to install a distro onto it. You plug an USB stick in and as the installer boots you change the kernel cmd line. Then you proceed with installing the distro. I don't think that the installer will copy those extra kernel args you added into the freshly installed grub, why would it? Therefore, when you want to have some extra args after the installation, you have to edit the guest. Since at this point you are not booting kernel directly, libvirt/qemu can't help you and you need to hand edit grub config in the guest. And in this specific case, there is an alternative approach - editing /etc/inittab so that the init enables serial console. Then again, you do NOT need serial console for SSH. But what may come handy is NSS module: https://libvirt.org/nss.html so that you can just: ssh user at guest Michal