Bug 9701

Summary: Reconcile xserver-nodm-init and x11-common/xserver-common between oe-core and meta-oe
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Richard Purdie <richard.purdie>
Component: graphicsAssignee: Ross Burton <ross.burton>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: Medium+ CC: bluelightning, jku, jose.perez.carranza, joshuagloe, meta.mr.watcher, meta.watcher
Version: 2.1   
Target Milestone: 2.2 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

Description Richard Purdie 2016-06-02 11:46:13 UTC
Its confusing for users to add meta-oe and then have the system change behaviour. meta-oe has a different (higher) version of xserver-nodm-init and we really need to figure out a way so we have one good version of this rather than two incompatible ones with different features.

Once that is resolved, we could also do with either trying to reconcile x11-common and xserver-common, or putting in PROVIDES += "virtual/xserver-common" into both such that only one can build and an error is triggered if its attempted to mix them.

For nodm-init a diff is shown below. We need to:
a) Drop the unused killproc from the OE-Core version
b) Merge the shell fix for meta-oe (so cat isn't used for s subshell)
c) Add rootless X support to the meta-oe version
d) Add the misisng chvt from meta-oe
e) Add a restart sleep to OE-Core
f) Look at the differences between /etc/X11/xserver-common verses  "xinit /etc/X11/Xsession"


$ diff -u xserver-nodm-init{,-2.0}/xserver-nodm
--- xserver-nodm-init/xserver-nodm	2015-12-14 22:52:39.482429236 +0000
+++ xserver-nodm-init-2.0/xserver-nodm	2016-01-25 21:07:34.000000000 +0000
@@ -8,13 +8,10 @@
 # Default-Stop:      0 1 2 3 6
 ### END INIT INFO
 
-killproc() {            # kill the named process(es)
-        pid=`/bin/pidof $1`
-        [ "$pid" != "" ] && kill $pid
-}
 
-read CMDLINE < /proc/cmdline
-for x in $CMDLINE; do
+. /etc/init.d/functions
+
+for x in $(cat /proc/cmdline); do
         case $x in
         x11=false)
 		echo "X Server disabled" 
@@ -25,35 +22,33 @@
 
 case "$1" in
   start)
+    # We don't want this script to block the rest of the boot process
+    if [ "$2" != "background" ]; then
+      $0 $1 background &
+    else
+       # work around from /etc/X11/Xinit
+       export USER=root
+       export HOME=/home/root
+       if [ ! -d $HOME ] && [ -d /root ]; then
+         HOME=/root
+       fi
+
        . /etc/profile
-       username=root
+
        echo "Starting Xserver"
-       if [ -f /etc/X11/Xusername ]; then
-           username=`cat /etc/X11/Xusername`
-           # setting for rootless X
-           chmod o+w /var/log
-           chmod g+r /dev/tty[0-3]
-           # hidraw device is probably needed
-           if [ -e /dev/hidraw0 ]; then
-               chmod o+rw /dev/hidraw*
-           fi
-       fi
-       # Using su rather than sudo as latest 1.8.1 cause failure [YOCTO #1211]
-       su -l -c '/etc/X11/Xserver&' $username 
-       # Wait for the desktop to say its finished loading
-       # before loading the rest of the system
-       # dbus-wait org.matchbox_project.desktop Loaded
+       . /etc/X11/xserver-common
+       xinit /etc/X11/Xsession -- `which $XSERVER` $ARGS >/var/log/Xsession.log 2>&1
+    fi 
   ;;
 
   stop)
         echo "Stopping XServer"
         killproc xinit
-        sleep 1
-        chvt 1 &
   ;;
 
   restart)
 	$0 stop
+        sleep 1
         $0 start
   ;;
Comment 1 Paul Eggleton 2016-06-02 20:11:06 UTC
There's already bug 5546 open for this.
Comment 2 Ross Burton 2016-06-03 09:52:56 UTC
Yes, marking as dup.

*** This bug has been marked as a duplicate of bug 5546 ***
Comment 3 Jose Perez C 2016-07-29 15:14:34 UTC
Duplicated bug