[PATCH 7/7] launcher: add logind backend

David Herrmann dh.herrmann at gmail.com
Tue Oct 15 21:19:48 CEST 2013


Hi

On Tue, Oct 15, 2013 at 8:47 PM, Kristian Høgsberg <hoegsberg at gmail.com> wrote:
> On Tue, Oct 15, 2013 at 02:30:02PM +0200, David Herrmann wrote:
>> Instead of spawning weston-launch from the launcher-util, we now try to
>> connect to logind first. If logind provides session-devices, we use them.
>> If not, we fall back to the old weston-launch facility.
>> ---
>>  configure.ac           |   1 +
>>  src/Makefile.am        |   8 +
>>  src/compositor-drm.c   |   2 +-
>>  src/compositor-fbdev.c |   2 +-
>>  src/compositor-rpi.c   |   2 +-
>>  src/launcher-util.c    |  40 ++-
>>  src/launcher-util.h    |   3 +-
>>  src/logind-util.c      | 913 +++++++++++++++++++++++++++++++++++++++++++++++++
>>  src/logind-util.h      |  94 +++++
>>  9 files changed, 1054 insertions(+), 11 deletions(-)
>>  create mode 100644 src/logind-util.c
>>  create mode 100644 src/logind-util.h
>
> I applied the whole patch series and stubbed out the call to
> sd_session_get_vt() (instead of updating systemd), but I then get

Cool, thanks for testing.

> [11:35:04.658] logind: cannot take control over session 4
>
> in the weston log and journalctl tells me
>
> Oct 15 11:34:52 tokamak.local dbus-daemon[444]: dbus[444]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.75" (uid=1000 pid=17613 comm="weston --tty=2 ") interface="org.freedesktop.login1.Session" member="TakeControl" error name="(unset)" requested_reply="0" destination="org.freedesktop.login1" (uid=0 pid=441 comm="/usr/lib/systemd/systemd-logind ")
> Oct 15 11:34:52 tokamak.local dbus[444]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.75" (uid=1000 pid=17613 comm="weston --tty=2 ") interface="org.freedesktop.login1.Session" member="TakeControl" error name="(unset)" requested_reply="0" destination="org.freedesktop.login1" (uid=0 pid=441 comm="/usr/lib/systemd/systemd-logind ")

whoops, You need to adjust /etc/dbus-1/system.d/org.freedesktop.login1.conf:
  http://cgit.freedesktop.org/systemd/systemd/commit/?id=d7d1c8f983599dca6ee30229375215978657c072
I pushed the fix. I thought the dbus-policies are package-manager
generated.. sorry.

> Also, logind-util.c does all the vt setup and teardown, but I wonder
> what happens if weston crashes.  Will logind reset the vt (unmute,
> KD_TEXT etc) or will the system get stuck?  One of the benefits of the
> recent weston-launch rewrite was that weston-launch will clean up if
> weston crashes, which is much more reliable.

I thought leaving the VT in VT_AUTO mode would be enough.
Session-switching would still work. Then today I noticed that in
VT_AUTO+KD_GRAPHICS the kernel *ignores* all VT-switch request..
*sigh*
That means, for a crashing weston we can just recover the VT in logind
(as Session.ReleaseControl() is implicitly called on dbus disconnect
of session-controllers). However, for a hung session we either have to
set VT_PROCESS in logind itself or add some recovery option. I don't
know.. Have to think about it.

Note that this is still rudimentary. The weston-launch rewrite should
be fine, but the dbus+logind patches still need testing and
extensions.
Btw., I can run weston without setuid, without weston-launch and
without root here. Feels awesome!

Thanks
David


More information about the wayland-devel mailing list