Bug 19333 - Add ck-dynamic support
Summary: Add ck-dynamic support
Status: NEW
Alias: None
Product: ConsoleKit
Classification: Unclassified
Component: Daemon (show other bugs)
Version: unspecified
Hardware: All All
: high major
Assignee: william.jon.mccann
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-29 19:27 UTC by Halton Huo
Modified: 2012-05-08 10:04 UTC (History)
6 users (show)

See Also:
i915 platform:
i915 features:


Attachments
patch for bug #19333 (38.59 KB, patch)
2008-12-29 19:30 UTC, Halton Huo
Details | Splinter Review
multi-seat and multi-display patch for ConsoleKit (82.89 KB, patch)
2009-04-09 03:41 UTC, Halton Huo
Details | Splinter Review
reworked patch after Ray's review on CK's patch (81.32 KB, patch)
2009-06-04 19:45 UTC, Halton Huo
Details | Splinter Review
updated patch (176.69 KB, patch)
2009-09-14 12:06 UTC, Brian Cameron
Details | Splinter Review
updated patch (188.02 KB, patch)
2009-10-08 09:57 UTC, Brian Cameron
Details | Splinter Review
updated patch (187.93 KB, patch)
2009-11-05 02:19 UTC, Halton Huo
Details | Splinter Review
Merge multi-seat branch into master (188.55 KB, patch)
2009-11-11 19:47 UTC, Halton Huo
Details | Splinter Review
Merge multi-seat branch into master (189.16 KB, patch)
2009-11-20 01:26 UTC, Halton Huo
Details | Splinter Review
Merge multi-seat branch into master (190.63 KB, application/octet-stream)
2010-01-27 23:09 UTC, Halton Huo
Details
Multi-seat branch patcn based on 0.4.1 tarball (194.42 KB, patch)
2010-07-06 00:58 UTC, Halton Huo
Details | Splinter Review
multi-seat branch based on git-master c9f2292339540d4b9d8940bcef16b7485480c8d9 (191.67 KB, patch)
2010-07-07 01:30 UTC, Halton Huo
Details | Splinter Review
updated patch (190.56 KB, patch)
2010-09-17 11:27 UTC, Brian Cameron
Details | Splinter Review
This is the latest patch that we use with ConsoleKit 0.4.1 (193.05 KB, application/octet-stream)
2010-09-22 15:25 UTC, Brian Cameron
Details
Updated ConsoleKit patch for 0.4.1 (194.99 KB, patch)
2011-02-24 23:16 UTC, Brian Cameron
Details | Splinter Review
Updated patch for ConsoleKit 0.4.2. (192.50 KB, patch)
2011-02-24 23:18 UTC, Brian Cameron
Details | Splinter Review
Updated patch for ConsoleKit 0.4.1 (204.93 KB, patch)
2011-07-15 18:52 UTC, Brian Cameron
Details | Splinter Review
Updated patch for ConsoleKit 0.4.5 (201.67 KB, patch)
2011-07-15 18:52 UTC, Brian Cameron
Details | Splinter Review
Sunray.display file (87 bytes, text/plain)
2011-07-15 18:53 UTC, Brian Cameron
Details
Updated patch for ConsoleKit 0.4.1 (209.11 KB, patch)
2011-12-15 19:57 UTC, Brian Cameron
Details | Splinter Review
Updated patch for ConsoleKit 0.4.5 (207.28 KB, patch)
2011-12-15 19:59 UTC, Brian Cameron
Details | Splinter Review
ck-seat-tool man page (6.35 KB, text/plain)
2012-05-08 10:04 UTC, Brian Cameron
Details
console-kit-daemon man page (19.17 KB, text/plain)
2012-05-08 10:04 UTC, Brian Cameron
Details

Description Halton Huo 2008-12-29 19:27:43 UTC
This is a feature requested by new GDM, which is to add gdmdynamic supporting in GDM. Refer to bug http://bugzilla.gnome.org/show_bug.cgi?id=536355. 

There are two options to achieve this goal.

Option #1: Implement in ConsoleKit and GDM code. Add ck-dynamic in ConsoleKit, 

        Xserver
           ^
           |  STEP 4: Create/Kill a Xsession on ":101"
           |
      gdm-binary (Listern for event from ConsoleKit)
           ^
           |  STEP 3:  Signal CreateDisplay/RemoveDisplay event 
           |            with display ":101"
    _ _ _ _|              
   |                                                           ck-dynamic
   |                                                            |       ^
   |     __ __ __ __ __ __ __ __ __ __ __  __ __ __ __ __ __ __ |       |
   |    |                                                               |
   |    |     STEP 2:  Require to CreateSession/RemoveSession           |      
   |    |              with display ":101"                              |
   |    |                                                               |
   |    V     STEP 1: Call ck-dynamic when a display, e.g. ":101",      |
ConsoleKit            is added/removed.                                 |
                                                                        |
                                                               Xmgr/gdm Script


1. gdm-binary to listen for CreateDynamicDisplay/RemoveDynamicDisplay event to org.gnome.DisplayManager.LocalDisplayFactory
2. console-kit-daemon to listen for CreateSession/RemoveSession/ListenCreatedSessions events to org.freedesktop.ConsoleKit.Manager
3. ListenCreatedSessions only talks to ConsoleKit
4. gdmdynamic is a script wrapper for ck-dynamic


Option #2: Implement inside GDM code.


 Xserver
    ^
    |  STEP 4: Create/Kill  Xserver regarding ":101"
    |
 gdm-binary (Listern for event from ConsoleKit)
    ^    ^
    |    |__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ 
    |                                                                  |
    |  STEP 3:  Register/Unregister a X session                        |
    |           corresponding to ":101"                                |
    |                                                                  |
    |  STEP 2: Require GDM to start/terminate Xsession for ":101"      |
    |                                                                  |
    |                                                              gdmdynamic
    |                                                                  |
    V        STEP 1: Call gdmdyncmic when a display, e.g. ":101",      |
ConsoleKit           is added/removed.                                 |
                                                                Xmgr/gdm Script

Option #2 is how patch in http://bugzilla.gnome.org/show_bug.cgi?id=536355#c5 does.
Comment 1 Halton Huo 2008-12-29 19:30:11 UTC
Created attachment 21560 [details] [review]
patch for bug #19333

This patch is for option #1, ConsoleKit part.

ck-dynamic work likes old gdmdynamic in http://bugzilla.gnome.org/show_bug.cgi?id=536355#c5. Following options are supportted:
    
      -a, --add=display        Add a new display
      -d, --delete=display     Delete a display
      -l, --list               List all attached displays
      -r, --release            Release (run) all displays waiting in the DISPLAY_CONFIG state
      -v, --verbose            Verbose mode
      -V, --version            Version of this application
    
    -a, -d, -l, -V are supportted. -r and -v are no-op by now

Brian said ConsoleKit maintainer mccann think option #1 is better.
Comment 2 Halton Huo 2008-12-29 19:43:28 UTC
This patch is tested on Solaris + SunRay 4.1, so far so good.

Note, according http://projects.gnome.org/gdm/docs/2.20/binaries.html#gdmdynamiccommandline, 'ck-dynamic -l' does not accept pattern anymore. It is mainly because xserver_command does not passed to ConsoleKit and I do not think it is very useful.

If you think we need add pattern back, I can re-work on the patch.
Comment 3 Halton Huo 2009-04-09 03:41:56 UTC
Created attachment 24683 [details] [review]
multi-seat and multi-display patch for ConsoleKit

With discussion with gdm-list, we comes out a design for multi-seat and multi-display support. The design is located at http://wiki.genunix.org/wiki/index.php/design_for_newgdm_consolekit_multiseat_multidisplay.

This patch is part for ConsoleKit, based on 0.3.0 tarball release.
Comment 4 Halton Huo 2009-06-04 19:45:50 UTC
Created attachment 26451 [details] [review]
reworked patch after Ray's review on CK's patch

There are multiple changes which are based on review by Ray Strode,
http://mail.gnome.org/archives/gdm-list/2009-May/msg00007.html

1 Use separate .disp file for display type, remove display-types.conf
  install .disp files to /etc/ConsoleKit/displays.d/,
  each .disp file represent a display type.
2 Only use Command in .disp file, remove Arguments/UseAuth/Chooser/Priority
3 Remove priority code
4 When adding/removing displays, CK should emit signal instead of
  calling GDM method directly
  For org.freedesktop.ConsoleKit.Seat
     add signal  SessionToAdd and SessionToRemove
     add method  ManageSeat
  For org.freedesktop.ConsoleKit.Manager
     remove method CreateStaticSessions
     add method GetUnmanagedSeats
5 Use a{sv} for dbus method CreateDisplay, since
  task #2 is done, there are only two parameters need to be send with
  signal, this work is not necessary
6 Rewrite ck-dynamic to reflect change in task #4
7 Rewrite ck_display_type_new()
8 Remove method org.freedesktop.ConsoleKit.Manager.ListCreatedSessions.
  Let ck-dynamic do the GetSeats() and filtering dynamic displays itself
9 make ck_seat_add_display(), ck_seat_set_display_type() and ck_seat_get_displ
  return a gbooolean
10 Remove unused create_display_with_parameters()
11 Comments should appear before the lines they're commenting on, not after.
12 Reverse Name and Version back
13 Figure out X11_DIR from pkg-config

This patch is reworked under branch multi-seat by commit 25145f35ab527a2219604e1710eb65e2178f6978
Comment 5 Brian Cameron 2009-09-14 12:06:42 UTC
Created attachment 29538 [details] [review]
updated patch


The latest patch.
Comment 6 Brian Cameron 2009-10-08 09:57:45 UTC
Created attachment 30167 [details] [review]
updated patch

Latest version of the patch.
Comment 7 Halton Huo 2009-11-05 02:19:22 UTC
Created attachment 30977 [details] [review]
updated patch

Update patch based on git-master 01e8cbff0f4dc50f24611d3ede20b62343fac976. This patch also can be applied on 0.4.1 tarball.
Comment 8 Halton Huo 2009-11-11 19:47:33 UTC
Created attachment 31124 [details] [review]
Merge multi-seat branch into master

This patch is reworked with git-master 48b4b2d1174db98ee87ea4e71f4a21221043ca3f. synced with multi-seat branch commit 56d275968f8d9c866a9b69b0dcf769aba0e619af.
Comment 9 Halton Huo 2009-11-20 01:26:38 UTC
Created attachment 31332 [details] [review]
Merge multi-seat branch into master

This patch is reworked with git-master 48b4b2d1174db98ee87ea4e71f4a21221043ca3f. It is synced with multi-seat branch commit f1bbdd6526e6cbceae93be941930808bd1f90a69.
Comment 10 Halton Huo 2010-01-27 23:09:26 UTC
Created attachment 32865 [details]
Merge multi-seat branch into master

This patch is reworked with git-master http://cgit.freedesktop.org/ConsoleKit/commit/?id=2418840248f07025ad0edc96ed17e03ce5e47f3e.

It is synced with multi-seat branch commit http://cgit.freedesktop.org/ConsoleKit/commit/?h=multi-seat&id=65d70ecd4070c1e34be24f7b050b094c76bb614b
Comment 11 Riccardo Magliocchetti 2010-06-17 02:49:46 UTC
Hello, any update on this?
Comment 12 Halton Huo 2010-07-06 00:58:09 UTC
Created attachment 36782 [details] [review]
Multi-seat branch patcn based on 0.4.1 tarball

This patch is reworked with git-master
http://cgit.freedesktop.org/ConsoleKit/commit/?id=c9f2292339540d4b9d8940bcef16b7485480c8d9.

It is synced with multi-seat branch commit
http://cgit.freedesktop.org/ConsoleKit/commit/?h=multi-seat&id=1795a7eb7b1ba2f43a918d2541bf0b5814b80671
Comment 13 Halton Huo 2010-07-07 01:28:52 UTC
Comment on attachment 36782 [details] [review]
Multi-seat branch patcn based on 0.4.1 tarball

The attachment #36782 [details] [review] is based on 0.4.1 tarball, not on git-master.
Comment 14 Halton Huo 2010-07-07 01:30:05 UTC
Created attachment 36798 [details] [review]
multi-seat branch based on git-master c9f2292339540d4b9d8940bcef16b7485480c8d9

This patch is reworked with git-master
http://cgit.freedesktop.org/ConsoleKit/commit/?id=c9f2292339540d4b9d8940bcef16b7485480c8d9.

It is synced with multi-seat branch commit
http://cgit.freedesktop.org/ConsoleKit/commit/?h=multi-seat&id=1795a7eb7b1ba2f43a918d2541bf0b5814b80671
Comment 15 John Haxby 2010-09-17 07:57:19 UTC
With this patch, this causes a crash:

  qdbus --system \
    org.freedesktop.ConsoleKit
    /org/freedesktop/ConsoleKit/SessionStaticSeat1Local \
    org.freedesktop.DBus.Introspectable.Introspect

The problem seems to be that src/org.freedesktop.ConsoleKit.Session.xml contains definitions for the properties "session", "is-open" and "is-dynamic" but there's no corresponding code for them and so console-kit-daemon crashes when it tries to build the xml.

There's some code for "is-open" but it looks as though it falls short of actually calling g_object_class_install_property().

There are other properties defined by the code (display-template, display-variables, ever-open and seat-id?) that are defined by the code but not in src/org.freedesktop.ConsoleKit.Session.xml.

I'm unsure what the best way forward is here: should the three undefined properties be simply removed from the xml or should there be code put in place to support them (even though they're not used). And should the extra properties be defined in the xml?
Comment 16 Brian Cameron 2010-09-17 11:27:47 UTC
Created attachment 38768 [details] [review]
updated patch

Here is the latest patch that we are using on Solaris which builds against ConsoleKit 0.4.2.
Comment 17 Brian Cameron 2010-09-17 11:29:33 UTC
I think the is_dynamic code is unused and could likely be removed.  Not sure about the best thing to do with the is_open code.

I just attached the latest patch that we use with Solaris.  It doesn't address the issues you raised, but it does have a few minor bug fixes.
Comment 18 Brian Cameron 2010-09-22 15:25:56 UTC
Created attachment 38890 [details]
This is the latest patch that we use with ConsoleKit 0.4.1

This is the latest patch we use with ConsoleKit 0.4.1 in case people are using the older version of ConsoleKit.
Comment 19 Brian Cameron 2011-02-24 23:16:04 UTC
Created attachment 43782 [details] [review]
Updated ConsoleKit patch for 0.4.1

Updated patch for 0.4.1.  This fixes the open-session-request and 
close-session-request signals in the ck-seat.c code is better defined which 
avoids warning messages like these going to the syslog.

WARNING: signal "open_session_request" (from "OpenSessionRequest") exported but not found in object class "CkSeat"
WARNING: signal "close_session_request" (from "CloseSessionRequest") exported but not found in object class "CkSeat"
Comment 20 Brian Cameron 2011-02-24 23:18:46 UTC
Created attachment 43783 [details] [review]
Updated patch for ConsoleKit 0.4.2.
Comment 21 Brian Cameron 2011-07-15 18:52:03 UTC
Created attachment 49167 [details] [review]
Updated patch for ConsoleKit 0.4.1

I have done a lot of work improving the robustness of the MultiSeat patch and it is now working a lot better.  I recommend using this patch with ConsoleKit 0.4.1.
Comment 22 Brian Cameron 2011-07-15 18:52:49 UTC
Created attachment 49168 [details] [review]
Updated patch for ConsoleKit 0.4.5

Or this patch with ConsoleKit 0.4.5
Comment 23 Brian Cameron 2011-07-15 18:53:58 UTC
Created attachment 49169 [details]
Sunray.display file

If you want to use this with Sun Ray, note you need to install this configuration file as /etc/ConsoleKit/displays.d/Sunray.display.  This just simply configures the Xserver for Sun Ray to use.
Comment 24 Brian Cameron 2011-12-15 19:57:49 UTC
Created attachment 54478 [details] [review]
Updated patch for ConsoleKit 0.4.1

This updated patch addresses some robustness issues, fixing the code so that it will not try to respawn displays when the Xserver fails.
Comment 25 Brian Cameron 2011-12-15 19:59:40 UTC
Created attachment 54479 [details] [review]
Updated patch for ConsoleKit 0.4.5

Updated patch for 0.4.5.  Note that this code is now maintained upstream in the wip/multi-seat branch:

  http://cgit.freedesktop.org/ConsoleKit/log/?h=wip/multi-seat
Comment 26 Brian Cameron 2012-04-19 17:32:01 UTC
Note that the latest code for this feature is now here in a branch in GIT. 
This makes more sense than updating the patches here.  The patches are
obsolete:

http://cgit.freedesktop.org/ConsoleKit/log/?h=wip/multi-seat
Comment 27 Lóránt Farkas 2012-05-07 01:44:10 UTC
Hello!

I'm
Comment 28 Lóránt Farkas 2012-05-07 01:59:54 UTC
Hello!

I'm quite new in this topic. I'd like to know whether this new patch can help with kdm, or other display manager?

I running two separate X server on my system (real multiseat with different input/outputs, started by systemd), and the second server didn't get any seat-id. I know the master branch of ConsoleKit can't handle it, and I had figured out that the ck-seat-tools program could handle this. 

If I try to start a new seat with the command:

"ck-seat-tool -a --display-type Local"

from the console then I get the next message:

"Seat /org/freedesktop/ConsoleKit/Seat1 with session /org/freedesktop/ConsoleKit/Session1 has been added"

but systemd-loginctl doesn't show up any new seat.

Could you give some hint how/where ck-seat-tools can be used?

Another problem: if I start the command:

"ck-seat-tool -a --display-type Local --seat-id seatmon"

from graphical console then I get an error:

"** (ck-seat-tool:1637): WARNING **: Unable to add seat: Rejected send message, 2 matched rules; type="method_call", sender=":1.45" (uid=1000 pid=1637 comm="ck-seat-tool -a --display-type Local --seat-id sea") interface="org.freedesktop.ConsoleKit.Manager" member="AddSeatById" error name="(unset)" requested_reply="0" destination="org.freedesktop.ConsoleKit" (uid=0 pid=954 comm="/usr/sbin/console-kit-daemon --no-daemon ")"
Comment 29 Brian Cameron 2012-05-08 10:04:01 UTC
Note that to use this branch of ConsoleKit you also need to use the wip/multi-seat version of GDM.  Refer here: 

  http://bugzilla.gnome.org/show_bug.cgi?id=536355

The ck-seat-tool command runs the Xserver command in /etc/ConsoleKit/displays.d/(DISPLAY_TYPE).display where (DISPLAY_TYPE) cooresponds to the value passed in via ck-seat-tool.  You should verify that the command being run is valid.

If it isn't working, try running console-kit-daemon with the --debug option.

I have attached the ck-seat-tool and console-kit-daemon man pages which explain how this works for reference.

If this does not give you enough hints, contact me at brian.cameron@oracle.com and I am happy to trade emails with you rather than cluttering up this bug report.
Comment 30 Brian Cameron 2012-05-08 10:04:24 UTC
Created attachment 61244 [details]
ck-seat-tool man page
Comment 31 Brian Cameron 2012-05-08 10:04:45 UTC
Created attachment 61245 [details]
console-kit-daemon man page


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.