PVE Adopt a KVM Ubuntu Guest: Difference between revisions

From WikiMLT
m (Text replacement - "QEMU/KVM and GPU Passthrough to Windows VM" to "QEMU/KVM and GPU Passthrough in Details")
 
Line 15: Line 15:
Setup the guest VM as it is shown at {{Media-cite|v|1}}. We will not perform a clean installation but will import a KVM image with Ubuntu Desktop 20.04. So after the creation of the VM we have to do few more steps before start it. UEFI BIOS is recommended for GPU passthrough at all, so we will use it.
Setup the guest VM as it is shown at {{Media-cite|v|1}}. We will not perform a clean installation but will import a KVM image with Ubuntu Desktop 20.04. So after the creation of the VM we have to do few more steps before start it. UEFI BIOS is recommended for GPU passthrough at all, so we will use it.


''How to isolate the GPU, at the PVM host's side, to be ready for passthrough is described in the article [[PVE IOMMU Isolation for Passthrough]] and move details are provided in the article [[QEMU/KVM and GPU Passthrough to Windows VM]].''
''How to isolate the GPU, at the PVM host's side, to be ready for passthrough is described in the article [[PVE IOMMU Isolation for Passthrough]] and move details are provided in the article [[QEMU/KVM and GPU Passthrough in Details]].''


The disk image created at {{Media-cite|v|1}} has been deleted - let's remembered we will import an existing KVM Image - but with this approach we've reserved the name <code>vm-205-disk-0</code> for the primary VM's image. The CPU type <code>host</code> is important to allow virtualization at the guest side.
The disk image created at {{Media-cite|v|1}} has been deleted - let's remembered we will import an existing KVM Image - but with this approach we've reserved the name <code>vm-205-disk-0</code> for the primary VM's image. The CPU type <code>host</code> is important to allow virtualization at the guest side.

Latest revision as of 10:18, 1 September 2022

Set­up the Vir­tu­al Ma­chine

Video 1. Setup Proxmox VM for Ubuntu Desktop 20.04 guest imported from KVM with GPU passthrough ready setup.
Video 1. Set­up Prox­mox VM for Ubun­tu Desk­top 20.04 guest im­port­ed from KVM with GPU passthrough ready set­up.

Set­up the guest VM as it is shown at Video 1. We will not per­form a clean in­stal­la­tion but will im­port a KVM im­age with Ubun­tu Desk­top 20.04. So af­ter the cre­ation of the VM we have to do few more steps be­fore start it. UE­FI BIOS is rec­om­mend­ed for GPU passthrough at all, so we will use it.

How to iso­late the GPU, at the PVM host's side, to be ready for passthrough is de­scribed in the ar­ti­cle PVE IOM­MU Iso­la­tion for Passthrough and move de­tails are pro­vid­ed in the ar­ti­cle QEMU/KVM and GPU Passthrough in De­tails.

The disk im­age cre­at­ed at Video 1 has been delet­ed – let's re­mem­bered we will im­port an ex­ist­ing KVM Im­age – but with this ap­proach we've re­served the name vm-205-disk‑0 for the pri­ma­ry VM's im­age. The CPU type host is im­por­tant to al­low vir­tu­al­iza­tion at the guest side.

Con­vert the KVM Im­age in­to a Prox­mox Im­age

Cre­ate an new VM on Prox­mox VE (al­ready done) and add the ex­ist­ing disk im­age to this new VM (this step), set the boot or­der and start source.

qm importdisk 215 Ubuntu.20.04.img local-lvm
importing disk 'Windows.11.img' to VM 205 ...
  Logical volume "vm-215-disk-0" created.
    ...this takes a while...
transferred 40.0 GiB of 40.0 GiB (100.00%)
Successfully imported disk as 'unused0:local-lvm:vm-215-disk-0'

In the above com­mand:

  • 215 is the id of the VM.
  • Ubuntu.20.04.img is the im­age that was cre­at­ed be­fore.
  • lo­cal-lvm is the name of a stor­age as list­ed in pvesm sta­tus.

qm im­port­disk adds the im­age as un­used disk to the vir­tu­al ma­chine. Thus, mak­ing it the boot disk is still nec­es­sary.

qm set 215 --scsi0 local-lvm:vm-215-disk-0
update VM 215: -scsi0 local-lvm:vm-215-disk-0

Fine tun­ing of the Con­fig­u­ra­tion file

Mod­i­fy and add the lines marked in the above snip­pet. Note 215 is the id of the vir­tu­al ma­chine. When the file is saved the rel­e­vant changes will be au­to­mat­i­cal­ly ap­plied and up­dat­ed with­in the Proxmox's WEB GUI.

nano /etc/pve/qemu-server/215.conf
agent: 1,fstrim_cloned_disks=1
args: -cpu 'host,+kvm_pv_unhalt,+kvm_pv_eoi,hv_vendor_id=NV43FIX,kvm=off'
bios: ovmf
boot: order=scsi0
cores: 4
cpu: host,hidden=1,flags=+pcid
efidisk0: local-lvm:vm-215-disk-1,efitype=4m,pre-enrolled-keys=1,size=4M
ide2: none,media=cdrom
localtime: 0
machine: q35
memory: 4096
meta: creation-qemu=6.1.0,ctime=1647425960
name: Ubuntu.Desktop
net0: virtio=06:3D:E1:07:6A:0C,bridge=vmbr0,firewall=1
numa: 0
ostype: l26
scsi0: local-lvm:vm-215-disk-0,discard=on,size=40G,ssd=1
scsihw: virtio-scsi-pci
smbios1: uuid=d0ce2cb6-9c80-43e2-b79b-a07099b916e3
sockets: 1
vmgenid: 2c862f80-6be7-41e7-b523-5abfe21f0fef

Ref­er­ences