VLC installed from snap can't access v4l devices
Posted: 01 May 2019 17:16
I'm using Ubuntu 16.04 and have a USB camera at /dev/video0 that I'm trying to access. /dev/video0 is read/writable by the "video" group, and I'm running as a user in that group. When I install VLC 2.2.2 from the apt repository, it can open /dev/video0 with no problems. However, I'd like to use VLC 3, and when I install it via snap and try to open the video device, it fails. Here's an excerpt from the log:
I don't know a lot about snap packaging, but right now my only theory is because it was installed in "strictly confined" mode. I tried installing it in classic mode, but it seems like it just ignores that:
As expected, there is no change in how it behaves. On the other hand, I can install it in development mode:
And now it works, and opening the video stream works just fine. On the other hand, I feel like I shouldn't be completely disabling security confinement and installing in development mode for everyday use. Is there any way to fix this?
Code: Select all
$ vlc -vvv /dev/video0
VLC media player 3.0.6 Vetinari (revision 3.0.6-0-g5803e85)
[00000000009e33b0] main libvlc debug: VLC media player - 3.0.6 Vetinari
[00000000009e33b0] main libvlc debug: Copyright © 1996-2018 the VideoLAN team
[00000000009e33b0] main libvlc debug: revision 3.0.6-0-g5803e85
...
[00007fbc480009e0] main input debug: `v4l2:///dev/video0' gives access `v4l2' demux `any' path `/dev/video0'
[00007fbc4c000d10] main input source debug: creating demux: access='v4l2' demux='any' location='/dev/video0' file='/dev/video0'
[00007fbc4c000e90] main demux debug: looking for access_demux module matching "v4l2": 21 candidates
[00007fbc4c000e90] v4l2 demux debug: opening device '/dev/video0'
[00007fbc44000980] main meta fetcher debug: looking for meta fetcher module matching "any": 1 candidates
[00007fbc4c000e90] v4l2 demux error: cannot open device '/dev/video0': Operation not permitted
[00007fbc44000980] lua meta fetcher debug: Trying Lua scripts in /home/user/snap/vlc/770/.local/share/vlc/lua/meta/fetcher
[00007fbc4c000e90] v4l2 demux debug: opening device '/dev/video0'
[00007fbc44000980] lua meta fetcher debug: Trying Lua scripts in /snap/vlc/770/usr/lib/vlc/lua/meta/fetcher
[00007fbc4c000e90] v4l2 demux error: cannot open device '/dev/video0': Operation not permitted
[00007fbc4c000e90] main demux debug: no access_demux modules matched
[00007fbc4c0020c0] main stream debug: creating access: v4l2:///dev/video0
[00007fbc4c0020c0] main stream debug: (path: /dev/video0)
[00007fbc4c0020c0] main stream debug: looking for access module matching "v4l2": 26 candidates
[00007fbc4c0020c0] v4l2 stream debug: opening device '/dev/video0'
[00007fbc4c0020c0] v4l2 stream error: cannot open device '/dev/video0': Operation not permitted
[00007fbc4c0020c0] main stream debug: no access modules matched
[0000000000c16300] main playlist debug: dead input
Code: Select all
$ sudo snap install vlc --classic
Warning: flag --classic ignored for strictly confined snap vlc
Code: Select all
$ sudo snap install vlc --devmode
vlc 3.0.6 from VideoLAN✓ installed