<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Using Ubuntu Xenial, I pass USB DVB tuners through to MythTv
running in an unprivileged LXD container. Not exactly the same but
may provide some pointers<br>
</p>
<p>First you need to change ownership of adapters eg. “sudo chown -R
root:video /dev/dvb”<br>
<br>
then add <user> to video <br>
</p>
<p style="margin-bottom: 0cm; line-height: 100%">===========================================================================<br>
</p>
<p style="margin-bottom: 0cm; line-height: 100%">Next issue was how
to grant unprivileged container access to host files (eg storage
for recorded content), read this <br>
</p>
<p style="margin-bottom: 0cm; line-height: 100%"><a class="moz-txt-link-freetext" href="https://gist.github.com/bloodearnest/ebf044476e70c4baee59c5000a10f4c8">https://gist.github.com/bloodearnest/ebf044476e70c4baee59c5000a10f4c8</a><br>
</p>
<p style="margin-bottom: 0cm; line-height: 100%">For me the
resulting profile looks like this</p>
<p style="margin-bottom: 0cm; line-height: 100%"> </p>
config:<br>
<p style="margin-bottom: 0cm; line-height: 100%"> raw.lxc: |<br>
lxc.id_map = u 400000 1000 1<br>
lxc.id_map = g 400000 1000 1<br>
user.user-data: |<br>
#cloud-config<br>
users:<br>
- name: <your user id><br>
primary-group: 400000<br>
uid: 400000 # only works in xenial<br>
groups: sudo<br>
shell: /bin/bash<br>
sudo: ['ALL=(ALL) NOPASSWD:ALL']<br>
description: ""<br>
devices: {}<br>
</p>
<p style="margin-bottom: 0cm; line-height: 100%">===========================================================================<br>
</p>
<p>Then the container setup / definition looks like this (note the
cgroup definitions, plus I copied the user and group mappings
across from the above profile because the profile sometimes seemed
to be unapplied - really needed for initial container definition
though). I also tend to limit CPU and memory access of VMs<br>
</p>
### This is a yaml representation of the configuration.<br>
### Any line starting with a '# will be ignored.<br>
###<br>
### A sample configuration looks like:<br>
### name: container1<br>
### profiles:<br>
### - default<br>
### config:<br>
### volatile.eth0.hwaddr: 00:16:3e:e9:f8:7f<br>
### devices:<br>
### homedir:<br>
### path: /extra<br>
### source: /home/user<br>
### type: disk<br>
### ephemeral: false<br>
###<br>
### Note that the name is shown but cannot be changed<br>
<br>
name: xenial-mythserver<br>
profiles:<br>
- <your base profile for access to host id resources><br>
- default<br>
config:<br>
boot.autostart: "1"<br>
limits.cpu: 1,2,3<br>
limits.memory: 6GB<br>
raw.lxc: |<br>
lxc.cgroup.devices.allow= c 212:* rwm<br>
lxc.cgroup.devices.allow= c 189:* rwm<br>
lxc.cgroup.devices.allow= c 13:* rwm<br>
lxc.id_map= u 400000 1000 1<br>
lxc.id_map= g 400000 1000 1<br>
volatile.base_image:
f452cda3bccb2903e56d53e402b9d35334b4276783d098a879be5d74b04e62e2<br>
volatile.eth0.hwaddr: xx:xx:xx:xx:xx:xx<br>
volatile.last_state.idmap:
'[{"Isuid":true,"Isgid":false,"Hostid":165536,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":165536,"Nsid":0,"Maprange":65536}]'<br>
devices:<br>
dvb0_demux:<br>
gid: "44"<br>
major: "212"<br>
minor: "0"<br>
path: /dev/dvb/adapter0/demux0<br>
type: unix-char<br>
dvb0_dvr:<br>
gid: "44"<br>
major: "212"<br>
minor: "1"<br>
path: /dev/dvb/adapter0/dvr0<br>
type: unix-char<br>
dvb0_frontend:<br>
gid: "44"<br>
major: "212"<br>
minor: "3"<br>
path: /dev/dvb/adapter0/frontend0<br>
type: unix-char<br>
dvb0_net:<br>
gid: "44"<br>
major: "212"<br>
minor: "2"<br>
path: /dev/dvb/adapter0/net0<br>
type: unix-char<br>
dvb1_demux:<br>
gid: "44"<br>
major: "212"<br>
minor: "4"<br>
path: /dev/dvb/adapter1/demux0<br>
type: unix-char<br>
dvb1_dvr:<br>
gid: "44"<br>
major: "212"<br>
minor: "5"<br>
path: /dev/dvb/adapter1/dvr0<br>
type: unix-char<br>
dvb1_frontend:<br>
gid: "44"<br>
major: "212"<br>
minor: "7"<br>
path: /dev/dvb/adapter1/frontend0<br>
type: unix-char<br>
dvb1_net:<br>
gid: "44"<br>
major: "212"<br>
minor: "6"<br>
path: /dev/dvb/adapter1/net0<br>
type: unix-char<br>
dvb2_demux:<br>
gid: "44"<br>
major: "212"<br>
minor: "8"<br>
path: /dev/dvb/adapter2/demux0<br>
type: unix-char<br>
dvb2_dvr:<br>
gid: "44"<br>
major: "212"<br>
minor: "9"<br>
path: /dev/dvb/adapter2/dvr0<br>
type: unix-char<br>
dvb2_frontend:<br>
gid: "44"<br>
major: "212"<br>
minor: "11"<br>
path: /dev/dvb/adapter2/frontend0<br>
type: unix-char<br>
dvb2_net:<br>
gid: "44"<br>
major: "212"<br>
minor: "10"<br>
path: /dev/dvb/adapter2/net0<br>
type: unix-char<br>
dvb3_demux:<br>
gid: "44"<br>
major: "212"<br>
minor: "12"<br>
path: /dev/dvb/adapter3/demux0<br>
type: unix-char<br>
dvb3_dvr:<br>
gid: "44"<br>
major: "212"<br>
minor: "13"<br>
path: /dev/dvb/adapter3/dvr0<br>
type: unix-char<br>
dvb3_frontend:<br>
gid: "44"<br>
major: "212"<br>
minor: "15"<br>
path: /dev/dvb/adapter3/frontend0<br>
type: unix-char<br>
dvb3_net:<br>
gid: "44"<br>
major: "212"<br>
minor: "14"<br>
path: /dev/dvb/adapter3/net0<br>
type: unix-char<br>
dvd_data:<br>
path: /mnt/xxx<br>
source: /mnt/xxxx<br>
type: disk<br>
eth0:<br>
name: eth0<br>
nictype: bridged<br>
parent: <your bridge name><br>
type: nic<br>
music_data:<br>
path: /mnt/xxx<br>
source: /mnt/xxx<br>
type: disk<br>
root:<br>
path: /<br>
type: disk<br>
video_data:<br>
path: /mnt/xxxx<br>
source: /mnt/xxxx<br>
type: disk<br>
ephemeral: false<br>
<p style="margin-bottom: 0cm; line-height: 100%">===========================================================================<br>
</p>
<p>Now you can start the container and configure the network,
recorder and whatever else you want to run <br>
</p>
<br>
Rob<br>
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 03/01/17 08:38, John Gubert wrote:<br>
</div>
<blockquote cite="mid:314e5dc0-71ad-8a40-d731-20dd37d20e7f@web.de"
type="cite">Hello everyone,
<br>
<br>
I am setting up my next container (Ubuntu Xenial) on my host
(Ubuntu Xenial), this one is supposed to stream TV from a dvb-s2
card to my network.
<br>
<br>
I intend to use TvHeadend software for this purpose, which I was
able to install inside the container and I tried to pass through
the /dev components of my dvb card:
<br>
<br>
lxc config device add tv bridge0 unix-char
path=/dev/ddbridge/card0
<br>
<br>
lxc config device add tv demux0 unix-char
path=/dev/dvb/adapter0/demux0
<br>
lxc config device add tv dvr0 unix-char
path=/dev/dvb/adapter0/dvr0
<br>
lxc config device add tv frontend0 unix-char
path=/dev/dvb/adapter0/frontend0
<br>
lxc config device add tv net0 unix-char
path=/dev/dvb/adapter0/net0
<br>
<br>
lxc config device add tv demux1 unix-char
path=/dev/dvb/adapter1/demux0
<br>
lxc config device add tv dvr1 unix-char
path=/dev/dvb/adapter1/dvr0
<br>
lxc config device add tv frontend1 unix-char
path=/dev/dvb/adapter1/frontend0
<br>
lxc config device add tv net1 unix-char
path=/dev/dvb/adapter1/net0
<br>
<br>
As far as I can see, all those devices are available inside the
host, yet tvheadend does not find them.
<br>
<br>
The former setup was a virtual machine based on kvm/qemu with pci
passthrough. I was hoping to increase responsiveness and decrease
load with a switch to LXD.
<br>
<br>
Does one of you use a similar setup and know about some caveats I
need to look into? Or how to check inside the container, whether
it is a tvheadend or a container problem?
<br>
<br>
kind regards,
<br>
<br>
John
<br>
_______________________________________________
<br>
lxc-users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.linuxcontainers.org/listinfo/lxc-users">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br>
</blockquote>
<br>
</body>
</html>