LXC USB WebCam passthrough [SOLVED]

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
Pedulla
Posts: 167
Joined: Thu Nov 27, 2014 11:16 am
Location: Portland, Or

LXC USB WebCam passthrough [SOLVED]

Post by Pedulla »

ZM 1.36.12
Ubuntu 20.04 running in a proxmox7 LXC container

I realize this isn't a ZM issue, but there's got to be others in the community running ZM in an LXC.

I've passed-through the USB webcam and it shows up in lsusb but the ownership is different than when run on bare metal or in a QEMU VM.
someone@lxc:~$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 005: ID 046d:0990 Logitech, Inc. QuickCam Pro 9000

someone@lxc:~$ ls -l /dev/bus/usb/003/005
crw-rw-r-- 1 nobody nogroup 189, 260 Mar 26 21:18 /dev/bus/usb/003/005

On bare metal or a QEMU VM ownership is root:root and www-data is part of the video group.
In the lxc, as you can see above, the device is owned by nobody:nogroup.

sudo -u www-data ffmpeg -i /dev/video0 test.mp4 returns a Permission denied.

Anybody know how to fix this last piece of the puzzle?

The LXC conf looks like this:

Code: Select all

lxc.mount.auto: cgroup:rw
lxc.cgroup.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/bus/usb/003/005 dev/bus/usb/003/005 none bind,optional,create=file
lxc.mount.entry: /dev/video0 dev/video0 none bind,optional,create=file
Last edited by Pedulla on Thu Mar 31, 2022 5:18 pm, edited 1 time in total.
Pedulla
Posts: 167
Joined: Thu Nov 27, 2014 11:16 am
Location: Portland, Or

Re: LXC USB WebCam passthrough

Post by Pedulla »

Hi ZM Community,
Just to follow up on this post. I figured it out with the help of the proxmox folks and wanted to pass along the info here.

See this post: https://forum.proxmox.com/threads/lxc-u ... gh.107309/

This resolves the issue specifically with a usb webcam passed to ZM running in a LXC container.

Hope someone finds this useful.
Post Reply