← Back to team overview

ubuntu-phone team mailing list archive

Some tips for testing in the greeter

 

Hello!  So we finally landed split greeter late last week and it caused a
bit of havoc this week.  Sorry!

I thought I might share some tips for testing with the greeter to help
anyone debugging now or in the future.

I'm sure there are things I'm forgetting, so just poke me (mterry) on IRC
if you are stuck with some greeter behavior you're trying to figure out.

== Basic Background ==

With this landing, the welcome screen runs as a proper LightDM "greeter"
which just means that it is its own executable, running as the "lightdm"
user instead of the "phablet" one.  It has its own DBus, Mir, and upstart
sessions.  It has less group membership and system permissions.

Debugging can be a bit tricky because the lightdm user is a bit locked
down, it doesn't have its own shell login environment.  So you can't simply
"sudo -u lightdm -i" to interact with its session like you can for the
phablet user.

== Important directories ==

The lightdm user's HOME is /var/lib/lightdm

Some larger files like contact avatar images that are shared between the
greeter and user sessions are stored in /var/lib/lightdm-data

== Log output ==

/var/log/lightdm/lightdm.log -> system LightDM log
/var/log/lightdm/mir-greeter.log -> greeter session's log
/var/lib/lightdm/.cache/upstart/ -> greeter session's upstart job logs

== Getting on its upstart session ==

The following will tell you the right UPSTART_SESSION value to use:

cat /run/user/111/upstart/sessions/*
<https://mail.google.com/run/user/111/upstart/sessions/*%60>

== Getting on its DBus session ==

The following command will give you the right DBUS_SESSION_BUS_ADDRESS
value to use:

sudo -u lightdm env `cat /run/user/111/upstart/sessions/*` initctl --user
get-env DBUS_SESSION_BUS_ADDRESS

== Getting on its logind session ==

Policykit will deny access to some things on DBus if it thinks you're not
part of an active logind session.  Let's find out the correct
XDG_SESSION_ID to use.  You'll notice a pattern:

sudo -u lightdm env `cat /run/user/111/upstart/sessions/*`
<https://mail.google.com/run/user/111/upstart/sessions/*%60> initctl --user
get-env XDG_SESSION_ID

== Interacting with AccountsService ==

A lot of data that the greeter and session want to share (e.g wallpapers,
language, launcher items, etc) is stored in AccountsService.  You may want
to poke and prod it.  Here are some example command lines to use, all of
which can be run as root.  Note that there is a distinction between custom
properties that packages install themselves and the standard set of
properties natively understood by AS.

To set a custom property:

gdbus call --system --dest org.freedesktop.Accounts --object-path
/org/freedesktop/Accounts/User32011 --method
org.freedesktop.DBus.Properties.Set com.ubuntu.AccountsService.Sound Muted
"<true>"

To get that same custom property:

gdbus call --system --dest org.freedesktop.Accounts --object-path
/org/freedesktop/Accounts/User32011
<https://mail.google.com/org/freedesktop/Accounts/User32011> --method
org.freedesktop.DBus.Properties.Get com.ubuntu.AccountsService.Sound Muted

To set one of the standard AccountsService properties they provide setter
methods:

gdbus call --system --dest org.freedesktop.Accounts --object-path
/org/freedesktop/Accounts/User32011
<https://mail.google.com/org/freedesktop/Accounts/User32011> --method
org.freedesktop.Accounts.User.SetLanguage en_US

Although reading it back, you just use the normal property API again:

gdbus call --system --dest org.freedesktop.Accounts --object-path
/org/freedesktop/Accounts/User32011 --method
org.freedesktop.DBus.Properties.Get org.freedesktop.Accounts.User Language

-- 
-mt