From 81efb06506456a260d63b77e3dda1216041b5bb3 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 5 Feb 2020 15:20:48 -0500 Subject: [PATCH 2/3] gdm-x-session: run session bus on non-seat0 seats GNOME doesn't deal very well with multiple sessions running on a multiple seats at the moment. Until that's fixed, ensure sessions run on auxillary seats get their own session bus. --- daemon/gdm-session.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c index 5c5903a49..c891fb577 100644 --- a/daemon/gdm-session.c +++ b/daemon/gdm-session.c @@ -2811,119 +2811,128 @@ on_start_program_cb (GdmDBusWorker *worker, if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; self = conversation->session; service_name = conversation->service_name; if (worked) { self->session_pid = pid; self->session_conversation = conversation; g_debug ("GdmSession: Emitting 'session-started' signal with pid '%d'", pid); g_signal_emit (self, signals[SESSION_STARTED], 0, service_name, pid); } else { gdm_session_stop_conversation (self, service_name); g_debug ("GdmSession: Emitting 'session-start-failed' signal"); g_signal_emit (self, signals[SESSION_START_FAILED], 0, service_name, error->message); } } void gdm_session_start_session (GdmSession *self, const char *service_name) { GdmSessionConversation *conversation; GdmSessionDisplayMode display_mode; gboolean is_x11 = TRUE; gboolean run_launcher = FALSE; gboolean allow_remote_connections = FALSE; + gboolean run_separate_bus = FALSE; char *command; char *program; gboolean register_session; g_return_if_fail (GDM_IS_SESSION (self)); g_return_if_fail (self->session_conversation == NULL); conversation = find_conversation_by_name (self, service_name); if (conversation == NULL) { g_warning ("GdmSession: Tried to start session of " "nonexistent conversation %s", service_name); return; } stop_all_other_conversations (self, conversation, FALSE); display_mode = gdm_session_get_display_mode (self); #ifdef ENABLE_WAYLAND_SUPPORT is_x11 = g_strcmp0 (self->session_type, "wayland") != 0; #endif if (display_mode == GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED || display_mode == GDM_SESSION_DISPLAY_MODE_NEW_VT) { run_launcher = TRUE; } register_session = !gdm_session_session_registers (self); + if (g_strcmp0 (priv->display_seat_id, "seat0") != 0 && !run_launcher) { + run_separate_bus = TRUE; + } + if (self->selected_program == NULL) { gboolean run_xsession_script; command = get_session_command (self); run_xsession_script = !gdm_session_bypasses_xsession (self); if (self->display_is_local) { gboolean disallow_tcp = TRUE; gdm_settings_direct_get_boolean (GDM_KEY_DISALLOW_TCP, &disallow_tcp); allow_remote_connections = !disallow_tcp; } else { allow_remote_connections = TRUE; } if (run_launcher) { if (is_x11) { program = g_strdup_printf (LIBEXECDIR "/gdm-x-session %s%s %s\"%s\"", register_session ? "--register-session " : "", run_xsession_script? "--run-script " : "", allow_remote_connections? "--allow-remote-connections " : "", command); } else { program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s\"", register_session ? "--register-session " : "", command); } } else if (run_xsession_script) { - program = g_strdup_printf (GDMCONFDIR "/Xsession \"%s\"", command); + if (run_separate_bus) { + program = g_strdup_printf ("dbus-run-session -- " GDMCONFDIR "/Xsession \"%s\"", command); + } else { + program = g_strdup_printf (GDMCONFDIR "/Xsession \"%s\"", command); + } } else { program = g_strdup (command); } g_free (command); } else { /* FIXME: * Always use a separate DBus bus for each greeter session. * Firstly, this means that if we run multiple greeter session * (which we really should not do, but have to currently), then * each one will get its own DBus session bus. * But, we also explicitly do this for seat0, because that way * it cannot make use of systemd to run the GNOME session. This * prevents the session lookup logic from getting confused. * This has a similar effect as passing --builtin to gnome-session. * * We really should not be doing this. But the fix is to use * separate dynamically created users and that requires some * major refactorings. */ if (run_launcher) { if (is_x11) { program = g_strdup_printf (LIBEXECDIR "/gdm-x-session %s\"dbus-run-session -- %s\"", register_session ? "--register-session " : "", self->selected_program); } else { program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"dbus-run-session -- %s\"", register_session ? "--register-session " : "", self->selected_program); } -- 2.31.1