Cannot connect USB Tuner wih the official Plex docker image

Hello!

I’m trying to connect a hauppauge xbox tuner to my Plex server.
The Plex server runs within Docker using the official plex inc image. plexinc/pms-docker:plexpass. I tried a few things:

  • Forwarding the dvb device to the container.
  • Adding the plex user to the video group (see the Dockerfile)
  • Installing the hauppauge drivers in the container.

I understand that installing the drivers per say shouldn’t be necessary? Never the less I cannot get the tuner to show up when I run the DVR installation in the Plex server settings. Also note that I tried installing Plex directly on the host and the tuner did show up. I wasn’t able to scan for channels, but that’s another issue. I’ve been searching for a few days the internet about this topic and I understand this should be a pretty straight forward to setup, but I cannot get it working.

my docker compose file:

plex:
container_name: plex_server
build: ./containers/plex
restart: unless-stopped
devices:
- /dev/dvb:/dev/dvb
networks:
- bridge_network
ports:
- 32600:32400/tcp
- 3005:3005/tcp
- 8324:8324/tcp
- 32469:32469/tcp
- 1900:1900/udp
- 32410:32410/udp
- 32412:32412/udp
- 32413:32413/udp
- 32414:32414/udp
environment:
- TZ=America/Montreal
- PLEX_CLAIM=claim-bla
- ADVERTISE_IP=https://some.hostname.ca:32600/

hostname: some.hostname.ca
volumes:
- ./volumes/plex/config:/config
- ./volumes_not_persistent/plex/transcode:/transcode

My Dockerfile:

FROM plexinc/pms-docker:plexpass
RUN usermod -a -G video plex
RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository ppa:b-rad/kernel+mediatree+hauppauge
RUN apt-get update && apt-get install -y linux-image-mediatree linux-headers-mediatree

The result when I run the dmesg command on the host

[12034.613869] usb 10-2: new high-speed USB device number 7 using xhci_hcd
[12034.766644] usb 10-2: New USB device found, idVendor=2040, idProduct=b123
[12034.766649] usb 10-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12034.766652] usb 10-2: Product: Hauppauge Device
[12034.766655] usb 10-2: Manufacturer: Hauppauge
[12034.766658] usb 10-2: SerialNumber: #########
[12034.770737] cx231xx 10-2:1.1: New device Hauppauge Hauppauge Device @ 480 Mbps (2040:b123) with 7 interfaces
[12034.771007] cx231xx 10-2:1.1: Identified as Hauppauge WinTV-HVR-955Q (111401) (card=21)
[12034.773278] i2c i2c-12: Added multiplexed i2c bus 14
[12034.773582] i2c i2c-12: Added multiplexed i2c bus 15
[12034.967712] cx25840 11-0044: cx23102 A/V decoder found @ 0x88 (cx231xx #0-0)
[12037.194831] cx25840 11-0044: loaded v4l-cx231xx-avcore-01.fw firmware (16382 bytes)
[12037.287706] tveeprom: Hauppauge model 111401, rev E3I6, serial# 4035796472
[12037.287709] tveeprom: MAC address is 00:0d:fe:8d:5d:f8
[12037.287711] tveeprom: tuner model is SiLabs Si2157 (idx 186, type 4)
[12037.287714] tveeprom: TV standards NTSC(M) ATSC/DVB Digital (eeprom 0x88)
[12037.287716] tveeprom: audio processor is CX23102 (idx 47)
[12037.287718] tveeprom: decoder processor is CX23102 (idx 46)
[12037.287719] tveeprom: has no radio, has IR receiver, has no IR transmitter
[12037.287725] cx231xx 10-2:1.1: v4l2 driver version 0.0.3
[12037.374254] cx231xx 10-2:1.1: Unknown tuner type configuring SIF
[12037.414412] cx231xx 10-2:1.1: Registered video device video0 [v4l2]
[12037.414514] cx231xx 10-2:1.1: Registered VBI device vbi0
[12037.414839] cx231xx 10-2:1.1: audio EndPoint Addr 0x83, Alternate settings: 3
[12037.490904] si2157 15-0060: Silicon Labs Si2147/2148/2157/2158 successfully attached
[12037.490961] dvbdev: DVB: registering new adapter (cx231xx #0)
[12037.490967] cx231xx 10-2:1.1: DVB: registering adapter 0 frontend 0 (LG Electronics LGDT3306A VSB/QAM Frontend)…
[12037.491832] cx231xx 10-2:1.1: Successfully loaded cx231xx-dvb
[12037.491837] cx231xx 10-2:1.1: video EndPoint Addr 0x84, Alternate settings: 5
[12037.491841] cx231xx 10-2:1.1: VBI EndPoint Addr 0x85, Alternate settings: 2
[12037.491845] cx231xx 10-2:1.1: sliced CC EndPoint Addr 0x86, Alternate settings: 2
[12037.491849] cx231xx 10-2:1.1: TS EndPoint Addr 0x81, Alternate settings: 6

Thanks for helping!

I’m also looking for additional ways to debug the problem, like, which log files should I look into?

I run on ubuntu 18.04, but that’s the host, I assume this shouldn’t impact containers in docker

Can you verify that you have a device available at /dev/dvb on the host system? The output of your dmesg does look like it is there. Can you make sure your running docker instance of plex has the permissions to access that as well? It looks like you’re running a custom build of plex so my guess is that the user you’re running as cannot access the device. My docker-compose file does pass in a UID and GID which maps back to my regular linux user

I found that I didn’t need to install any drivers using the default plexpass image for the xbox adapter. I am simply using the plexinc/pms-docker:plexpass image and passing in a ‘devices’ list with just the one path. My docker-compose is below

version: '2'
  plex:
    image: plexinc/pms-docker:plexpass  # https://hub.docker.com/r/plexinc/pms-docker/tags/
    container_name: plex
    hostname: <myhostname>
    restart: unless-stopped
    devices:
      - /dev/dvb:/dev/dvb
    expose:
      - 32400
    ports:
      - 32400:32400/tcp
      - 3005:3005/tcp
      - 8324:8324/tcp
      - 32469:32469/tcp
      - 1900:1900/udp
      - 32410:32410/udp
      - 32412:32412/udp
      - 32413:32413/udp
      - 32414:32414/udp
    volumes:
      - /home/<myuser>/config/plex:/config
      - /media/storage/videos/tv:/data/tv
      - /media/storage/videos/movies:/data/movies
    environment:
      - PLEX_UID=1000
      - PLEX_GID=1000
      - ADVERTISE_IP=http://192.168.1.10:32400/
      - ALLOWED_NETWORKS=192.168.1.0/24

Ok so I’m playing around with this, and using that configuration I’m having no luck.
I noticed two things:

  1. I can see the tuner device if I set the user as root (PLEX_UID=0) but that is not an acceptable solution. It does, however point out a permission issue
  2. I also tried to add the plex user to the video group (both on the host and within the container) to no avail.

I have a script that I run as part of my dockerfile, which sets /dev/dvb to be chown’ed by plex:plex. That fixed the issue for me.

Script is here: https://github.com/jvonhoff/pms-docker

So here’s the thing :
When mounting a device to a docker container, the owner (user:group) is set to root:root. On the host it was root:video, but it is set to root:root within the container. To fix it, I inspired myself of jvonhoff,
My Dockerfile:

FROM plexinc/pms-docker:plexpass
RUN usermod -a -G video plex
ADD ./fixperms.sh /etc/cont-init.d/15-fixperms

the fixperms.sh file:

#!/bin/sh -ex
chown -R :video “/dev/dvb”

I was able to get it working without having to manage an additional Dockerfile.

file: plex.yaml

version: '3'
services:
  bootstrap:
    image: busybox
    user: root
    command: ["chown", "-R", "1000:1000", "/dev/dvb"]
    volumes:
      - /dev:/dev
    depends_on:
      - plex

  plex:
    image: linuxserver/plex
    container_name: plex
    network_mode: "host"
    environment:
      - TZ=America/New_York
      - PUID=1000
      - PGID=1000
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/ubuntu/configs/plex:/config
      - /nfs:/nfs
      - /dev:/dev
    privileged: true
    restart: unless-stopped

docker-compose -f ./plex.yaml up

Explanation:
both containers mount “/dev” so whatever one does the other can see. Now since the “bootstrap” service depends_on “plex” it will always run after “plex” starts up. It then chowns /dev/dvb to the correct user and exits 0 (gracefully exit) so docker-compose wont throw any fits.

This is an easy fix you can throw into your docker-compose file.