Passthrough usb tuner to container

ruffpl

Well-Known Member
Jan 11, 2020
37
2
48
40
I am trying to get usb tuner to Ubuntu container (Container number 212, device 212, Bus 003 Device 002: ID 2040:8268 Hauppauge soloHD). This is what I get:

lsusb

Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 2040:8268 Hauppauge soloHD
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0b05:1872 ASUSTek Computer, Inc. AURA LED Controller
Bus 001 Device 002: ID 0b05:185c ASUSTek Computer, Inc. Bluetooth Radio
Bus 001 Device 005: ID 04ca:007d Lite-On Technology Corp. USB wired keyboard
Bus 001 Device 004: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

ls -l /dev/dvb/adapter0

crw-rw---- 1 root video 212, 1 Jan 19 15:38 demux0
crw-rw---- 1 root video 212, 2 Jan 19 15:38 dvr0
crw-rw---- 1 root video 212, 0 Jan 19 15:38 frontend0
crw-rw---- 1 root video 212, 3 Jan 19 15:38 net0

Then I add to container cfg. file

lxc.cgroup2.devices.allow: c 212:* rwm
lxc.mount.entry: /dev/dvb dev/dvb none bind,optional,create=dir

What else I should do? I got tvheadend installed, got tuner firmware but I think it is not passing it to container.
 
I put the firmware on the host and let the host load all the necessary drivers. Then I passthrough the /dev/dvb directory to the container like you did:
lxc.cgroup2.devices.allow: c 212:* rwm lxc.mount.entry: /dev/dvb dev/dvb none bind,create=dir 0 0
I also map the video group of the container (44) to the video group of the host (also 44), so access is allowed:
lxc.idmap: u 0 100000 65535 lxc.idmap: g 0 100000 44 lxc.idmap: g 44 44 1 lxc.idmap: g 45 100045 65490
MythTV backend can then find the USB tuner (Hauppauge WinTV-dualHD) via /dev/dvb.
 
Hi,
what's the output of lsusb run inside the container?
 
Yes!!! I made it after whole week of failed attempts. I was searching internet, youtube tvheadend forum, ubuntu, reddit, etc and found a solution just in here.

I added the line in container .cfg file:

Code:
chown 100000:100044 -R /dev/dvb

and finally my tuner showed up just before I wanted to give up....

Now. I added 5 muxes and 3 of them found channels (the rest I will take care later). I would like to record videos on ssd that I had connected in proxmox as /mnt/pve/SSD

I added the line

Code:
mp0: /mnt/pve/SSD/,mp=/mnt/TVrecord

and I can access to it by

Code:
ls /mnt/TVrecord

but when I add the storage path to recordings (Tvheadend Ubuntu container) I get error that file was not created ( original path is /home/hts). Am I doing something wrong? Can I set up home/hts folder to my /mnt/pve/SSD (it records without problem in original location)
 
Last edited:
Code:
mp0: /mnt/pve/SSD/,mp=/mnt/TVrecord

and I can access to it by

Code:
ls /mnt/TVrecord

but when I add the storage path to recordings (Tvheadend Ubuntu container) I get error that file was not created ( original path is /home/hts). Am I doing something wrong? Can I set up home/hts folder to my /mnt/pve/SSD (it records without problem in original location)
Sounds like a permission issue. Check with ls -al /mnt/TVrecord. Maybe chown 100000:100044 on the directory on the host might help? What user is Tvheadend using inside the container? Use that for the chown command to allow write access.
 
Last edited:
For something complicated like that, why not pass the entire host usb port?
That way you don't have to mess with multiple individual things to pass through.
1674167140414.png
 
Maybe I am doing something wrong. I made it second time with unchecked unprivileged container and I had edit features mount=nfs,cifs
Now I would like to get my Ubuntu Tvheadend container to record videos into folder outside container.

Location of that folder - extra sata ssd drive in Proxmox as SSD Directory, root owner/ On my server as //192.168.1.99/mnt/pve/SSD/TVrecords
Default location of Tvheadend recordings is in 212 container, owner - root, tvheadend, it has admin and root accounts and folder is located in /home/hts. I had also created mnt/TVrecords in container

How can I add TVrecords folder to Tvheadend container so it will record files on bigger disk/ not inside container?
 
Last edited:
Made it. I had created container once again, set up as root as a tvheadend main user. On ssd I created new directory by Filezilla with read/write/execute (777) permisssions called TVrecordings (and probably that solved the problem). After that I had edit nano /etc/pve/lxc/212.conf


Code:
mp0: /mnt/pve/SSD/TVrecordings,mp=/TVrecordings


In tvheadend I chose /TVrecordings as storage patch and 200gb showed up next to tvheadend clock. Recording works, the file can be saved in the specified folder without any problems. Finally I can use it like I wanted :)
 
Last edited:
  • Like
Reactions: leesteken