Want to passthrough /dev/dri/renderD128 node to your containerized Jellyfin server for hardware acceleration while docker user namespace remapping is enabled (userns-remap) ? This is the blog post on how to do it.
The Challenge
Before enabling usernd-remap in docker, your Jellyfin container process may have had ran with UID 0 on the host side which made it easy to access most of the underlying host resources including renderD128.
But after enabling usernd-remap in docker, your Jellyfin container process on the host is most likely running with UID 100000 which has no permission to access /dev/dri/renderD128 .
Tweak Access Permissions of renderD128?
So you could do something like sudo chown root:100000 /dev/dri/renderD128 or set an equivalent ACL entry for it.
But after a host reboot, /dev/dri/renderD128 goes back to it’s original root:render permissions (because it’s a temporary virtual file system) - so I might have to find a way to apply permissions on system boot.
The Solution
You can write a script to apply ACL on /dev/dri/renderD128 on system boot. Or write a udev rule that gets triggered whenever renderD128 node is mounted. I chose the latter because it’s more robust.
So I used udev to trigger a setfacl command to set an ACL with group 100000 + rw access to /dev/dri/renderD128 . To do this:
-
Install
aclpackage -
Create a udev drop-in file
/etc/udev/rules.d/90-renderD128.rulesSUBSYSTEM=="drm", KERNEL=="renderD128", GROUP="render", MODE="0660", RUN+="/usr/bin/setfacl -m g:100000:rw /dev/dri/renderD128" -
Then run
udevadm control --reloadto load the changes andudevadm triggerto trigger them.
You can also write a task in your ansible playbook to automate the above steps for new server installs.