Help Setting Up Ubuntu Server To Run TVheadend


Recommended Posts

  • Replies 82
  • Created
  • Last Reply

Top Posters In This Topic

Access to the gui keeps dropping out.  Losing the love for VM's.....

 

Might be going back to the TVHeadend plugin and 14b soon.  I'll never get these last 2 lost days back  :(

 

I know that feeling.  Sorry I can't be more help, but I'm at work and been posting from my phone and using my VPN to access my own setup to look at things.

Link to comment

I can't be beaten by it......

 

Here's my PCI devices:

 

03:00.0 Multimedia controller: Digital Devices GmbH Octopus DVB Adapter

04:00.0 Multimedia video controller: Spin Master Ltd. Device 3038 (rev 01)

 

 

Here's my XML:

 

<domain type='kvm'>

  <name>Ubuntu Server</name>

  <uuid>104b7878-3b66-4037-afd0-107f3baf33b8</uuid>

  <memory unit='KiB'>2097152</memory>

  <currentMemory unit='KiB'>2097152</currentMemory>

  <memoryBacking>

    <nosharepages/>

    <locked/>

  </memoryBacking>

  <vcpu placement='static'>1</vcpu>

  <cputune>

    <vcpupin vcpu='0' cpuset='0'/>

  </cputune>

  <os>

    <type arch='x86_64' machine='pc-i440fx-2.2'>hvm</type>

  </os>

  <features>

    <acpi/>

    <apic/>

  </features>

  <cpu mode='host-passthrough'>

    <topology sockets='1' cores='1' threads='1'/>

  </cpu>

  <clock offset='utc'>

    <timer name='rtc' tickpolicy='catchup'/>

    <timer name='pit' tickpolicy='delay'/>

    <timer name='hpet' present='no'/>

  </clock>

  <on_poweroff>destroy</on_poweroff>

  <on_reboot>restart</on_reboot>

  <on_crash>restart</on_crash>

  <devices>

    <emulator>/usr/bin/qemu-system-x86_64</emulator>

    <disk type='file' device='disk'>

      <driver name='qemu' type='raw' cache='none' io='native'/>

      <source file='/mnt/cache/VM/Ubuntu Server/vdisk1.img'/>

      <target dev='hdc' bus='virtio'/>

      <boot order='1'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>

    </disk>

    <disk type='file' device='cdrom'>

      <driver name='qemu' type='raw'/>

      <source file='/mnt/user/Installation Media/ubuntu-14.04.2-server-i386.iso'/>

      <target dev='hda' bus='ide'/>

      <readonly/>

      <boot order='2'/>

      <address type='drive' controller='0' bus='0' target='0' unit='0'/>

    </disk>

    <controller type='usb' index='0'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>

    </controller>

    <controller type='pci' index='0' model='pci-root'/>

    <controller type='ide' index='0'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>

    </controller>

    <interface type='bridge'>

      <mac address='52:54:00:c9:b1:71'/>

      <source bridge='Bridge'/>

      <model type='virtio'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

    </interface>

    <serial type='pty'>

      <target port='0'/>

    </serial>

    <console type='pty'>

      <target type='serial' port='0'/>

    </console>

    <input type='tablet' bus='usb'/>

    <input type='mouse' bus='ps2'/>

    <input type='keyboard' bus='ps2'/>

    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0'>

      <listen type='address' address='0.0.0.0'/>

    </graphics>

    <video>

      <model type='vmvga' vram='16384' heads='1'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>

    </video>

    <hostdev mode='subsystem' type='pci' managed='yes'>

      <driver name='vfio'/>

      <source>

        <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>

      </source>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>

    </hostdev>

    <memballoon model='virtio'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>

    </memballoon>

  </devices>

</domain>

 

When I try and run the VM i get a green error message at the bottom of the screen.  It runs fine without the PCI passthrough changes.

 

Can somebody cleverer than me please take a look at my xml file and see if it needs changing?

 

Should I be doing something with the go or sys cfg files?

 

Thanks

Link to comment

this is my syslinux file:

 

default /syslinux/menu.c32

menu title Lime Technology

prompt 0

timeout 50

label unRAID OS

  menu default

  kernel /bzimage

  append pcie_acs_override=downstream initrd=/bzroot

label unRAID OS Safe Mode (no plugins)

  kernel /bzimage

  append initrd=/bzroot unraidsafemode

label Memtest86+

  kernel /memtest

label Xen/unRAID OS

  kernel /syslinux/mboot.c32

  append /xen --- /bzimage --- /bzroot

label Xen/unRAID OS Safe Mode (no plugins)

  kernel /syslinux/mboot.c32

  append /xen --- /bzimage --- /bzroot unraidsafemode

 

I added the "pcie_acs_override=downstream" as instructed by older forum posts.  Not sure if that was the right thing to do.

 

Link to comment

This is my go file:

 

#!/bin/bash

# Start the Management Utility

/usr/local/sbin/emhttp &

/usr/local/sbin/vfio-bind 0000:03:00.0 0000:04:00.0

 

I added the "/usr/local/sbin/vfio-bind 0000:03:00.0 0000:04:00.0" as per previous posts. Not sure that I should do this either.

 

Whatever I do I cannot pass the PCI devices through.  I dont know what else to try.

 

Any ideas please?

Link to comment

vfio-bind 0000:03:00.0 0000:04:00.0

 

I added the "/usr/local/sbin/vfio-bind 0000:03:00.0 0000:04:00.0" as per previous posts. Not sure that I should do this either.

 

Whatever I do I cannot pass the PCI devices through.  I dont know what else to try.

 

Any ideas please?

 

Also, per JonP in another thread, no longer use vfiobind, it isn't needed and likely causing issues.

 

*edit (thinking about it more)  - I suppose since this isn't well documented, maybe (?) you still need it to bind to vfio since what you are passing through isn't being configured through the VM tab (which would then work its magic, and not require the address to be bound).

Since that's the case and you are editing this yourself, maybe you do need it, I honestly can't say.

Link to comment

Change that top line, then add your device in the bottom line here.

<qemu:commandline>

      <qemu:arg value='-device'/>

      <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>

      <qemu:arg value='-device'/>

      <qemu:arg value='vfio-pci,host=0#:00.1,bus=pcie.0'/>/>

  </qemu:commandline>

 

This is an example, enter your device location, etc...as needed.

I have NO idea if you HAVE to have this part first prior to the device if not passing a GPU, I asked once and never got an answer.

 

<qemu:arg value='-device'/>

<qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>

 

Hopefully I am not making this worse on you..

 

Link to comment

My VM is in raw format and is stored on a SSD.

 

I think that the info for VM's is scattered all over the place and of all ages and relevance.  I don't really know if I should be changing the first line of my XML file if I'm not using qemu.  Should I be changing the XML field due to the raw format or SSD? Should I be changing my GO file?  Should I be changing my Syslinux file?

 

I have been from A to Z and back again for days.  I will be licking the windows soon. :P

 

Any pearls of wisdom?

 

Looks like I'm off back to 14b. Again......

Link to comment

Actually think this thread holds the answers for me:

 

https://lime-technology.com/forum/index.php?topic=38569.0

 

This thread I don't think is relevant..

 

I've been busy the last couple of days.  Got a few things to do today but I'll try and have a look and compare your XML with mine and see if anything springs to mind.  Will be easier as I'm on a proper PC rather than my Nexus 5!

Link to comment

Right I'm going to post my config as I know this works, just tested it on 6b15

 

Before you start, check the settings for PCIe ACS Override are as below.

EDIT: Apparently there may be some issues with PCIe ACS Override so ensure this is set to off, I haven't yet had chance to investigate with my own machine but the info comes from a very knowledgeable forum user.  I have also removed references to this in syslinux.cfg - the updated config is posted below.

 

EDIT2: Now had a chance to check this and the below config is working as far as I can tell.  There is no need to edit your syslinux.cfg and PCIe ACS Override should be set to off.  I have modified the text and pictures below so it is all current and correct as far as I understand things.

I can confirm this method works with beta14b and beta15

maBRK37.jpg

 

My syslinux.cfg - note this may been different for AMD CPUs

default /syslinux/menu.c32
menu title Lime Technology
prompt 0
timeout 50
label unRAID OS
  menu default
  kernel /bzimage
  append initrd=/bzroot
label unRAID OS Safe Mode (no plugins)
  kernel /bzimage
  append initrd=/bzroot unraidsafemode
label Memtest86+
  kernel /memtest
label Xen/unRAID OS
  kernel /syslinux/mboot.c32
  append /xen --- /bzimage --- /bzroot
label Xen/unRAID OS Safe Mode (no plugins)
  kernel /syslinux/mboot.c32
  append /xen --- /bzimage --- /bzroot unraidsafemode

 

My go file

#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &

 

lspci -knn (relevant bit only)

02:00.0 Multimedia controller [0480]: Philips Semiconductors SAA7160 [1131:7160] (rev 02)
        Subsystem: Device [6285:0001]

 

My VM setup page - Note my bridge setup maybe different to yours.

BUJsMqk.jpg

 

The resulting xml

<domain type='kvm' id='3'>
  <name>Test Argus</name>
  <uuid>a0fe523e-4438-9b12-43f3-4cbf048a442e</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.2'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='1' threads='1'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source file='/mnt/disk/KVM/VM/Test Argus/vdisk1.img'/>
      <backingStore/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/disk/KVM/Media/Win7AIO.iso'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <boot order='2'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/disk/KVM/Media/virtio-win-0.1-100.iso'/>
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:f5:0a:c6'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' websocket='5700' listen='0.0.0.0' keymap='en-gb'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vmvga' vram='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
</domain>

 

Now to add in my card I paste in my passthrough config..

 

Generically, the address is

aa:bb:c

So I need to paste into

 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0xaa' slot='0xbb' function='0xc'/>
      </source>
    </hostdev>

 

My Card's address is

02:00.0

Which becomes

 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
      </source>
    </hostdev>

 

This goes above these last two lines in your xml, ie in the devices section.

  </devices>
</domain>

 

Once you've pasted it in and saved it then you may notice two extra lines are added automatically.  This is the KVM assigning your passthrough card a slot on the virtual machine, so don't worry about that.  In my case that was

<alias name='hostdev0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>

 

So the relevant part becomes:

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>

 

Install the OS and boot up once it's completed, my device manager shows this:

CIFFnnR.jpg

 

Install my drivers:

QBEYosN.jpg

 

For completeness here's my finished xml, note that KVM manager does reorder things a little bit, the important thing to avoid errors is to paste it into the correct place to start with (above the last two lines)

<domain type='kvm' id='3'>
  <name>Test Argus</name>
  <uuid>a0fe523e-4438-9b12-43f3-4cbf048a442e</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.2'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='1' threads='1'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source file='/mnt/disk/KVM/VM/Test Argus/vdisk1.img'/>
      <backingStore/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/disk/KVM/Media/Win7AIO.iso'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <boot order='2'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/disk/KVM/Media/virtio-win-0.1-100.iso'/>
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:f5:0a:c6'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' websocket='5700' listen='0.0.0.0' keymap='en-gb'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vmvga' vram='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
</domain>

 

I know that's for Windows, but I'm more familiar with Windows, and I know what to expect to happen so it was easier for me to set it up from scratch on the new beta.  I will have a go with Ubuntu server but the only thing I think would be different is I'd leave Hyper-V off as that is Windows specific (Just checked - it's not even an option when operating system is set to Other.

Link to comment

Oh and if you're in the UK like myself then to make life a lot easier when you're using the keyboard.

 

Change

 

 <graphics type='vnc' port='5900' autoport='yes' websocket='5700' listen='0.0.0.0'>

 

And add in

 keymap='en-gb'

 

To become

<graphics type='vnc' port='-1' autoport='yes' websocket='5700' listen='0.0.0.0' keymap='en-gb'>

 

Otherwise it's as confusing as hell when you come to type stuff in!!  ::)

Link to comment

Oh monkeyair, just thought of another pitfall, make sure your tvheadend docker isn't autostarting, I've found that if Unraid tries to use the device I want to passthrough, either via a plugin or docker then it won't work in a VM until after a reboot.  That may be your problem.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.