QEMU/KVM on ThinkPad X230T Laptop with Dual-boot: Difference between revisions

From WikiMLT
Line 7: Line 7:
</syntaxhighlight>
</syntaxhighlight>
== Install QEMU, KVM, LIBVIRT ==
== Install QEMU, KVM, LIBVIRT ==
<syntaxhighlight lang="shell" line="1">
Within the older versions of Debian based OS, [[QEMU/KVM and GPU Passthrough to Windows VM#Install QEMU, KVM, LIBVIRT|like as Ubuntu 20.04]], we was in need to install the packages <code>qemu qemu-kvm</code>, but in mot recent operating systems as Kali 2022 we need to install <code>qemu-system-x86</code> instead.<syntaxhighlight lang="shell" line="1">
sudo apt install qemu-system-x86 libvirt-daemon libvirt-clients bridge-utils virt-manager virtinst libosinfo-bin ovmf remmina
sudo apt install qemu-system-x86 libvirt-daemon libvirt-clients bridge-utils virt-manager virtinst libosinfo-bin ovmf remmina
</syntaxhighlight>To get rid of the password dialogue - ''"System policy prevents management of local virtualization systems"'' - I've added my Linux user to the <code>libvirt</code> group.<syntaxhighlight lang="shell" line="1">
</syntaxhighlight>In order to get rid of the password dialogue for <code>virt-manager</code> - ''"System policy prevents management of local virtualization systems"'' - I've added my Linux user to the <code>libvirt</code> group.<syntaxhighlight lang="shell" line="1">
sudo usermod -aG libvirt $USER
sudo usermod -aG libvirt $USER
</syntaxhighlight>
</syntaxhighlight>
Line 25: Line 25:


In most how-to manuals they propose to use <code><target dev="vdX" bus="virtio"/></code>, but it is not possible to use <code>virtio</code> while there is not driver installed within the Windows 10 OS. So you need to install the driver first... or during the installation of Windows if it is new installation.
In most how-to manuals they propose to use <code><target dev="vdX" bus="virtio"/></code>, but it is not possible to use <code>virtio</code> while there is not driver installed within the Windows 10 OS. So you need to install the driver first... or during the installation of Windows if it is new installation.
== Install the guest tools ==
== Install the guest tools ==
The final step of the setup is installing the [[QEMU/KVM Guest tools#Windows Guest tools|QEMU/KVM Guest tools for Windows]], thus the screen will be automatically resized within the SPICE client of <code>virt-manager</code>.
The final step of the setup is installing the [[QEMU/KVM Guest tools#Windows Guest tools|QEMU/KVM Guest tools for Windows]], thus the screen will be automatically resized within the SPICE client of <code>virt-manager</code>.
== The final configuration of the VM ==


== References ==
== References ==

Revision as of 09:39, 13 August 2022

I was in need to ac­cess Win­dows 10 from Kali Lin­ux on my dual boot­ed Leno­vo ThinkPad X230T de­vice. So here are the things I've done to achieve that.

Test the Vir­tu­al­iza­tion Ca­pa­bil­i­ties of the Sys­tem

Check weath­er the sys­tem sup­ports vir­tu­al­iza­tion and it is en­abled via the BIOS. The fol­low­ing com­mand must re­turn at least 1:

egrep -c '(vmx|svm)' /proc/cpuinfo

In­stall QE­MU, KVM, LIB­VIRT

With­in the old­er ver­sions of De­bian based OS, like as Ubun­tu 20.04, we was in need to in­stall the pack­ages qe­mu qe­mu-kvm, but in mot re­cent op­er­at­ing sys­tems as Kali 2022 we need to in­stall qe­mu-sys­tem-x86 in­stead.

sudo apt install qemu-system-x86 libvirt-daemon libvirt-clients bridge-utils virt-manager virtinst libosinfo-bin ovmf remmina

In or­der to get rid of the pass­word di­a­logue for virt-man­ag­er"Sys­tem pol­i­cy pre­vents man­age­ment of lo­cal vir­tu­al­iza­tion sys­tems" – I've added my Lin­ux user to the lib­virt group.

sudo usermod -aG libvirt $USER

Set­up the vir­tu­al ma­chine

The set­up of the vir­tu­al ma­chine is done via the virt-man­ag­er GUI. The first "spe­cial" thing ac­cord­ing to my set­up is that both op­er­at­ing sys­tems are in­stalled in UE­FI mode, so the vir­tu­al ma­chine should be UE­FI too. In or­der to pass-through the phys­i­cal SSD/HDD you need to do set­up ad fol­low.

<disk type="block" device="disk">
  <driver name="qemu" type="raw" cache="none" discard="unmap"/>
  <source dev="/dev/sda"/>
  <target dev="sda" bus="sata"/>
  <address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>

Note you don't need to type the 5th line if your us­ing virt-man­ag­er to ed­it the XML en­try for the dri­ve – it will be gen­er­at­ed au­to­mat­i­cal­ly on save.

In most how-to man­u­als they pro­pose to use <tar­get dev="vdX" bus="virtio"/>, but it is not pos­si­ble to use vir­tio while there is not dri­ver in­stalled with­in the Win­dows 10 OS. So you need to in­stall the dri­ver first… or dur­ing the in­stal­la­tion of Win­dows if it is new in­stal­la­tion.

In­stall the guest tools

The fi­nal step of the set­up is in­stalling the QEMU/KVM Guest tools for Win­dows, thus the screen will be au­to­mat­i­cal­ly re­sized with­in the SPICE client of virt-man­ag­er.

The fi­nal con­fig­u­ra­tion of the VM

Ref­er­ences