Skip to content

Set up the webcam when /dev/video0 is a leftover regular file - #196

Merged
thelamer merged 1 commit into
linuxserver:devfrom
TwentyOneLife:webcam-leftover-file
Oct 7, 2026
Merged

thelamer merged 1 commit into
linuxserver:devfrom
TwentyOneLife:webcam-leftover-file

Conversation

@TwentyOneLife

Copy link
Copy Markdown

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

One line in init-selkies-config. The webcam block now also runs when /dev/video0 is already a regular file, and otherwise behaves as before:

if [[ -z ${NO_WEBCAM+x} ]] && { [[ -f /dev/video0 ]] || { [[ ! -e /dev/video0 ]] && { mknod /dev/video0 c 81 0 2>/dev/null || touch /dev/video0 2>/dev/null; }; }; }; then

The test is scoped to a regular file, as suggested in #195. A character device at /dev/video0 is still left alone, so a real video device or a v4l2 loopback mounted in from the host is not touched.

Benefits of this PR and context:

Closes #195. Without CAP_MKNOD the block falls back to touch, which leaves a regular file. Where /dev outlives a restart of the init, that file made the ! -e test false on every later start, so SELKIES_WEBCAM_ENABLED was not set and the interposer was not added to LD_PRELOAD. The webcam worked on the first start only.

How Has This Been Tested?

On ghcr.io/linuxserver/baseimage-selkies:dev-5e1478e9-ls23, amd64, Docker 29, with the image's own init-selkies-config/run bind-mounted once unchanged and once with this line, every run with --cap-drop MKNOD. After init, read /run/s6/container_environment:

/dev/video0 before init unchanged with this PR
absent enabled, interposer in LD_PRELOAD same
regular file (bind-mounted empty file) not enabled enabled, interposer in LD_PRELOAD
character device (--device /dev/null:/dev/video0) not enabled not enabled
regular file, NO_WEBCAM set not enabled not enabled

Not tested: the other distro branches, arm64, and a real video device passed in from a host.

No changelog entry added to readme-vars.yml, as this is a small fix; happy to add one if you prefer.

Source / References:

#195

Without CAP_MKNOD the webcam block falls back to touch, which leaves a
regular file at /dev/video0. Where /dev outlives a restart of the init,
that file made the existence test skip the whole block on every later
start. A regular file there is now treated as the placeholder it is. A
character device is still left alone, so a real video device passed in
from the host is not touched.

closes linuxserver#195
@thelamer
thelamer self-requested a review October 7, 2026 16:22
@thelamer
thelamer merged commit 64e29a3 into linuxserver:dev Oct 7, 2026
2 of 4 checks passed
@thelamer

thelamer commented Oct 7, 2026

Copy link
Copy Markdown
Member

dev gets synched to all the branches when we do waterfalls this should time with selkies 2.1 if everything goes to plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants