summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/x11-common/xserver-nodm-init
diff options
context:
space:
mode:
authorKevin Hao <kexin.hao@windriver.com>2020-02-08 20:36:42 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-02-13 12:19:14 +0000
commitba279900933d2399eb722bd01f140f7fb4d79c07 (patch)
tree7efd2763f1f05d57eab1e4f7a324191dd9f1005f /meta/recipes-graphics/x11-common/xserver-nodm-init
parenta3416a5933892df940514842a34120658096ca07 (diff)
downloadpoky-ba279900933d2399eb722bd01f140f7fb4d79c07.tar.gz
xserver-nodm-init: Fix the start failure for non-root user
In order to start the xserver, a non-root user should have the cap_sys_admin capability to set the drm master. We try to get the cap_sys_admin capability by setting it in both the thread and file inheritable set. The side effect of this is that we would have to add the "pam" to the distro features if we want use the xserver-nodm-init for a non-root user. [Yocto #11526] (From OE-Core rev: cfd71a68a4931c8bda15357ebb1e9ebcf0e302dc) Signed-off-by: Kevin Hao <kexin.hao@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics/x11-common/xserver-nodm-init')
-rw-r--r--meta/recipes-graphics/x11-common/xserver-nodm-init/capability.conf2
-rwxr-xr-xmeta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm8
2 files changed, 10 insertions, 0 deletions
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/capability.conf b/meta/recipes-graphics/x11-common/xserver-nodm-init/capability.conf
new file mode 100644
index 0000000000..7ab7460816
--- /dev/null
+++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/capability.conf
@@ -0,0 +1,2 @@
1cap_sys_admin @USER@
2none *
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm
index 6c548551b8..116bb278bc 100755
--- a/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm
+++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm
@@ -38,6 +38,14 @@ case "$1" in
38 if [ -e /dev/hidraw0 ]; then 38 if [ -e /dev/hidraw0 ]; then
39 chmod o+rw /dev/hidraw* 39 chmod o+rw /dev/hidraw*
40 fi 40 fi
41 # Make sure that the Xorg has the cap_sys_admin capability which is
42 # needed for setting the drm master
43 if ! grep -q "^auth.*pam_cap\.so" /etc/pam.d/su; then
44 echo "auth optional pam_cap.so" >>/etc/pam.d/su
45 fi
46 if ! /usr/sbin/getcap $XSERVER | grep -q cap_sys_admin; then
47 /usr/sbin/setcap cap_sys_admin+eip $XSERVER
48 fi
41 fi 49 fi
42 50
43 # Using su rather than sudo as latest 1.8.1 cause failure [YOCTO #1211] 51 # Using su rather than sudo as latest 1.8.1 cause failure [YOCTO #1211]