[systemd-devel] systemd-nspawn - exporting /dev/video0

Lennart Poettering mzerqung at 0pointer.de
Wed Nov 5 03:24:35 PST 2014


On Tue, 04.11.14 23:43, MohanR (mohan43u at gmail.com) wrote:

> Hi,
> 
> I'm in need to passthrough /dev/video0 for a gstreamer based application
> development. Is it possible using systemd-nspawn? I tried enabling
> CAP_MKNOD and manually creating /dev/video0. But it was not recognized.
> 
> Is there any way to do it?

We explicitly don't support this. 

It's really not as easy as just making a device node available in a
container. In order to support device pass-thru we'd need proper
virtualization of /sys, so that we can run udev in the
container. The Linux kernel however doesn't support that.

Just passing through an isolated device node is only a small facet of
Linux device APIs. Applications must be able to also find the device
when they enumerate it via libudev, they must be able to see metadata
from the udev database and /sys. Often device nodes appear in
combination with other matching device nodes. For example webcams
usually provide a v4l device as well as a set of alsa devices. To
properly make the webcam available in a container you hence need to
move those device nodes, too, plus the meta information so that apps
can match up the v4l and alsa devices...

With nspawn we will not pretend to support something we currently
cannot suspend.

If you want proper device pass-thru to containers, please work with
the kernel community so that they implement namespaced
devices. However, I wouldn't hold my breath, it's not a particularly
attractive idea among the people involved.

Sorry,

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list