From 5c52259331ce0b37dd1b2b092ff41f96b0e5ce64 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 29 Oct 2018 06:57:59 -0400
Subject: [PATCH] local-display-factory: pause for a few seconds before falling
back to X
logind currently gets confused if a session is started immediately as
one is shutting down.
Workaround this problem by adding an artificial delay when falling
back to X.
http://bugzilla.redhat.com/1643874
---
daemon/gdm-local-display-factory.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index 0bb3851f1..297c3ac80 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -586,60 +586,67 @@ ensure_display_for_seat (GdmLocalDisplayFactory *factory,
preferred_display_server = get_preferred_display_server (factory);
if (g_strcmp0 (preferred_display_server, "none") == 0) {
g_debug ("GdmLocalDisplayFactory: Preferred display server is none, so not creating display");
return;
}
ret = sd_seat_can_graphical (seat_id);
if (ret < 0) {
g_critical ("Failed to query CanGraphical information for seat %s", seat_id);
return;
}
if (ret == 0) {
g_debug ("GdmLocalDisplayFactory: System doesn't currently support graphics");
seat_supports_graphics = FALSE;
} else {
g_debug ("GdmLocalDisplayFactory: System supports graphics");
seat_supports_graphics = TRUE;
}
if (g_strcmp0 (seat_id, "seat0") == 0) {
is_seat0 = TRUE;
falling_back = factory->num_failures > 0;
session_type = gdm_local_display_factory_get_session_type (factory, falling_back);
g_debug ("GdmLocalDisplayFactory: New displays on seat0 will use %s%s",
session_type, falling_back? " fallback" : "");
+
+ if (falling_back) {
+ /* workaround logind race for now
+ * bug 1643874
+ */
+ g_usleep (2 * G_USEC_PER_SEC);
+ }
} else {
is_seat0 = FALSE;
g_debug ("GdmLocalDisplayFactory: New displays on seat %s will use X11 fallback", seat_id);
/* Force legacy X11 for all auxiliary seats */
seat_supports_graphics = TRUE;
session_type = "x11";
}
/* For seat0, we have a fallback logic to still try starting it after
* SEAT0_GRAPHICS_CHECK_TIMEOUT seconds. i.e. we simply continue even if
* CanGraphical is unset.
* This is ugly, but it means we'll come up eventually in some
* scenarios where no master device is present.
* Note that we'll force an X11 fallback even though there might be
* cases where an wayland capable device is present and simply not marked as
* master-of-seat. In these cases, this should likely be fixed in the
* udev rules.
*
* At the moment, systemd always sets CanGraphical for non-seat0 seats.
* This is because non-seat0 seats are defined by having master-of-seat
* set. This means we can avoid the fallback check for non-seat0 seats,
* which simplifies the code.
*/
if (is_seat0) {
if (!seat_supports_graphics) {
if (!factory->seat0_graphics_check_timed_out) {
if (factory->seat0_graphics_check_timeout_id == 0) {
g_debug ("GdmLocalDisplayFactory: seat0 doesn't yet support graphics. Waiting %d seconds to try again.", SEAT0_GRAPHICS_CHECK_TIMEOUT);
factory->seat0_graphics_check_timeout_id = g_timeout_add_seconds (SEAT0_GRAPHICS_CHECK_TIMEOUT,
--
2.30.1