Virtualizing Kodi - any tips?
#1
So I virtualized Kodi 16.1 on a VM (Proxmox 4.2) with a GT 710 video card pass-through'd on Ubuntu 16.04 LTS. It works for the most part, but there are some minor issues that I've run into:

1. Audio gets "stuck" repeating sound. I did some changes and it seems to be ok when I reboot or start fresh, but it seems to be hit or miss when turning the TV on. Along the same lines, it happens 100% of the time if I have "adjust refresh rate" checked to force the TV to play at 24p (movies for example). Initially it would play at 2x the speed with no sound, now I got it to play at the correct speed (-ish, stats show 23.971 instead of 23.976) but the audio is either muted or stuck on repeating a very small clip of audio. If I turn that feature off and let everything play at 60hz I don't have any issue. Once it gets stuck doing that, the only way I can fix it is rebooting or shutting down and starting back up. I've tried force-reloading alsa via command line but that doesn't help.

2. CPU usage: Xorg uses about 30-40% CPU usage idling in Kodi. Seems a little high.

3. Issues with IR: So I have an Inteset 4-1 remote with an external USB IR receiver. I'm passing-through the USB IR receiver to the VM through a USB hub. I have an HDMI extender which allows me to pass HDMI and IR over CAT6, which works great because my server is in the office and the TV in question is in the bedroom. The remote and everything works, but dmesg shows a ton of
Code:
mceusb 1-2:1.0: Error: urb status = -32
. It doesn't seem to affect usage because I can use the remote just fine.

Aside from that, I'm rather happy that it works for the most part.

Image
Reply
#2
I'm sorry that I can't provide any help but I wanted to bump this thread because I am also interested in virtualizing Kodi with the same setup as you (Proxmox, NVidia card, etc).

Did you try using a Windows OS to see if it performs the same way?
Reply
#3
I haven't tried yet. All of my Kodi boxes that I've had are Linux so that's what I'm familiar with.

So here's what I have in terms of config:

Hardware:
Code:
Supermicro X8DT6
2x Intel X5660
48GB DDR3 ECC
MSI GT 710 (PCI-E X8 card GT-710-1GD3H-LPV1)
4 port USB hub (Amazon: B00JX1ZS5O)
Inteset INT-422 remote with external USB IR receiver


Proxmox packages

Code:
proxmox-ve: 4.2-64 (running kernel: 4.4.16-1-pve)
pve-manager: 4.2-18 (running version: 4.2-18/158720b9)
pve-kernel-4.4.16-1-pve: 4.4.16-64
lvm2: 2.02.116-pve3
corosync-pve: 2.4.0-1
libqb0: 1.0-1
pve-cluster: 4.0-44
qemu-server: 4.0-86
pve-firmware: 1.1-9
libpve-common-perl: 4.0-72
libpve-access-control: 4.0-19
libpve-storage-perl: 4.0-57
pve-libspice-server1: 0.12.8-1
vncterm: 1.2-1
pve-qemu-kvm: 2.6.1-2
pve-container: 1.0-73
pve-firewall: 2.0-29
pve-ha-manager: 1.0-33
ksm-control-daemon: 1.2-1
glusterfs-client: 3.5.2-2+deb8u2
lxc-pve: 2.0.4-1
lxcfs: 2.0.3-pve1
cgmanager: 0.39-pve1
criu: 1.6.0-1
novnc-pve: 0.5-8
fence-agents-pve: not correctly installed

.conf for the vm
Code:
#Bedroom HTPC
bios: ovmf
boot: cdn
bootdisk: scsi0
cores: 2
cpu: host
cpuunits: 10000
hostpci0: 05:00.0,pcie=1,x-vga=on #GT 710
hostpci1: 05:00.1,pcie=1 #GT 710 audio
ide2: none,media=cdrom
machine: q35
memory: 4096
name: htpc1-bdrm
net0: virtio=C2:14:0A:6F:32:4E,bridge=vmbr45
numa: 1
ostype: l26
scsi0: VM-Storage1:vm-121-disk-1,size=30G
scsihw: virtio-scsi-pci
smbios1: uuid=029a8a12-2fd5-41c2-b7a3-2a708d662dbd
sockets: 1
usb0: host=2-1.1 #USB IR
usb1: host=2-1.2 #USB keyboard
usb2: host=2-1.3 #USB mouse

/etc/modprobe.d/vfio.conf

Code:
options vfio-pci ids=10de:128b,10de:0e0f disable_vga=1

/etc/modprobe.d/blacklist.conf
Code:
blacklist nvidia
blacklist nouveau

/etc/modprobe.d/iommu_unsafe_interrupts.conf
Code:
options vfio_iommu_type1 allow_unsafe_interrupts=1

In no particular order, some things that I noted:

1. My reading suggests that using a video card with a UEFI BIOS makes this a lot easier. If I'm not mistaken every nVidia card since the 700 series has to have one. I've read that some don't come with it and you have to contact the manufacturer to give it to you.

2. Physical slot placement of the video card is important. I first tried in the video card in PCI-E slot 7 on my motherboard, but when I'd turn on the VM it wouldn't start, and I also lost both my onboard NICs until I rebooted the server. I had to move it to slot 3 to get it to work.

3. After installing Ubuntu and restarting, I was dropped into a UEFI shell instead of booting into the OS. To fix this, boot into a shell from a live cd, and do this:
Code:
cp /boot/efi/EFI/ubuntu/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI
Should boot as normal.

4. Video: Tearing seems to be a common theme with nVidia cards, very noticeable during action scenes or scrolling through the Kodi menu at a fast pace. Consider making a script to start on login:
Code:
touch /etc/profile.d/Tearingfix.sh
### inside the script
export __GL_YIELD="USLEEP"
/usr/bin/nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On} "
###
chmod +x /etc/profile.d/Tearingfix.sh
This works for me currently using 375.20 drivers.

5. The HDMI audio was not the default audio driver. I downloaded pavucontrol: go all the way to the farthest right tab and select the proper audio device, and click the default audio driver. Additionally I also created an /etc/asound.conf:
Code:
defaults.pcm.card 1
defaults.ctl.card 1
Other wise alsamixer wouldn't work without using "alsamixer -c 1" argument. Also, /home/[user]/.asoundrc:
Code:
pcm.!default {
  type plug;
  slave.pcm "hdmi:CARD=NVidia,DEV=1";
}

6. I did upgrade the kernel (guest VM) to see if it would fix some error messages
Code:
Linux 4.7.6-040706-generic
Not sure if it has made a difference either way.
Reply
#4
I know people are virtualizing the LibreELEC Generic build using unraid and other software to do GPU pass through. Might be something to look into.
"PPC is too slow, your CPU has no balls to handle HD content." ~ Davilla
"Maybe it's a toaster. Who knows, but it has nothing to do with us." ~ Ned Scott
Reply
#5
I had a VMware setup which was fine and stable most of the time....

Was passing through AMD cards and using Ubuntu as the VM's OS....

Biggest issue was getting video drivers on to the VM and then a random driver update breaking everything!

It's a good idea in principal but a lot of effort to maintain or at least I felt it was.... maybe with librelec instead of Ubuntu it would be easier
Reply
#6
Hi all -

Fingers crossed, after some tweaking and playing around with it, it seems a simple config change on the VM.conf file fixed this issue.
  • pcie=1 removed from hostpci0
  • machine: q35 #removed as it's not needed without pcie=1 above

Code:
balloon: 0
bios: ovmf
boot: cd
bootdisk: scsi0
cores: 2
cpu: host
hostpci0: 06:00,x-vga=on
hotplug: disk,network,usb
ide2: none,media=cdrom
keyboard: en-us
memory: 4096
name: htpc1-bdrm
net0: virtio=C2:14:0A:6F:32:4E,bridge=vmbr45
numa: 1
ostype: l26
scsi0: VM-Storage1:vm-121-disk-1,size=30G
scsihw: virtio-scsi-pci
smbios1: uuid=029a8a12-2fd5-41c2-b7a3-2a708d662dbd
sockets: 1
tablet: 0
usb0: host=6-2
usb1: host=6-1.1
usb2: host=6-1.2
Reply
#7
I recorded a quick and dirty video from my phone. Excuse the mess in the bedroom lol

Reply
#8
best unraid - you can create virtual OE/LE with GPU passthrough with 3 button clicks Wink

step 1 choose template:
https://www.dropbox.com/s/uzkdnntgiz3jc9...8.png?dl=0

step 2 - choose devices which you want map and setting
https://www.dropbox.com/s/igekdnx5kzpshb...9.png?dl=0

step 3 - run ! and enjoy Smile

ps. for this issue "1. Audio gets "stuck" repeating sound" just enable MSI for intel-snd Wink that tipical for NVIDIA in VMs
https://github.com/eschultz/OpenELEC.tv/...202c296fc5
Reply
#9
(2016-12-04, 15:57)Daemaz Wrote: So I virtualized Kodi 16.1 on a VM (Proxmox 4.2) with a GT 710 video card pass-through'd on Ubuntu 16.04 LTS. It works for the most part, but there are some minor issues that I've run into:

1. Audio gets "stuck" repeating sound. I did some changes and it seems to be ok when I reboot or start fresh, but it seems to be hit or miss when turning the TV on. Along the same lines, it happens 100% of the time if I have "adjust refresh rate" checked to force the TV to play at 24p (movies for example). Initially it would play at 2x the speed with no sound, now I got it to play at the correct speed (-ish, stats show 23.971 instead of 23.976) but the audio is either muted or stuck on repeating a very small clip of audio. If I turn that feature off and let everything play at 60hz I don't have any issue. Once it gets stuck doing that, the only way I can fix it is rebooting or shutting down and starting back up. I've tried force-reloading alsa via command line but that doesn't help.

2. CPU usage: Xorg uses about 30-40% CPU usage idling in Kodi. Seems a little high.

3. Issues with IR: So I have an Inteset 4-1 remote with an external USB IR receiver. I'm passing-through the USB IR receiver to the VM through a USB hub. I have an HDMI extender which allows me to pass HDMI and IR over CAT6, which works great because my server is in the office and the TV in question is in the bedroom. The remote and everything works, but dmesg shows a ton of
Code:
mceusb 1-2:1.0: Error: urb status = -32
. It doesn't seem to affect usage because I can use the remote just fine.

Aside from that, I'm rather happy that it works for the most part.

Image

Where did you get the J-Tech Digital? I can't find them anywhere, is it on Newegg? It doesn't show up.





--
I'm passionate about Kodi and setting them up on the Amazon Fire TV Stick: http://mytrendexpert.com/2016/12/17/amazon-fire-stick/
Reply
#10
(2016-12-18, 04:35)piotrasd Wrote: best unraid - you can create virtual OE/LE with GPU passthrough with 3 button clicks Wink

step 1 choose template:
https://www.dropbox.com/s/uzkdnntgiz3jc9...8.png?dl=0

step 2 - choose devices which you want map and setting
https://www.dropbox.com/s/igekdnx5kzpshb...9.png?dl=0

step 3 - run ! and enjoy Smile

ps. for this issue "1. Audio gets "stuck" repeating sound" just enable MSI for intel-snd Wink that tipical for NVIDIA in VMs
https://github.com/eschultz/OpenELEC.tv/...202c296fc5

MSI mode was enabled by default, just for some reason it prefers the i440fx model vs the q35 to get the sound to work consistently.

(2016-12-21, 06:09)mediastreamerpr0 Wrote: Where did you get the J-Tech Digital? I can't find them anywhere, is it on Newegg? It doesn't show up.

Amazon link
Reply
#11
i was using q35 without problem about this MSI be sure if for that module is enable snd-hda-intel.

many users has same problem with q35 and Nvidia after that tweek problem gone Wink
Reply

Logout Mark Read Team Forum Stats Members Help
Virtualizing Kodi - any tips?0