Created attachment 159801 [details] consolekit 1.0.0 patch Bug to get some more exposure to the consolekit update.
(In reply to Koop Mast from comment #0) I wonder, why not to use the real tarball (available in release directory) instead "snapshot"?
well the "snapshot" is from the release tag. Duno, I feel doing it via the USE_GITHUB stuff better fitting, but yes the release tarballs are autotooled already. I must say I didn't notice that difference.
I found a regression. ck-list-session doesn't report a active session. So will have to track that down first.
Created attachment 165629 [details] ConsoleKit2 1.0.1 patch New release 1.0.1 was published. Patch is based on port available in Xfce devel repository.
(In reply to Koop Mast from comment #3) I think I can shed some light on the issue of inactive X11 sessions launched with ck-launch-session (e.g not a display manager like x11/slim which uses libck-connector.so directly (no pam) I have not looked carefully into the pam_ck_connector.so situation. In src/ck-sysdeps-unix.c only the HAVE_GETPEEREID is compiled. e.g no pid returned. I also found that the "v" is missing in the ttyv device file names: +++ tools/ck-get-x11-display-device.c @@ -140,6 +140,9 @@ get_tty_for_display (Display *xdisplay) #if defined(__NetBSD__) display = g_strdup_printf ("/dev/ttyE%ld", vt - 1); +#elif defined(__FreeBSD__) + display = g_strdup_printf ("/dev/ttyv%ld", vt - 1); + #else display = g_strdup_printf ("/dev/tty%ld", vt); #endif after cc -E the function becomes: ck_get_socket_peer_credentials (int socket_fd, pid_t *pid, uid_t *uid, GError **error) { gboolean ret; uid_t uid_read; pid_t pid_read; pid_read = -1; uid_read = -1; ret = (0); gid_t dummy; if (getpeereid (socket_fd, &uid_read, &dummy) == 0) { ret = (!(0)); } else { g_log (((gchar*) 0), G_LOG_LEVEL_WARNING, "Failed to getpeereid() credentials: %s\n", g_strerror ((* __error()))); } if (pid != ((void *)0)) { *pid = pid_read; } if (uid != ((void *)0)) { *uid = uid_read; } return ret; }
Created attachment 179377 [details] Update to consolekit 1.0.2 with active session working better. Since it is not possible to get the pid over the socket see #comment5 , as on linux and other systems I have added another call to kvm_getprocs, pointed out to me by Olivier Duchateau, to get a pid. It takes the uid from getpeereid and uses it as an filter to kvm_getprocs iterate until it finds a Xorg process by name and stores the pid. How is that done better? Since device = get_tty_for_pid (pid) seems to return the tty on which xinit/startx was invoked, I've switched the order of calls to device = get_tty_for_pid (pid); and device = get_tty_for_display (xdisplay); This ensures that the active tty equals the tty_for_display when in X as a physical seat/user. This patch is highly based on the xfce consolekit1.0.2 version by the xfce team also posted here, but it is made against ports r432633
(In reply to Jesper Schmitz Mouridsen from comment #6) Not tested your patch, but there's fix [1] for session activation for 10.3 and higher. [1] https://github.com/ConsoleKit2/ConsoleKit2/commit/9dab562ffd7bd281dfb076f583f99831ebf26fe1
Created attachment 179399 [details] Update to consolekit 1.0.2 with active sessions working. This is another approach. I have narrowed the problem down. On Linux the X process' control tty is the same as Xfree86_VT (e.g the display device). On FreeBSD it is the invoking tty. e.g startx on /dev/ttyv1 the Xorg procees' tt is ttyv1 even though Xfree86_VT is vt9 Inspired by http://unix.stackexchange.com/questions/32884/which-virtual-terminal-is-a-given-x-process-running-on I use libprocstat to read the actual display device from pid. e.g no need to only use the root window property XFree86_VT as in my previous patch. This needs the ck-get-x11-display-device to be setuid root. The Makefile reflects/sets this. Another problem was that the active tty is returned as full path and display-deivce was only ttyvX. I have prefixed display-device with "/dev/" ck-sysdeps-freebsd.c @@ -128,7 +128,7 @@ ck_process_stat_get_tty (CkProcessStat *stat) { g_return_val_if_fail (stat != NULL, NULL); - return g_strdup (stat->tty_text); + return g_strdup_printf("/dev/%s",stat->tty_text); } Furhermore I have reverted the use of consolectl as it does not work on 11-RELEASE. I have not tested on 10.
Created attachment 179906 [details] Patch to update sysutils/consolekit to sysutils/consolekit2 1.0.2 I have been using this patch for a few days now, and it works well. Please let me know if you have any comments, and results from any testing.
(In reply to Ben Woods from comment #9) Well you still do not get an active session in X (with ck-launch) Session2: unix-user = '1001' realname = 'Jesper' seat = 'Seat3' session-type = '' active = FALSE x11-display = ':0' x11-display-device = '' display-device = 'ttyv0' remote-host-name = '' is-local = TRUE on-since = '2017-02-12T17:49:34.008977Z' login-session-id = '' I notice your workaround to add 50-shutdown.rules At least for lxqt-leave i had to copy that file to /usr/local/share/polkit-1/rules.d and not only in /usr/local/etc/polkit-1/rules.d I do not know if this is better than trying to actually get an active session, and then have power privileges as per default rules.. With your solution one can shutdown from remote as an operator. I do not think this is the intention with consolekit..e.g per default only active sessions have control over power..
I believe I tried your patch as well and did not get an active session either. I will try again. I just recently fixed a bug which allows the polkit rules to go in /usr/local/etc/polkit-1/rules.d: http://svnweb.freebsd.org/changeset/ports/433951 Yes my patch also includes the 50-shutdown.rules file which allows users in a graphical session to shutdown if they are a member of the operators group. It is my understanding that without this file, users in the operators group cannot shutdown the PC using the graphical interface, but could open a terminal and successfully use the shutdown(8) command. I see no reason to allow something on the console but not graphically, so I included it by default to improve the desktop experience. https://www.freebsd.org/doc/handbook/boot-shutdown.html
Also, I did not mean to sound unappreciative for your patch - thank you for your work and I will try again to confirm if it is working. I am using the lightdm login manager, but will try with a few others also.
(In reply to Ben Woods from comment #11) Ben, I think it's bad idea to change content of 50-shutdown.rules (by default only wheel group or root user can apply any rules). Polkit reads rules by sorting the files in lexical order based on the basename. I create new rule 05-shutdown.rules and I can reboot/shutdown my PC (with another group of operator). It works fine under Xfce, LXDE and LXQt sessions. Moreover it is explicitly described in pkg-message.
I have picked up the patch from #8 and fix some small nits in it (whitespace, a few things ports QA complained about). Currently it works fine from gdm. I haven't tested startx yet. About renaming the port, I wasn't so sure but it makes sense. Currently I got a active session and I'm able to reboot/shutdown the computer from gnome/gdm. But gdm might do that directly instead of invoking consolekit for that. I'm not so sure about the 50-shutdown polkit file yet. Good catch with the polkit permissions directory!
Created attachment 184573 [details] Update to 1.2.0 The work from comment #8 has been taken by upstream and released in 1.2.0 https://github.com/ConsoleKit2/ConsoleKit2/commit/2095226293fc8d13e3fad30ca83d50d8692abc37
Created attachment 184578 [details] Patch to update sysutils/consolekit from Xfce repository Patch from the Xfce repository - Update to 1.2.0 - Adjust dependencies ConsoleKit2 has been ported to GDbus, so dbus-glib is not anymore required, add support of Gobject Introspection for desktops environment such Pantheon or Deepin. - Remove unneeded patches
Hi, thanks for your patches. I have been testing them and I'm almost ready to commit them! The only thing I'm pondering is the "session controller" stuff. It seems to depend on udev and/or libevdev being present, seems to prefer udev by default. And "HAVE_LIBDRM" is only present in a udev file, in src/ck-device-udev.c. So we either have missing dependancies or we should disable udev/evdev (for now) and remove the libdrm dependancy. Beyond ck-list-sessions, which seems to report something usefull, I have no idea how to really test this more. kwm@crashalot:~ % ck-list-sessions Session1: unix-user = '1001' realname = 'Koop Mast' seat = 'Seat1' session-type = 'unspecified' session-class = 'user' session-state = 'active' active = TRUE x11-display = ':0' x11-display-device = '/dev/ttyv8' display-device = '/dev/ttyv1' remote-host-name = '' is-local = TRUE on-since = '2017-08-04T19:09:14.936559Z' login-session-id = '' XDG_RUNTIME_DIR = '/var/run/user/1001' VTNr = '9'
(In reply to Koop Mast from comment #17) Yes, you can remove librm.
A commit references this bug: Author: kwm Date: Sat Aug 5 10:58:49 UTC 2017 New revision: 447399 URL: https://svnweb.freebsd.org/changeset/ports/447399 Log: Update consolekit to 1.2.0. * Rename consolekit to consolekit2 to reflect that consolekit2 is a new project, even if it the continuation of the old consolekit project. * Expand pkg-descr with some background info. * Add license * ConsoleKit2 has been ported to GDbus, so dbus-glib is not anymore required * Add GObject introspection support for desktops environment such Pantheon or Deepin. * Thanks to Jesper Schmitz Mouridsen, Ben Woods and Olivier Duchateau for assisting with there versions of the port, suggesting changes and testing. PR: 202269 Changes: head/MOVED head/audio/pulseaudio/Makefile head/sysutils/consolekit/ head/sysutils/consolekit2/ head/sysutils/consolekit2/Makefile head/sysutils/consolekit2/distinfo head/sysutils/consolekit2/files/ head/sysutils/consolekit2/pkg-descr head/sysutils/consolekit2/pkg-plist head/sysutils/hal/Makefile head/www/gnome-user-share/Makefile head/x11/cinnamon-session/Makefile head/x11/gdm/Makefile head/x11/gnome-session/Makefile head/x11/kde4-workspace/Makefile head/x11/lightdm/Makefile head/x11/mate-session-manager/Makefile head/x11/slim/Makefile head/x11-wm/lxsession/Makefile head/x11-wm/xfce4-session/Makefile
Update summary to reflect actual changes, assign to committer that resolved
(In reply to commit-hook from comment #19) Ack! consolekit is now orphaned and I see nothing explaining this in UPDATING. If I delete consolekit, pkg wants to delete 30 other ports. Looking at the commit message, I suspect that I really only need to reset the origin of consolekit to consolekit2, but I am not sure that noting else is required. On systems using packages, it looks like all that happened was to delete consolekit and install consolekit2, which would seem to confirm that an update with origin change is all that is needed.
Hi Kevin, I can confirm that all that is required is to replace sysutils/consolekit with sysutils/consolekit2. Regards, Ben
(In reply to Ben Woods from comment #22) Proposed language for ports/UPDATING: sysutils/consolekit2 has replaced consolekit. Those installing packages need take no special action. Those using portmaster or portupgrade should update the origin: # portmaster -o sysutils/consolekit2 consolekit or # portupgrade -o sysutils/consolekit2 consolekit
MARKED AS SPAM