[SOLVED] WinTV Quad HD (DVB-T2 tuner) not working ubuntu 20.04 in linux container (lxc) on proxmox

piddy

Member
Feb 13, 2021
14
3
8
45
I can't get my WinTV Quad HD terrestrial TV tuner (DVB-T2) to show up in a linux container (lxc) running ubuntu 20.04 (with Plex installed)

System is:
Proxmox version: PVE 6.4-4
Ubuntu in linux container: 20.04
Motherboard: AS Rock ROMED8-2T
CPU: EPYC 7262
RAM: 24GB
Expansion cards:
- 2 x HBA LSI SAS2008 (cross flashed LSI 9240-8i)
- nVidia GTX 1050Ti
- WinTV Quad HD DVB-T2 tuner

the tuner card shows up in the output from 'lspci -v', when I run it in the host and the lxc (output is the same from both, which is what I expected from reading up on how lxc's access the PCIe... excerpt below:

...

83:00.0 Multimedia video controller: Conexant Systems, Inc. CX23887/8 PCIe Broadcast Audio and Video Decoder with 3D Comb (rev 04)
Subsystem: Hauppauge computer works Inc. CX23887/8 PCIe Broadcast Audio and Video Decoder with 3D Comb
Flags: bus master, fast devsel, latency 0, IRQ 198, NUMA node 0
Memory at b1400000 (64-bit, non-prefetchable) [size=2M]
Capabilities: [40] Express Endpoint, MSI 00
Capabilities: [80] Power Management version 3
Capabilities: [90] Vital Product Data
Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [100] Advanced Error Reporting
Capabilities: [200] Virtual Channel
Kernel driver in use: cx23885

84:00.0 Multimedia video controller: Conexant Systems, Inc. CX23887/8 PCIe Broadcast Audio and Video Decoder with 3D Comb (rev 04)
Subsystem: Hauppauge computer works Inc. CX23887/8 PCIe Broadcast Audio and Video Decoder with 3D Comb
Flags: bus master, fast devsel, latency 0, IRQ 201, NUMA node 0
Memory at b1200000 (64-bit, non-prefetchable) [size=2M]
Capabilities: [40] Express Endpoint, MSI 00
Capabilities: [80] Power Management version 3
Capabilities: [90] Vital Product Data
Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [100] Advanced Error Reporting
Capabilities: [200] Virtual Channel
Kernel driver in use: cx23885

...

Following installation instructions here (https://hauppauge.com/pages/support/support_linux.html). I've run the following in the guest lxc:

apt install software-properties-common
add-apt-repository ppa:b-rad/kernel+mediatree+hauppauge
apt update
apt install linux-mediatree
apt install linux-firmware-hauppauge
reboot now

Logging back into the guest lxc ('lxc-attach [INSERT_LXC_ID]'), I then tested whether the tuner card was visible to the operating system with:

apt install w-scan
w_scan -X -c GB

... which generated the error ...

w_scan version 20170107 (compiled for DVB API 5.10)
using settings for UNITED KINGDOM
DVB aerial
DVB-T GB
scan type TERRESTRIAL, channellist 6
output format czap/tzap/szap/xine
WARNING: could not guess your codepage. Falling back to 'UTF-8'
output charset 'UTF-8', use -C <charset> to override
Info: using DVB adapter auto detection.
main:4007: FATAL: ***** NO USEABLE TERRESTRIAL CARD FOUND. *****
Please check wether dvb driver is loaded and
verify that no dvb application (i.e. vdr) is running.

Any idea what's going on?
 
Please show your container configuration (from /etc/pve/lxc/). For a container, you don't use PCI but you pass the relevant dev files and/or directories.
I have a WinTV DualHD visible in MythTV in a unprivileged Ubuntu container by adding:
lxc.cgroup.devices.allow: c 212:* rwm lxc.mount.entry: /dev/dvb dev/dvb none bind,create=dir 0 0
and the necessary lxc.idmap to match the video group of the container to the video group of the host (and some lines in /etc/subuid and /etc/subgid).
 
  • Like
Reactions: piddy
@avw thanks for the quick response.

Below is what's in the /etc/pve/lxc/[LXC_ID].conf file (it's an unprivileged container like yours):

arch: amd64
cores: 8
cpulimit: 8
hostname: plex
memory: 8192
mp0: /mnt/mammoth/video,mp=/mnt/video
net0: name=eth0,bridge=vmbr0,firewall=1,gw=192.168.2.1,hwaddr=[MAC_ADDRESS]$
onboot: 1
ostype: ubuntu
rootfs: vms_and_isos:100/vm-100-disk-0.raw,size=20G
swap: 8192

... so I just need to add the following two lines?..

'lxc.cgroup.devices.allow: c [MAJOR_NUMBER]:* rwm'
'lxc.mount.entry: /dev/dvb dev/dvb none bind,create=dir 0 0'

and a third?..

'lxc.idmap g '

How do I find out the major number ([MAJOR_NUMBER] above)? I can't find the tuner in my /dev/ directory.

'ls -l /dev' on the host yields nothing similar to /dev/dvb

... also when it comes to the config file line 'lxc.idmap' - my host doesn't currently have a 'video' group.
 
You'll need to have get the kernel of the Proxmox host to initialize the card, if you want to access it from a container. Containers cannot load drivers and all share the same (host) kernel and therefore drivers. If there are no build-in or open-source drivers, you'll have to install the linux drivers from Hauppauge. I assume that installing the drivers and other necessary software on the host creates the video group (I don't remember the specifics but mine did not require external drivers, only firmware). When that is successful, you can get the major number from ls -al /dev/dvb/adaptor0. The user/group mapping for the container depends on the video group numbers and will require several lines but you seem to use a privileged container, so you might not need any user/group mapping (as the root in the container is root of the host).

Since it appears that you need to install drivers from an external party, maybe using a VM and using PCI passthrough would be a better way to go as it make the drivers and kernel version of the VM independent of the host? Then again, PCI passthrough often does not work (especially with TV tuners). Please search the forum about passthrough of tuners to get an idea.

EDIT: According to LinuxTV it should just work if the firmware is available in /lib/firmware/.
 
Last edited:
  • Like
Reactions: piddy
@avm yup that was it - I hadn't installed the firmware. Thank you for the solution (and the link).

For anyone else following this who wants more detail.... I downloaded the files from https://github.com/OpenELEC/dvb-firmware (either obtain it using git, or click on the 'Code' button and then choose 'download zip'). I then transferred the 'firmware' directory to /lib/firmware on the host machine of my proxmox server (scp /[PATH_TO]/firmware/* root@[PVE_IP_ADDRESS]:/lib/firmware/), and rebooted ('reboot now').

On reboot, four devices show up in the proxmox host (/dev/dvb/adapter0, /dev/dvb/adapter1, /dev/dvb/adapter2, /dev/dvb/adapter3). Running 'ls -al /dev/dvb/adapterX' in the proxmox host terminal yielded the [MAJOR_NUMBER] (212 in my case) referred to above, output below:


root@pve:~# ls -al /dev/dvb/adapter0
total 0
drwxr-xr-x 2 root root 120 May 16 22:05 .
drwxr-xr-x 6 root root 120 May 16 22:05 ..
crw-rw---- 1 root video 212, 1 May 16 22:05 demux0
crw-rw---- 1 root video 212, 2 May 16 22:05 dvr0
crw-rw---- 1 root video 212, 0 May 16 22:05 frontend0
crw-rw---- 1 root video 212, 3 May 16 22:05 net0
root@pve:~# ls -al /dev/dvb/adapter1
total 0
drwxr-xr-x 2 root root 120 May 16 22:05 .
drwxr-xr-x 6 root root 120 May 16 22:05 ..
crw-rw---- 1 root video 212, 5 May 16 22:05 demux0
crw-rw---- 1 root video 212, 6 May 16 22:05 dvr0
crw-rw---- 1 root video 212, 4 May 16 22:05 frontend0
crw-rw---- 1 root video 212, 7 May 16 22:05 net0
root@pve:~# ls -al /dev/dvb/adapter2
total 0
drwxr-xr-x 2 root root 120 May 16 22:05 .
drwxr-xr-x 6 root root 120 May 16 22:05 ..
crw-rw---- 1 root video 212, 9 May 16 22:05 demux0
crw-rw---- 1 root video 212, 10 May 16 22:05 dvr0
crw-rw---- 1 root video 212, 8 May 16 22:05 frontend0
crw-rw---- 1 root video 212, 11 May 16 22:05 net0
root@pve:~# ls -al /dev/dvb/adapter3
total 0
drwxr-xr-x 2 root root 120 May 16 22:05 .
drwxr-xr-x 6 root root 120 May 16 22:05 ..
crw-rw---- 1 root video 212, 13 May 16 22:05 demux0
crw-rw---- 1 root video 212, 14 May 16 22:05 dvr0
crw-rw---- 1 root video 212, 12 May 16 22:05 frontend0
crw-rw---- 1 root video 212, 15 May 16 22:05 net0
root@pve:~#

I then just had to add the following lines to my lxc config file (/etc/pve/lxc/[LXC_ID].conf):

'lxc.cgroup.devices.allow: c [MAJOR_NUMBER]:* rwm'
'lxc.mount.entry: /dev/dvb dev/dvb none bind,create=dir 0 0'

Rebooting the linux container was all that was required for the tuner to show up and work.
 
  • Like
Reactions: leesteken
@avm yup that was it - I hadn't installed the firmware. Thank you for the solution (and the link).

For anyone else following this who wants more detail.... I downloaded the files from https://github.com/OpenELEC/dvb-firmware (either obtain it using git, or click on the 'Code' button and then choose 'download zip'). I then transferred the 'firmware' directory to /lib/firmware on the host machine of my proxmox server (scp /[PATH_TO]/firmware/* root@[PVE_IP_ADDRESS]:/lib/firmware/), and rebooted ('reboot now').

On reboot, four devices show up in the proxmox host (/dev/dvb/adapter0, /dev/dvb/adapter1, /dev/dvb/adapter2, /dev/dvb/adapter3). Running 'ls -al /dev/dvb/adapterX' in the proxmox host terminal yielded the [MAJOR_NUMBER] (212 in my case) referred to above, output below:


root@pve:~# ls -al /dev/dvb/adapter0
total 0
drwxr-xr-x 2 root root 120 May 16 22:05 .
drwxr-xr-x 6 root root 120 May 16 22:05 ..
crw-rw---- 1 root video 212, 1 May 16 22:05 demux0
crw-rw---- 1 root video 212, 2 May 16 22:05 dvr0
crw-rw---- 1 root video 212, 0 May 16 22:05 frontend0
crw-rw---- 1 root video 212, 3 May 16 22:05 net0
root@pve:~# ls -al /dev/dvb/adapter1
total 0
drwxr-xr-x 2 root root 120 May 16 22:05 .
drwxr-xr-x 6 root root 120 May 16 22:05 ..
crw-rw---- 1 root video 212, 5 May 16 22:05 demux0
crw-rw---- 1 root video 212, 6 May 16 22:05 dvr0
crw-rw---- 1 root video 212, 4 May 16 22:05 frontend0
crw-rw---- 1 root video 212, 7 May 16 22:05 net0
root@pve:~# ls -al /dev/dvb/adapter2
total 0
drwxr-xr-x 2 root root 120 May 16 22:05 .
drwxr-xr-x 6 root root 120 May 16 22:05 ..
crw-rw---- 1 root video 212, 9 May 16 22:05 demux0
crw-rw---- 1 root video 212, 10 May 16 22:05 dvr0
crw-rw---- 1 root video 212, 8 May 16 22:05 frontend0
crw-rw---- 1 root video 212, 11 May 16 22:05 net0
root@pve:~# ls -al /dev/dvb/adapter3
total 0
drwxr-xr-x 2 root root 120 May 16 22:05 .
drwxr-xr-x 6 root root 120 May 16 22:05 ..
crw-rw---- 1 root video 212, 13 May 16 22:05 demux0
crw-rw---- 1 root video 212, 14 May 16 22:05 dvr0
crw-rw---- 1 root video 212, 12 May 16 22:05 frontend0
crw-rw---- 1 root video 212, 15 May 16 22:05 net0
root@pve:~#

I then just had to add the following lines to my lxc config file (/etc/pve/lxc/[LXC_ID].conf):

'lxc.cgroup.devices.allow: c [MAJOR_NUMBER]:* rwm'
'lxc.mount.entry: /dev/dvb dev/dvb none bind,create=dir 0 0'

Rebooting the linux container was all that was required for the tuner to show up and work.
Hello!
I did the same, the adapter showed up with the ls -al /dev/dvb/adapter0, and if I run this in the lxc it also shows it, but the adapters not showed up in tvheadend.
 
@erdeidominik99
Try replacing 'cgroup' in the /etc/pve/lxc/[LXC_ID].conf with 'cgroup2'. I.E:

'lxc.cgroup2.devices.allow: c [MAJOR_NUMBER]:* rwm'
'lxc.mount.entry: /dev/dvb dev/dvb none bind,create=dir 0 0'
 
@erdeidominik99
Try replacing 'cgroup' in the /etc/pve/lxc/[LXC_ID].conf with 'cgroup2'. I.E:

'lxc.cgroup2.devices.allow: c [MAJOR_NUMBER]:* rwm'
'lxc.mount.entry: /dev/dvb dev/dvb none bind,create=dir 0 0'
Thanks, it worked, now everything works, but I get these errors is syslog and on screen:
Code:
Jun 20 14:53:23 proxmox kernel: [9253285.446130] DMAR: [DMA Read] Request device [04:00.0] PASID ffffffff fault addr ffd6d000 [fault reason 06] PTE Read access is not set
The 04:00.0 device is the TV tuner. I read that maybe the firmware is not support passthrough?
 
Code:
Jun 20 14:53:23 proxmox kernel: [9253285.446130] DMAR: [DMA Read] Request device [04:00.0] PASID ffffffff fault addr ffd6d000 [fault reason 06] PTE Read access is not set
This is indeed typically why TV-tuners don't work with PCI(e) passthrough in my experience. If you are passing it to a container (not a VM), you could try adding iommu=pt to the kernel parameters. This applies an identity mapping for devices that are not using PCI(e) passthrough. It might provide a work-around for such devices that don't work well with IOMMU.
 
This is indeed typically why TV-tuners don't work with PCI(e) passthrough in my experience. If you are passing it to a container (not a VM), you could try adding iommu=pt to the kernel parameters. This applies an identity mapping for devices that are not using PCI(e) passthrough. It might provide a work-around for such devices that don't work well with IOMMU.
And do I need to leave the intel_iommu=on parameter? Or I use just the iommu=pt?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!