Merge lp:~mterry/ubuntu-touch-session/lightdm-switch into lp:ubuntu-touch-session

Proposed by Michael Terry
Status: Merged
Merged at revision: 115
Proposed branch: lp:~mterry/ubuntu-touch-session/lightdm-switch
Merge into: lp:ubuntu-touch-session
Diff against target: 194 lines (+70/-60)
10 files modified
52-ubuntu-touch.conf (+5/-0)
debian/control (+1/-0)
debian/ubuntu-touch-session.install (+4/-2)
debian/ubuntu-touch-session.maintscript (+2/-0)
lightdm.override (+9/-0)
ubuntu-touch-session (+34/-45)
ubuntu-touch-session-setup.conf (+0/-12)
ubuntu-touch-surfaceflinger.desktop (+7/-0)
ubuntu-touch.desktop (+7/-0)
upstart-session/unity8.conf (+1/-1)
To merge this branch: bzr merge lp:~mterry/ubuntu-touch-session/lightdm-switch
Reviewer Review Type Date Requested Status
Sergio Schvezov Needs Fixing
Review via email: mp+184659@code.launchpad.net

Commit message

Boots into unity8 using LightDM rather than custom upstart scripts.

Description of the change

Boots into unity8 using LightDM rather than custom upstart scripts.

This branch drops the custom, phablet-user-hardcoded upstart script and replaces them with a proper LightDM session. It keeps the GRID_UNIT_PX pieces as a wrapper around init, but drops the rest of the environment setting. PAM/LightDM does that for us now.

With this branch, we are brought yet closer to the same infrastructure the Desktop images use. Notably, logind will now recognize the user session as active, fixing some issues with policykit in the Touch images to date.

Performance wise in my informal testing, this seems to slow us down by a couple seconds. Not great, but didn't strike me as a deal breaker considering the benefits it brings.

Note that LightDM in Touch is *not* ready for an actual LightDM greeter. It can only work if a user is configured to be autologged in. I've added some configuration to livecd-rootfs to configure the 'phablet' user for autologin. This is in saucy now (livecd-rootfs 2.185). I figured it made sense to try to move any phablet-user hardcoding out of this package, letting it become a general purpose session suitable for any user to run.

However, this means the upgrade path is awkward, since only new images will have autologin configured. Anyone using the recommended system image upgrade path will get the fix, as well as anyone that reflashes.

To test with surfaceflinger, edit /etc/lightdm/lightdm.conf to contain:
[SeatDefaults]
type=surfaceflinger
user-session=ubuntu-touch-surfaceflinger

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

Awesome. Excited about finally starting to switch over to lightdm based login. One comment. Could we switch the "GU parts" of the "ubuntu-touch-session" script to be a separate upstart session job? I'm thinking something that is "start on starting dbus" -- that way we'd get the same variables for apps that are being tested on the desktop or other platforms as they could have that same upstart job run.

Thanks for doing this!

Revision history for this message
Michael Terry (mterry) wrote :

OK, after talking on IRC, I believe we're agreed that the current GRID_UNIT_PX wrapper is a hopefully temporary hack. It should not be added to.

We can't just set the env vars in a user session script, because the greeter will need these vars too. And it doesn't run under a user init session (yet! :)).

Revision history for this message
Oliver Grawert (ogra) wrote :

While i would approve this now, i guess it hast to wait until Mir lands in the image (or at least it needs to be merged at the same time), feel free to ping me if the time is there

Revision history for this message
Michael Terry (mterry) wrote :

Marking WIP for now, while I determine why logind is showing the phablet user as inactive.

Revision history for this message
Michael Terry (mterry) wrote :

OK, figured out logind's problem, it's solved by lightdm 1.7.15-0ubuntu1, working its way from -proposed to released.

With this branch, that lightdm update, and reflashing your device from one of this week's images (to get /etc/lightdm/lightdm.conf.d/90-phablet.conf), everything should work. :)

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

I created a package out of this, updated to latest and greatest and now see

initctl: unable to determine sessions

callbacks 0x436bcb59 0x436bcb05
creating surface at (0, 0) with size (720, 1280) with title 'Qml Phone Shell'
(process:3417): dconf-CRITICAL **: unable to create directory '/run/user/32011/dconf': Permission denied. dconf will not work properly.
__pthread_gettid -2
WARNING: QApplication was not created in the main() thread.
loaded the dummy plugin
loaded the Linux plugin
Registered the AalSensorPlugin types

(process:3768): dconf-CRITICAL **: unable to create directory '/run/user/32011/dconf': Permission denied. dconf will not work properly.

(process:3768): dconf-CRITICAL **: unable to create directory '/run/user/32011/dconf': Permission denied. dconf will not work properly.

(process:3768): dconf-CRITICAL **: unable to create directory '/run/user/32011/dconf': Permission denied. dconf will not work properly.
unity::action::ActionManager::ActionManager(QObject*):
 Could not determine application identifier. HUD will not work properly.
 Provide your application identifier in $APP_ID environment variable.

Fixed by changing perms on /run/user, so doing:

phablet@ubuntu-phablet:~$ sudo chmod 777 /run/user
[sudo] password for phablet:
phablet@ubuntu-phablet:~$ sudo initctl restart lightdm
lightdm start/running, process 2921

got unity8 going.

This still breaks for the people wanting to use the /home/phablet/.display-mir toggle

review: Needs Fixing
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

I've used this setup for a bit, session is super slow without the scheduling magic

review: Needs Fixing
Revision history for this message
Oliver Grawert (ogra) wrote :

i filed bug 1226997 on request of asac

Revision history for this message
Michael Terry (mterry) wrote :

I'm not convinced the slowness seen by testers is real. I can't reproduce anyway, on my Nexus4. Can you please retry? In the meantime, I've updated this branch to provide a surfaceflinger touch session.

You can enable it by installing the right lightdm branch [1], this branch, and editing /etc/lightdm.conf to contain:

[SeatDefaults]
type=surfaceflinger
user-session=ubuntu-touch-surfaceflinger

[1] https://code.launchpad.net/~robert-ancell/lightdm/surfaceflinger/+merge/186596

Revision history for this message
Oliver Grawert (ogra) wrote :

having to set this back to "needs review" (why dont we have "needs work" ?)
testing turned out that surfaceflinger can not start at all on maguro anymore with this merged this needs fixing before we try to land it again.

the test run at http://reports.qa.ubuntu.com/smokeng/saucy/touch_ro/4390/ has loads of logs etc which might or might not help.

103. By Michael Terry

Add back bashrc setting

104. By Michael Terry

Whoops, my cut and paste of bashrc bits got cut off

105. By Michael Terry

Merge from trunk, use surfaceflinger by default for now

106. By Michael Terry

Merge from trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '52-ubuntu-touch.conf'
2--- 52-ubuntu-touch.conf 1970-01-01 00:00:00 +0000
3+++ 52-ubuntu-touch.conf 2013-09-24 14:00:29 +0000
4@@ -0,0 +1,5 @@
5+[SeatDefaults]
6+#type=unity
7+#user-session=ubuntu-touch
8+type=surfaceflinger
9+user-session=ubuntu-touch-surfaceflinger
10
11=== modified file 'debian/control'
12--- debian/control 2013-09-23 23:06:46 +0000
13+++ debian/control 2013-09-24 14:00:29 +0000
14@@ -10,6 +10,7 @@
15 Architecture: all
16 Depends: ${shlibs:Depends},
17 ${misc:Depends},
18+ lightdm,
19 upstart-app-launch (>= 0.1+13.10.20130923.4-0ubuntu1~),
20 Conflicts: qml-phone-shell (<< 7.80~)
21 Description: Ubuntu Session Manager for Ubuntu Touch Devices
22
23=== modified file 'debian/ubuntu-touch-session.install'
24--- debian/ubuntu-touch-session.install 2013-09-23 20:37:33 +0000
25+++ debian/ubuntu-touch-session.install 2013-09-24 14:00:29 +0000
26@@ -4,5 +4,7 @@
27 *.override /etc/init
28 ubuntu-touch-session.d/* /etc/ubuntu-touch-session.d/
29 upstart-session/* /usr/share/upstart/sessions/
30-ubuntu-touch-session-setup.conf /etc/init/
31-ubuntu-touch-session.conf /etc/init/
32+ubuntu-touch-session /usr/bin/
33+ubuntu-touch.desktop /usr/share/lightdm/sessions
34+ubuntu-touch-surfaceflinger.desktop /usr/share/lightdm/sessions
35+52-ubuntu-touch.conf /etc/lightdm/lightdm.conf.d
36
37=== added file 'debian/ubuntu-touch-session.maintscript'
38--- debian/ubuntu-touch-session.maintscript 1970-01-01 00:00:00 +0000
39+++ debian/ubuntu-touch-session.maintscript 2013-09-24 14:00:29 +0000
40@@ -0,0 +1,2 @@
41+rm_conffile /etc/init/ubuntu-touch-session.conf
42+rm_conffile /etc/init/ubuntu-touch-session-setup.conf
43
44=== added file 'lightdm.override'
45--- lightdm.override 1970-01-01 00:00:00 +0000
46+++ lightdm.override 2013-09-24 14:00:29 +0000
47@@ -0,0 +1,9 @@
48+limit nice 40 40
49+oom score -10
50+
51+# lightdm normally waits for plymouth-ready, but since we disable plymouth, we
52+# remove that condition from lightdm's start stanza.
53+start on ((filesystem
54+ and runlevel [!06]
55+ and started dbus)
56+ or runlevel PREVLEVEL=S)
57
58=== renamed file 'ubuntu-touch-session.conf' => 'ubuntu-touch-session'
59--- ubuntu-touch-session.conf 2013-09-23 10:06:06 +0000
60+++ ubuntu-touch-session 2013-09-24 14:00:29 +0000
61@@ -1,45 +1,34 @@
62-author "Ricardo Mendoza <ricmm@ubuntu.com>"
63-
64-instance $USER
65-
66-stop on runlevel [016]
67-
68-limit nice 40 40
69-oom score -10
70-
71-script
72- export HOME="/home/$USER"
73- bashrc=$HOME/.bashrc
74-
75- uid=$(getent passwd "$USER"|cut -d: -f3)
76- export XDG_RUNTIME_DIR="/run/user/$uid"
77-
78- for var in $(cat /etc/environment); do
79- export $var
80- done
81-
82- device=$(getprop ro.product.device)
83-
84- if [ -f "$HOME/.display-mir" ]; then
85- export QT_QPA_PLATFORM=ubuntumirclient
86- else
87- export QT_QPA_PLATFORM=ubuntu
88- fi
89-
90- # defaults
91- GRID_UNIT_PX=18
92- QTWEBKIT_DPR=2.0
93-
94- # override defaults by sourcing /etc/ubuntu-touch-session.d/$device.conf
95- [ -e /etc/ubuntu-touch-session.d/$device.conf ] && . /etc/ubuntu-touch-session.d/$device.conf
96-
97- grep -q GRID_UNIT_PX $bashrc || echo "export GRID_UNIT_PX=${GRID_UNIT_PX}" >> $bashrc
98- grep -q QTWEBKIT_DPR $bashrc || echo "export QTWEBKIT_DPR=${QTWEBKIT_DPR}" >> $bashrc
99-
100- export GRID_UNIT_PX=${GRID_UNIT_PX}
101- export QTWEBKIT_DPR=${QTWEBKIT_DPR}
102-
103- export DESKTOP_SESSION=ubuntu-touch
104-
105- exec su -s /bin/sh -c 'exec "$0" "$@"' $USER -- init --user
106-end script
107+#!/bin/sh
108+
109+# WARNING: this wrapper is only for setting up screen environment variables
110+# that would need to be shared between a greeter process and the user session.
111+# Do NOT add any other hacks here. We eventually intend for this wrapper to
112+# go away, once we dynamically determine screen settings.
113+
114+if [ -f "$HOME/.display-mir" ]; then
115+ export QT_QPA_PLATFORM=ubuntumirclient
116+else
117+ export QT_QPA_PLATFORM=ubuntu
118+fi
119+
120+# defaults
121+GRID_UNIT_PX=18
122+QTWEBKIT_DPR=2.0
123+
124+# override defaults by sourcing /etc/ubuntu-touch-session.d/$device.conf
125+device=$(getprop ro.product.device)
126+[ -e /etc/ubuntu-touch-session.d/$device.conf ] && . /etc/ubuntu-touch-session.d/$device.conf
127+
128+export GRID_UNIT_PX=${GRID_UNIT_PX}
129+export QTWEBKIT_DPR=${QTWEBKIT_DPR}
130+
131+# Save in bashrc so that adb picks them up (for autopilot's benefit)
132+bashrc=$HOME/.bashrc
133+grep -q GRID_UNIT_PX $bashrc || echo "export GRID_UNIT_PX=${GRID_UNIT_PX}" >> $bashrc
134+grep -q QTWEBKIT_DPR $bashrc || echo "export QTWEBKIT_DPR=${QTWEBKIT_DPR}" >> $bashrc
135+
136+if [ "$#" -ne 0 ]; then
137+ $@
138+else
139+ init --user
140+fi
141
142=== removed file 'ubuntu-touch-session-setup.conf'
143--- ubuntu-touch-session-setup.conf 2013-09-23 09:09:03 +0000
144+++ ubuntu-touch-session-setup.conf 1970-01-01 00:00:00 +0000
145@@ -1,12 +0,0 @@
146-author "Ricardo Mendoza <ricmm@ubuntu.com>"
147-
148-start on (started udev
149- and started dbus)
150-stop on stopping dbus
151-
152-env user=phablet
153-export user
154-
155-script
156- start ubuntu-touch-session USER=phablet
157-end script
158
159=== added file 'ubuntu-touch-surfaceflinger.desktop'
160--- ubuntu-touch-surfaceflinger.desktop 1970-01-01 00:00:00 +0000
161+++ ubuntu-touch-surfaceflinger.desktop 2013-09-24 14:00:29 +0000
162@@ -0,0 +1,7 @@
163+[Desktop Entry]
164+Name=Ubuntu Touch
165+Exec=ubuntu-touch-session
166+TryExec=ubuntu-touch-session
167+Type=Application
168+X-LightDM-Session-Type=surfaceflinger
169+X-LightDM-DesktopName=Unity
170
171=== added file 'ubuntu-touch.desktop'
172--- ubuntu-touch.desktop 1970-01-01 00:00:00 +0000
173+++ ubuntu-touch.desktop 2013-09-24 14:00:29 +0000
174@@ -0,0 +1,7 @@
175+[Desktop Entry]
176+Name=Ubuntu Touch
177+Exec=ubuntu-touch-session
178+TryExec=ubuntu-touch-session
179+Type=Application
180+X-LightDM-Session-Type=mir
181+X-LightDM-DesktopName=Unity
182
183=== modified file 'upstart-session/unity8.conf'
184--- upstart-session/unity8.conf 2013-09-23 09:09:03 +0000
185+++ upstart-session/unity8.conf 2013-09-24 14:00:29 +0000
186@@ -1,7 +1,7 @@
187 description "Unity Shell v8"
188 author "Ricardo Mendoza <ricmm@ubuntu.com>"
189
190-start on xsession SESSION=ubuntu-touch and started dbus
191+start on ((xsession SESSION=ubuntu-touch) or (xsession SESSION=ubuntu-touch-surfaceflinger)) and started dbus
192 stop on desktop-end
193
194 respawn

Subscribers

People subscribed via source and target branches