Plex fails to find channels on USB tuner

Hello!

I’m trying to setup live tv without success, the scan does not find any channels.

The problem was really the usb bus being unstable using linux on a uefi motherboard with iommu disabled, see the solution

I use plex in Docker, but experimented similar issues when installed directly on the host, or in docker when setting up as a root user.

So here’s the setup, some information might be superfluous, but I still put it there.

  • I forward the /dev/dvb device to the plex docker container
  • Within the Dockerfile, I fix the permissions for the dvb directory, so that plex can access it.
  • Launching a scan finds no channels.

##Dockerfile File

FROM plexinc/pms-docker:plexpass

#access to tuner
RUN usermod -a -G video www-data
RUN usermod -a -G users www-data

#script that will set /dev/dvb/ group to video. (group is root by default in the docker image).
ADD ./fixperms.sh /etc/cont-init.d/15-fixperms

##fixperms.sh File

#!/bin/sh -ex

chown -R :video “/dev/dvb”

##docker-compose.yml File

plex:
container_name: plex_server
build: ./containers/plex
restart: “no”
devices:
- /dev/dvb:/dev/dvb
networks:
proxy_network:
# must be static. This address is also found in the reverse_proxy conf file
ipv4_address: 172.21.0.101
expose:
- ‘32400’
ports:
- 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
- ADVERTISE_IP=https://some.host/
#for write access to data within nextcloud I set the user to www-data
- PLEX_UID=33
- PLEX_GID=33
hostname: some.host
depends_on:
- nextcloud #irrelevant to the problem I think
volumes:
- ./volumes/plex/config:/config
- ./volumes_not_persistent/plex/transcode:/transcode
- ./volumes/nextcloud/nextcloud_data/data/:/cloud_data #irrelevant to the problem I think

##Tuner Log File

Mar 21, 2018 08:43:52.727 [0x7fb45569a700] INFO - Plex Tuner Service v1.0.0.0 - unknown docker unknown - build:
Mar 21, 2018 08:43:52.727 [0x7fb45569a700] INFO - Linux version: 4.13.0-37-generic (#42-Ubuntu SMP Wed Mar 7 14:13:23 UTC 2018), language: C
Mar 21, 2018 08:43:52.727 [0x7fb45569a700] INFO - Processor AMD FX™-8350 Eight-Core Processor
Mar 21, 2018 08:43:52.728 [0x7fb45569a700] INFO - /usr/lib/plexmediaserver/Plex Tuner Service /usr/lib/plexmediaserver/Resources/Tuner/Private /usr/lib/plexmediaserver/Resources/Tuner/Shared 1.12.1.4885-1046ba85f 32600 /waitmutex
Mar 21, 2018 08:43:52.726 [0x7fb45a73a780] INFO - * broker_t::start…
Mar 21, 2018 08:43:52.729 [0x7fb45a73a780] INFO - * device_manager_t::init.
Mar 21, 2018 08:43:52.729 [0x7fb45a73a780] INFO - * device_manager_t::init. Initialize provider manager
Mar 21, 2018 08:43:52.729 [0x7fb45a73a780] INFO - * device_manager_t::init. Initialize all device auxes
Mar 21, 2018 08:43:52.729 [0x7fb45a73a780] INFO - * dvb_device_factory_t::get_aux_list
Mar 21, 2018 08:43:52.729 [0x7fb45a73a780] INFO - * tvbutler_aux_t::init
Mar 21, 2018 08:43:52.730 [0x7fb45a73a780] INFO - * web_server_t::start. Starting web server on port 32600
Mar 21, 2018 08:44:00.398 [0x7fb44f7fe700] INFO - * web_service_t::process_device_discovery
Mar 21, 2018 08:44:00.398 [0x7fb44f7fe700] INFO - * device_reactor_t::get_device_list ()
Mar 21, 2018 08:44:00.398 [0x7fb44f7fe700] INFO - * dvb_device_factory_t::get_device_list ()
Mar 21, 2018 08:44:01.202 [0x7fb44effd700] INFO - * web_service_t::process_get_scanners
Mar 21, 2018 08:44:01.202 [0x7fb44effd700] INFO - * v4l::DeviceGetList_impl. getting v4l device list
Mar 21, 2018 08:44:01.203 [0x7fb44effd700] INFO - * v4l::DeviceGetList_impl. Successfully opened frontend /dev/dvb/adapter0/frontend0
Mar 21, 2018 08:44:01.213 [0x7fb44cff9700] INFO - * web_service_t::process_scan_request
Mar 21, 2018 08:44:01.213 [0x7fb44cff9700] INFO - * v4l::DeviceGetList_impl. getting v4l device list
Mar 21, 2018 08:44:01.213 [0x7fb44cff9700] INFO - * v4l::DeviceGetList_impl. Successfully opened frontend /dev/dvb/adapter0/frontend0
Mar 21, 2018 08:44:01.217 [0x7fb44cff9700] INFO - * device_manager_t::scan_start. Device dvb#v4l#0#/sys/devices/pci0000:00/0000:00:15.1/0000:06:00.0/usb10/10-1/10-1:1.1
Mar 21, 2018 08:44:01.217 [0x7fb44cff9700] INFO - * device_reactor_t::create_device dvb#v4l#0#/sys/devices/pci0000:00/0000:00:15.1/0000:06:00.0/usb10/10-1/10-1:1.1
Mar 21, 2018 08:44:01.217 [0x7fb44bff7700] INFO - * channel_scanner_t::scan_thread_function started
Mar 21, 2018 08:44:01.219 [0x7fb44bff7700] INFO - * channel_scanner_t::scan_thread_function. Scanning channels
Mar 21, 2018 08:44:01.221 [0x7fb44ffff700] INFO - * web_service_t::process_device_status
Mar 21, 2018 08:44:01.221 [0x7fb44ffff700] INFO - * v4l::DeviceGetList_impl. getting v4l device list
Mar 21, 2018 08:44:01.221 [0x7fb44ffff700] INFO - * v4l::DeviceGetList_impl. Successfully opened frontend /dev/dvb/adapter0/frontend0
Mar 21, 2018 08:44:01.229 [0x7fb44dffb700] INFO - * web_service_t::process_get_scanners
Mar 21, 2018 08:44:01.229 [0x7fb44dffb700] INFO - * v4l::DeviceGetList_impl. getting v4l device list
Mar 21, 2018 08:44:01.230 [0x7fb44dffb700] INFO - * v4l::DeviceGetList_impl. Successfully opened frontend /dev/dvb/adapter0/frontend0
Mar 21, 2018 08:44:01.269 [0x7fb44b7f6700] INFO - * find_device_by_path. searching for matching tuner with device path /sys/devices/pci0000:00/0000:00:15.1/0000:06:00.0/usb10/10-1/10-1:1.1
Mar 21, 2018 08:44:01.270 [0x7fb44b7f6700] INFO - * v4l::DeviceGetList_impl. getting v4l device list
Mar 21, 2018 08:44:01.270 [0x7fb44b7f6700] INFO - * v4l::DeviceGetList_impl. Successfully opened frontend /dev/dvb/adapter0/frontend0
Mar 21, 2018 08:44:01.276 [0x7fb44b7f6700] INFO - * find_device_by_path. Found device index 0 for device path /sys/devices/pci0000:00/0000:00:15.1/0000:06:00.0/usb10/10-1/10-1:1.1
Mar 21, 2018 08:44:01.277 [0x7fb44b7f6700] INFO - * Starting tuner 0, frontend 0
Mar 21, 2018 08:44:01.422 [0x7fb44b7f6700] INFO - * tuner 0, frontend 0 was opened successfully
Mar 21, 2018 08:44:01.422 [0x7fb44b7f6700] INFO - * detected tuner ids: vendor (2040), product (b123)
Mar 21, 2018 08:44:01.423 [0x7fb44b7f6700] INFO - * No ca0 node is present for tuner 0
Mar 21, 2018 08:44:01.423 [0x7fb44b7f6700] INFO - * CTVSStreamSource::TuneTransponder. Transponder tuning request: diseqc 0, freq 2, modulation 0, polarization 0, symbol rate 0, LOF 0, LNB selection signal 0, FEC 0
Mar 21, 2018 08:44:01.423 [0x7fb44b7f6700] INFO - * Tuning request. 2, 0, 0, 0, 0, 0, 0
Mar 21, 2018 08:44:01.433 [0x7fb44b7f6700] WARN - [W] CV4lTunersStreamSrc::Start. pthread_setschedparam failed 1
Mar 21, 2018 08:44:01.433 [0x7fb44aff5700] INFO - * Starting streaming thread for tuner 0, frontend 0
Mar 21, 2018 08:44:01.434 [0x7fb44aff5700] INFO - * tuner 0, demux 0. adding PID 20
Mar 21, 2018 08:44:02.402 [0x7fb44f7fe700] INFO - * SAT2IP - discover_satip_servers(): no servers found
Mar 21, 2018 08:44:02.809 [0x7fb44f7fe700] INFO - * v4l::DeviceGetList_impl. getting v4l device list
Mar 21, 2018 08:44:02.809 [0x7fb44f7fe700] INFO - * v4l::DeviceGetList_impl. Successfully opened frontend /dev/dvb/adapter0/frontend0
Mar 21, 2018 08:44:04.239 [0x7fb44cff9700] INFO - * web_service_t::process_device_status
Mar 21, 2018 08:44:04.239 [0x7fb44cff9700] INFO - * v4l::DeviceGetList_impl. getting v4l device list
Mar 21, 2018 08:44:04.239 [0x7fb44cff9700] INFO - * v4l::DeviceGetList_impl. Successfully opened frontend /dev/dvb/adapter0/frontend0
Mar 21, 2018 08:44:07.456 [0x7fb44f7fe700] INFO - * dvb_device_factory_t::get_device_list. Id dvb#v4l#0#/sys/devices/pci0000:00/0000:00:15.1/0000:06:00.0/usb10/10-1/10-1:1.1, Name Hauppauge Device, Standards 24
Mar 21, 2018 08:44:07.456 [0x7fb44f7fe700] INFO - * onetv_factory::DeviceGetListEx >>
Mar 21, 2018 08:44:07.457 [0x7fb44f7fe700] WARN - [W] onetv_factory::DeviceGetListEx. libusb_init returned an error -99
Mar 21, 2018 08:44:07.457 [0x7fb44f7fe700] INFO - * device_manager_t::get_device_list. Device Hauppauge Device, id dvb#v4l#0#/sys/devices/pci0000:00/0000:00:15.1/0000:06:00.0/usb10/10-1/10-1:1.1, tuners 1, state 3, standards 24
Mar 21, 2018 08:44:07.458 [0x7fb44effd700] INFO - * web_service_t::process_get_scanners
Mar 21, 2018 08:44:07.458 [0x7fb44effd700] INFO - * v4l::DeviceGetList_impl. getting v4l device list
Mar 21, 2018 08:44:07.458 [0x7fb44effd700] INFO - * v4l::DeviceGetList_impl. Successfully opened frontend /dev/dvb/adapter0/frontend0
Mar 21, 2018 08:44:07.459 [0x7fb44c7f8700] INFO - * web_service_t::process_device_status
Mar 21, 2018 08:44:08.944 [0x7fb44bff7700] INFO - * CTVSChannelScanner::Tune. Wait for lock timeout
Mar 21, 2018 08:44:08.944 [0x7fb44bff7700] WARN - [E] dvb_channel_scanner_t::do_scan. Tune failed for 2
Mar 21, 2018 08:44:08.944 [0x7fb44bff7700] INFO - * channel_scanner_t::scan_channels. Scanned 1 transponder out of 68. Channels found 0
Mar 21, 2018 08:44:08.994 [0x7fb44b7f6700] INFO - * CTVSStreamSource::TuneTransponder. Transponder tuning request: diseqc 0, freq 3, modulation 0, polarization 0, symbol rate 0, LOF 0, LNB selection signal 0, FEC 0
Mar 21, 2018 08:44:08.994 [0x7fb44b7f6700] INFO - * Tuning request. 3, 0, 0, 0, 0, 0, 0
Mar 21, 2018 08:44:09.001 [0x7fb44aff5700] INFO - * Exiting streaming thread for tuner 0, frontend 0
Mar 21, 2018 08:44:09.557 [0x7fb44c7f8700] INFO - * v4l::DeviceGetList_impl. getting v4l device list
Mar 21, 2018 08:44:09.557 [0x7fb44c7f8700] INFO - * v4l::DeviceGetList_impl. Successfully opened frontend /dev/dvb/adapter0/frontend0
Mar 21, 2018 08:44:09.559 [0x7fb44b7f6700] WARN - [W] CV4lTunersStreamSrc::Start. pthread_setschedparam failed 1
Mar 21, 2018 08:44:09.559 [0x7fb44aff5700] INFO - * Starting streaming thread for tuner 0, frontend 0
Mar 21, 2018 08:44:09.560 [0x7fb44aff5700] INFO - * tuner 0, demux 0. adding PID 20
Mar 21, 2018 08:44:12.563 [0x7fb44f7fe700] INFO - * web_service_t::process_device_status
Mar 21, 2018 08:44:13.535 [0x7fb44f7fe700] INFO - * v4l::DeviceGetList_impl. getting v4l device list
Mar 21, 2018 08:44:13.535 [0x7fb44f7fe700] INFO - * v4l::DeviceGetList_impl. Successfully opened frontend /dev/dvb/adapter0/frontend0
Mar 21, 2018 08:44:13.538 [0x7fb44cff9700] INFO - * web_service_t::process_get_scanners
Mar 21, 2018 08:44:16.800 [0x7fb44bff7700] INFO - * CTVSChannelScanner::Tune. Wait for lock timeout
Mar 21, 2018 08:44:16.800 [0x7fb44bff7700] WARN - [E] dvb_channel_scanner_t::do_scan. Tune failed for 3

I do see, that it cannot set a thread priority, due to permission issue ( CV4lTunersStreamSrc::Start. pthread_setschedparam failed 1) but that’s just a priority, shouldn’t be so bad?
The real error seems more to be: dvb_channel_scanner_t::do_scan. Tune failed for #

But I do not know how to debug this more. Any help really welcome, I’ve been struggling for awhile. Tried many things, such as running on the host, as root, all without success.

Thanks!

ho also, I did tune channels with success on windows using nextpvr, so the antenna/tuner is good.

Forgot to mention:
Tuner is a Hauppauge WinTV-HVR-955Q

Host is ubuntu 17.10

Maybe I’m not in the right forum category, should I go post in linux instead?

just took a look at the dmesg in the container. Everything looks fine. It really looks to be an issue with how plex uses the tuner.

[49206.416730] usb 10-1: new high-speed USB device number 4 using xhci_hcd
[49206.561580] usb 10-1: New USB device found, idVendor=2040, idProduct=b123
[49206.561585] usb 10-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[49206.561588] usb 10-1: Product: Hauppauge Device
[49206.561591] usb 10-1: Manufacturer: Hauppauge
[49206.561593] usb 10-1: SerialNumber: ***
[49206.565688] cx231xx 10-1:1.1: New device Hauppauge Hauppauge Device @ 480 Mbps (2040:b123) with 7 interfaces
[49206.565940] cx231xx 10-1:1.1: Identified as Hauppauge WinTV-HVR-955Q (111401) (card=21)
[49206.567926] i2c i2c-12: Added multiplexed i2c bus 14
[49206.568134] i2c i2c-12: Added multiplexed i2c bus 15
[49206.763758] cx25840 11-0044: cx23102 A/V decoder found @ 0x88 (cx231xx #0-0)
[49209.003520] cx25840 11-0044: loaded v4l-cx231xx-avcore-01.fw firmware (16382 bytes)
[49209.096395] tveeprom: Hauppauge model 111401, rev E3I6, serial# 4035796472
[49209.096398] tveeprom: MAC address is 00:0d:fe:8d:5d:f8
[49209.096400] tveeprom: tuner model is SiLabs Si2157 (idx 186, type 4)
[49209.096403] tveeprom: TV standards NTSC(M) ATSC/DVB Digital (eeprom 0x88)
[49209.096405] tveeprom: audio processor is CX23102 (idx 47)
[49209.096406] tveeprom: decoder processor is CX23102 (idx 46)
[49209.096408] tveeprom: has no radio, has IR receiver, has no IR transmitter
[49209.096415] cx231xx 10-1:1.1: v4l2 driver version 0.0.3
[49209.181145] cx231xx 10-1:1.1: Unknown tuner type configuring SIF
[49209.221283] cx231xx 10-1:1.1: Registered video device video0 [v4l2]
[49209.221404] cx231xx 10-1:1.1: Registered VBI device vbi0
[49209.221806] cx231xx 10-1:1.1: audio EndPoint Addr 0x83, Alternate settings: 3
[49209.298095] si2157 15-0060: Silicon Labs Si2147/2148/2157/2158 successfully attached
[49209.298106] dvbdev: DVB: registering new adapter (cx231xx #0)
[49209.298112] cx231xx 10-1:1.1: DVB: registering adapter 0 frontend 0 (LG Electronics LGDT3306A VSB/QAM Frontend)…
[49209.299035] cx231xx 10-1:1.1: Successfully loaded cx231xx-dvb
[49209.299039] cx231xx 10-1:1.1: video EndPoint Addr 0x84, Alternate settings: 5
[49209.299043] cx231xx 10-1:1.1: VBI EndPoint Addr 0x85, Alternate settings: 2
[49209.299047] cx231xx 10-1:1.1: sliced CC EndPoint Addr 0x86, Alternate settings: 2
[49209.299051] cx231xx 10-1:1.1: TS EndPoint Addr 0x81, Alternate settings: 6

read through the doc again. Even though docker is in a container, the host most support the usb tuner via appropriate firmware, drivers. That should be the case since kernel 4.1.+
I still tried installing the drivers from hauppauge ppa, just in case, but to no avail.

However, that does tell me I need to move the fight on the host. I’m using w_scan to scan on the host, and it fails.
That’s telling something ain’t right with my host machine, which is pretty much a vanilla ubuntu 17.10.
Could it be in relation with the bios. I did have to add the following line to my /etc/default/grub file:

GRUB_CMDLINE_LINUX=“iommu=soft”

Also, during a scan, sometimes the USB bus fails altogether. Other peripherals stop working as well. This does not happen often, but still might point to lower level issues.

I think my bios firmware is using uefi, but I need to validate all that.
I will post more details (motherboard model, logs, output) when I get back home.

So here is the solution.
I needed to enable iommu on my motherboard . The usb bus was unstable with it disabled, the usb tuner would throw errors when scanning (look at dmesg while running w_scan) and eventually disconnect when the usb bus would go offline. Even though the consensus online for when you have trouble with iommu is to modify your grub configuration using:

GRUB_CMDLINE_LINUX=“iommu=soft”

I also needed to enable iommu in the motherboard settings. Which is running uefi by the way.

Now I have live tv, and I’m happy. If you encounter similar issues and are not able to fix it, send me a private message, I will be glad to help.