This article is the third in a series of five articles dealing with the installation and configuration of VMs (Linux, Windows, macOS and BSD) in PCI Passthrough on Proxmox VE 8.
Creating our Debian VM
We start by creating our VM:
A few details on the QEMU configuration applied:
- Part 0-4 PCI/GPU Passthrough on Proxmox VE Installation and Setup (Part. 00x04)
- Part 1-4 PCI/GPU Passthrough on Proxmox VE: Windows 10.11 ( Part.01x04)
- Part 2-4 PCI/GPU Passthrough on Proxmox VE: Debian 12 (Part. 02x04)
- Part 3-4 PCI/GPU Passthrough on Proxmox VE: OpenBSD 7.3 (Part. 03x04)
- Part 4-4 PCI/GPU Passthrough on Proxmox VE: macOS (Part. 04x04 )
Creating our Debian VM
We start by creating our VM:
Code:
qm create 106 \
--name deb-106\
--agent 1\
--memory 8192\
--bios ovmf\
--sockets 1 --cores 4\
--cpu host\
--net0 virtio,bridge=vmbr0\
--scsihw virtio-scsi-single\
--boot order='scsi0'\
--efidisk0 local-lvm:0\
--ide0 local-lvm:cloudinit\
--machine q35\
--hostpci0 0000:01:00,pcie=1,x-vga=1 \
--serial0 socket\
--vga serial0\
--usb0 046d:c08b,usb3=1\
--usb1 04ca:007d,usb3=1
- ide0 local-btrfs:cloudinit This is our Cloud-init disk.
- boot order=‘scsi0’ In the boot order, I defined our future Debian image, in first position (we will see later how to add it to this config).
- hostpci0 0000:01:00,pcie=1,x-vga=1 the PCI slot of our graphics card.
- vga serial0 and serial0 socket set default display to serial console output (default configuration for cloud init).
- usb0 and usb0: correspond to the USB id's of my keyboard and my mouse, which I retrieved from the hypervisor with ”lsusb”.
Importing the Debian image for our VM
Let's get our Debian cloud image, it's the "generic" we need:
We add our disk image in our QEMU configurationCode:wget -P /mnt/pve/PVE1/template/iso/ https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2
We take the opportunity to resize our disk, just to have enough space to install all the packages:Code:qm set 106 --scsi0 local-lvm:0,import-from=/mnt/pve/PVE1/template/iso/debian-12-generic-amd64.qcow2
Customizing our Debian imageCode:qm resize 106 scsi0 50G
Now we can move on to editing our configuration file, to adapt our Debian image.
Indeed, the image does not have a GUI, moreover, it also does not have the necessary AMD drivers for my RX 580. To do this, we will first have to add, new entries to apt sources “contrib, non-free and non-free-firmware” we will then define the additional packages to install.
In my case I will store my config file in "/mnt/pve/PVE1/snippets", but that's because I have an NFS mount point to my NAS. In your case the path should be “/var/lib/vz/snippets”.
In addition to our configuration file, we will additionally define the type of IP assignment (dhcp in my case since I want to make desktop use of it, a static IP does not interest me).Code:cat << EOF >> /mnt/pve/PVE1/snippets/deb12.yaml #cloud-config write_files: - path: /etc/apt/sources.list.d/non-free-contrib.list happy: | deb http://deb.debian.org/debian/bookworm main contrib non-free non-free-firmware deb-src http://deb.debian.org/debian/bookworm main contrib non-free non-free-firmware deb http://security.debian.org/bookworm-security main contrib non-free non-free-firmware deb-src http://security.debian.org/bookworm-security main contrib non-free non-free-firmware deb http://deb.debian.org/debian/bookworm-updates main contrib non-free non-free-firmware deb-src http://deb.debian.org/debian/bookworm-updates main contrib non-free non-free-firmware package_update: true package_upgrade: true packages: - qemu-guest-agent - vim - net-tools - htop -screen -tree - gnome-core - xserver-xorg-video-amdgpu - firmware-amd-graphics - libgl1-mesa-dri - libglx-mesa0 - mesa-vulkan-drivers -xserver-xorg-video-all runcmd: - systemctl enable qemu-guest-agent - systemctl start qemu-guest-agent - mkdir -p /etc/skel/Documents - mkdir -p /etc/skel/Images - mkdir -p /etc/skel/Videos - mkdir -p /etc/skel/Downloads - mkdir -p /etc/skel/Skeles - echo 'SKEL=/etc/skel' >> /etc/adduser.conf bootcmd: -userdel -r -f debian EOF
In your case, for the last command, use (default snippets path) instead:Code:qm set 106 --ipconfig0 ip=dhcp qm set 106 --cicustom "vendor=PVE1:snippets/deb12.yaml"
First setupCode:qm set 106 --cicustom "vendor=local:snippets/deb12.yaml"
We launch the installation/configuration of the VM:
At the first start our VM will install all the necessary packages, you can check this from the proxmox console. Once you have control of the console again, you can directly shut down the VM and delete the obsolete entries in the QEMU configuration.Code:qm start 106
Conversion to template and deploymentCode:qm shutdown 106 qm set 106 --vga none qm set 106 --delete serial0
It's almost finished, we now move on to converting our freshly configured VM into a template:
Now all you have to do is clone your Debian template, and define your user.Code:qm template 106
Setting cloud-init parameters:Code:qm clone 106 107 --full 1 --name deb-107
You can also go through the proxmox web interface to configure Cloud-init. Click on the new virtual machine you created, go to the Cloud-Init tab and then pass your settings and that's it! You can start your new virtual machine.Code:qm set 107 --ciuser USER --cipassword PASSWORD
My original Article (FR) : GPU passtrought sous Proxmox VE - Debian 12 (Part. 02x04)