![lxc 容器内的 udev](https://linux22.com/image/221456/lxc%20%E5%AE%B9%E5%99%A8%E5%86%85%E7%9A%84%20udev.png)
我在 Proxmox 上运行一个特权 Debian LXC 容器,然后在其中运行 Docker。我正在尝试使用 Sunshine 在 Docker 容器中运行 Xserver 以流式传输到 Moonlight 客户端。为此,我正在使用名为“鲸鱼游戏”的项目。 Sunshine 在启动期间和客户端连接期间动态创建一些输入设备。
以下是 lxc conf 中的一些相关行:
features: nesting=1
lxc.mount.entry: /run/udev var/udev none bind,optional,create=dir
lxc.mount.entry: /dev/uinput dev/uinput none bind,optional,create=file
lxc.mount.entry: /dev/input dev/input none bind,optional,create=dir
lxc.cgroup2.devices.allow: c 10:* rwm
lxc.cgroup2.devices.allow: c 13:* rwm
我在容器中进行了符号链接,然后将其挂载到我的 Docker 容器中/var/udev
。/run/udev
Xorg 能够识别我的所有输入设备,但无法识别 Sunshine 创建的设备。当我使用evtest
它们时,我可以看到这些设备工作并看到输入。问题是udev
事件跨越了 LXC 边界(我认为?),因此 Xorg 没有添加新设备。
以下是我的 Proxmox 主机上的 udevadm 监视器输出:
❯ udevadm monitor -s input
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[124160.238916] remove /devices/virtual/input/input160/mouse7 (input)
UDEV [124160.258704] remove /devices/virtual/input/input160/mouse7 (input)
KERNEL[124160.264249] remove /devices/virtual/input/input160/event23 (input)
UDEV [124160.265212] remove /devices/virtual/input/input160/event23 (input)
KERNEL[124160.284184] remove /devices/virtual/input/input160 (input)
UDEV [124160.284846] remove /devices/virtual/input/input160 (input)
KERNEL[124160.340229] remove /devices/virtual/input/input161/event24 (input)
UDEV [124160.340751] remove /devices/virtual/input/input161/event24 (input)
KERNEL[124160.356212] remove /devices/virtual/input/input161 (input)
KERNEL[124160.356378] remove /devices/virtual/input/input159/mouse6 (input)
UDEV [124160.356729] remove /devices/virtual/input/input161 (input)
UDEV [124160.358682] remove /devices/virtual/input/input159/mouse6 (input)
KERNEL[124160.376267] remove /devices/virtual/input/input159/event22 (input)
UDEV [124160.376817] remove /devices/virtual/input/input159/event22 (input)
KERNEL[124160.400155] remove /devices/virtual/input/input159 (input)
UDEV [124160.400604] remove /devices/virtual/input/input159 (input)
KERNEL[124163.533210] add /devices/virtual/input/input162 (input)
KERNEL[124163.533254] add /devices/virtual/input/input162/mouse6 (input)
KERNEL[124163.533320] add /devices/virtual/input/input162/event22 (input)
KERNEL[124163.533592] add /devices/virtual/input/input163 (input)
KERNEL[124163.533623] add /devices/virtual/input/input163/mouse7 (input)
KERNEL[124163.533675] add /devices/virtual/input/input163/event23 (input)
KERNEL[124163.534019] add /devices/virtual/input/input164 (input)
KERNEL[124163.534048] add /devices/virtual/input/input164/event24 (input)
UDEV [124163.558279] add /devices/virtual/input/input162 (input)
UDEV [124163.559783] add /devices/virtual/input/input162/mouse6 (input)
UDEV [124163.560873] add /devices/virtual/input/input164 (input)
UDEV [124163.560960] add /devices/virtual/input/input163 (input)
UDEV [124163.562461] add /devices/virtual/input/input163/mouse7 (input)
UDEV [124163.628764] add /devices/virtual/input/input163/event23 (input)
UDEV [124163.636735] add /devices/virtual/input/input164/event24 (input)
UDEV [124163.636769] add /devices/virtual/input/input162/event22 (input)
这是在 LXC 容器中。
❯ udevadm monitor -s input
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[124160.238840] remove /devices/virtual/input/input160/mouse7 (input)
KERNEL[124160.264292] remove /devices/virtual/input/input160/event23 (input)
KERNEL[124160.284242] remove /devices/virtual/input/input160 (input)
KERNEL[124160.340233] remove /devices/virtual/input/input161/event24 (input)
KERNEL[124160.356212] remove /devices/virtual/input/input161 (input)
KERNEL[124160.356397] remove /devices/virtual/input/input159/mouse6 (input)
KERNEL[124160.376315] remove /devices/virtual/input/input159/event22 (input)
KERNEL[124160.400172] remove /devices/virtual/input/input159 (input)
KERNEL[124163.533247] add /devices/virtual/input/input162 (input)
KERNEL[124163.533283] add /devices/virtual/input/input162/mouse6 (input)
KERNEL[124163.533371] add /devices/virtual/input/input162/event22 (input)
KERNEL[124163.533590] add /devices/virtual/input/input163 (input)
KERNEL[124163.533623] add /devices/virtual/input/input163/mouse7 (input)
KERNEL[124163.533682] add /devices/virtual/input/input163/event23 (input)
KERNEL[124163.534049] add /devices/virtual/input/input164 (input)
KERNEL[124163.534106] add /devices/virtual/input/input164/event24 (input)
我可以做些什么来udev
在容器内工作吗?我是否应该寻求其他途径来让 Xorg 使用 Sunshine 的动态输入设备?