From 01cbfb3cc01aead61f3e97f2643b0813672d90a0 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Aug 29 2023 16:20:36 +0000 Subject: Add crash fix, initial-setup fix, and simpledrm fix --- diff --git a/0001-Clearing-signal-handler-after-udev-settle-or-timeout.patch b/0001-Clearing-signal-handler-after-udev-settle-or-timeout.patch new file mode 100644 index 0000000..ea770ed --- /dev/null +++ b/0001-Clearing-signal-handler-after-udev-settle-or-timeout.patch @@ -0,0 +1,79 @@ +From 7f5fe3848efe2e6b5a8c5a4fb952990759f3ca59 Mon Sep 17 00:00:00 2001 +From: Ghadi Rahme +Date: Wed, 28 Jun 2023 17:07:12 +0000 +Subject: [PATCH] Clearing signal handler after udev settle or timeout to avoid + sudden logout + +--- + daemon/gdm-local-display-factory.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c +index 471e1b460..c10c1ef6c 100644 +--- a/daemon/gdm-local-display-factory.c ++++ b/daemon/gdm-local-display-factory.c +@@ -628,60 +628,61 @@ lookup_prepared_display_by_seat_id (const char *id, + status = gdm_display_get_status (display); + + if (status != GDM_DISPLAY_PREPARED) + return FALSE; + + return lookup_by_seat_id (id, display, user_data); + } + + #ifdef HAVE_UDEV + static gboolean + udev_is_settled (GdmLocalDisplayFactory *factory) + { + g_autoptr (GUdevEnumerator) enumerator = NULL; + GList *devices; + GList *node; + + gboolean is_settled = FALSE; + + if (factory->seat0_has_platform_graphics) { + g_debug ("GdmLocalDisplayFactory: udev settled, platform graphics enabled."); + return TRUE; + } + + if (factory->seat0_has_boot_up_graphics) { + g_debug ("GdmLocalDisplayFactory: udev settled, boot up graphics available."); + return TRUE; + } + + if (factory->seat0_graphics_check_timed_out) { + g_debug ("GdmLocalDisplayFactory: udev timed out, proceeding anyway."); ++ g_clear_signal_handler (&factory->uevent_handler_id, factory->gudev_client); + return TRUE; + } + + g_debug ("GdmLocalDisplayFactory: Checking if udev has settled enough to support graphics."); + + enumerator = g_udev_enumerator_new (factory->gudev_client); + + g_udev_enumerator_add_match_name (enumerator, "card*"); + g_udev_enumerator_add_match_tag (enumerator, "master-of-seat"); + g_udev_enumerator_add_match_subsystem (enumerator, "drm"); + + devices = g_udev_enumerator_execute (enumerator); + if (!devices) { + g_debug ("GdmLocalDisplayFactory: udev has no candidate graphics devices available yet."); + return FALSE; + } + + node = devices; + while (node != NULL) { + GUdevDevice *device = node->data; + GList *next_node = node->next; + g_autoptr (GUdevDevice) platform_device = NULL; + g_autoptr (GUdevDevice) pci_device = NULL; + + platform_device = g_udev_device_get_parent_with_subsystem (device, "platform", NULL); + + if (platform_device != NULL) { + g_debug ("GdmLocalDisplayFactory: Found embedded platform graphics, proceeding."); + factory->seat0_has_platform_graphics = TRUE; + is_settled = TRUE; +-- +2.41.0.rc2 + diff --git a/0001-daemon-Specify-DCONF_PROFILE-for-initial-setup.patch b/0001-daemon-Specify-DCONF_PROFILE-for-initial-setup.patch new file mode 100644 index 0000000..fd97e93 --- /dev/null +++ b/0001-daemon-Specify-DCONF_PROFILE-for-initial-setup.patch @@ -0,0 +1,104 @@ +From 1580f05a56b671950a23d267c815a977cd56655b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Florian=20M=C3=BCllner?= +Date: Wed, 28 Jun 2023 13:55:01 +0200 +Subject: [PATCH] daemon: Specify DCONF_PROFILE for initial-setup + +Since commit edc1815175, the initial-setup session no longer uses +the locked down "gdm" profile, but the regular user profile. + +On the one hand this seems justified, given that the initial-setup +session is different enough from the login screen, however it is +also different from a regular user session: + + - screen locking isn't useful for a system user + - during setup, log out / user switching are pointless at best + - accessibility features should be readily available in case + the user needs them + +For this reason, return to specify DCONF_PROFILE for the initial-setup +user, but use a distince profile from "gdm" to allow initial-setup +to provide its own presets. +--- + daemon/gdm-launch-environment.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/daemon/gdm-launch-environment.c b/daemon/gdm-launch-environment.c +index 507d6de74..5e379bf85 100644 +--- a/daemon/gdm-launch-environment.c ++++ b/daemon/gdm-launch-environment.c +@@ -155,71 +155,67 @@ build_launch_environment (GdmLaunchEnvironment *launch_environment, + "LC_TIME", + "LD_LIBRARY_PATH", + "PATH", + "WINDOWPATH", + "XCURSOR_PATH", + "XDG_CONFIG_DIRS", + NULL + }; + char *system_data_dirs; + g_auto (GStrv) supported_session_types = NULL; + int i; + + /* create a hash table of current environment, then update keys has necessary */ + hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + + for (i = 0; optional_environment[i] != NULL; i++) { + if (g_getenv (optional_environment[i]) == NULL) { + continue; + } + + g_hash_table_insert (hash, + g_strdup (optional_environment[i]), + g_strdup (g_getenv (optional_environment[i]))); + } + + if (launch_environment->x11_authority_file != NULL) + g_hash_table_insert (hash, g_strdup ("XAUTHORITY"), g_strdup (launch_environment->x11_authority_file)); + + if (launch_environment->session_mode != NULL) { + g_hash_table_insert (hash, g_strdup ("GNOME_SHELL_SESSION_MODE"), g_strdup (launch_environment->session_mode)); ++ g_hash_table_insert (hash, g_strdup ("DCONF_PROFILE"), g_strdup (launch_environment->user_name)); + + if (strcmp (launch_environment->session_mode, INITIAL_SETUP_SESSION_MODE) != 0) { + /* gvfs is needed for fetching remote avatars in the initial setup. Disable it otherwise. */ + g_hash_table_insert (hash, g_strdup ("GVFS_DISABLE_FUSE"), g_strdup ("1")); + g_hash_table_insert (hash, g_strdup ("GIO_USE_VFS"), g_strdup ("local")); + g_hash_table_insert (hash, g_strdup ("GVFS_REMOTE_VOLUME_MONITOR_IGNORE"), g_strdup ("1")); +- +- /* The locked down dconf profile should not be used for the initial setup session. +- * This allows overridden values from the user profile to take effect. +- */ +- g_hash_table_insert (hash, g_strdup ("DCONF_PROFILE"), g_strdup ("gdm")); + } + } + + g_hash_table_insert (hash, g_strdup ("LOGNAME"), g_strdup (launch_environment->user_name)); + g_hash_table_insert (hash, g_strdup ("USER"), g_strdup (launch_environment->user_name)); + g_hash_table_insert (hash, g_strdup ("USERNAME"), g_strdup (launch_environment->user_name)); + + g_hash_table_insert (hash, g_strdup ("GDM_VERSION"), g_strdup (VERSION)); + g_hash_table_remove (hash, "MAIL"); + + g_hash_table_insert (hash, g_strdup ("HOME"), g_strdup ("/")); + g_hash_table_insert (hash, g_strdup ("PWD"), g_strdup ("/")); + g_hash_table_insert (hash, g_strdup ("SHELL"), g_strdup ("/bin/sh")); + + gdm_get_pwent_for_name (launch_environment->user_name, &pwent); + if (pwent != NULL) { + if (pwent->pw_dir != NULL && pwent->pw_dir[0] != '\0') { + g_hash_table_insert (hash, g_strdup ("HOME"), g_strdup (pwent->pw_dir)); + g_hash_table_insert (hash, g_strdup ("PWD"), g_strdup (pwent->pw_dir)); + } + + g_hash_table_insert (hash, g_strdup ("SHELL"), g_strdup (pwent->pw_shell)); + } + + if (start_session && launch_environment->x11_display_seat_id != NULL) { + char *seat_id; + + seat_id = launch_environment->x11_display_seat_id; + + g_hash_table_insert (hash, g_strdup ("GDM_SEAT_ID"), g_strdup (seat_id)); +-- +2.41.0.rc2 + diff --git a/0001-local-display-factory-Skip-simpledrm-while-checking-.patch b/0001-local-display-factory-Skip-simpledrm-while-checking-.patch new file mode 100644 index 0000000..d7efd8f --- /dev/null +++ b/0001-local-display-factory-Skip-simpledrm-while-checking-.patch @@ -0,0 +1,99 @@ +From b6b05961f76e9a8ac7697f61a78bc07bec933964 Mon Sep 17 00:00:00 2001 +From: Mario Limonciello +Date: Thu, 24 Aug 2023 13:39:51 -0500 +Subject: [PATCH] local-display-factory: Skip simpledrm while checking for + settled + +Some platforms the DRM driver may take more time to load and this +will mean that GDM starts up using simpledrm instead of the proper +KMS driver. + +To avoid this problem, skip simpledrm when checking if a given node +is settled. + +Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2909 +Suggested-by: Ray Strode +Tested-by: Mario Limonciello +Tested-by: Hans de Goede +Signed-off-by: Mario Limonciello +--- + daemon/gdm-local-display-factory.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c +index c10c1ef6c..9a1012103 100644 +--- a/daemon/gdm-local-display-factory.c ++++ b/daemon/gdm-local-display-factory.c +@@ -650,63 +650,69 @@ udev_is_settled (GdmLocalDisplayFactory *factory) + + if (factory->seat0_has_boot_up_graphics) { + g_debug ("GdmLocalDisplayFactory: udev settled, boot up graphics available."); + return TRUE; + } + + if (factory->seat0_graphics_check_timed_out) { + g_debug ("GdmLocalDisplayFactory: udev timed out, proceeding anyway."); + g_clear_signal_handler (&factory->uevent_handler_id, factory->gudev_client); + return TRUE; + } + + g_debug ("GdmLocalDisplayFactory: Checking if udev has settled enough to support graphics."); + + enumerator = g_udev_enumerator_new (factory->gudev_client); + + g_udev_enumerator_add_match_name (enumerator, "card*"); + g_udev_enumerator_add_match_tag (enumerator, "master-of-seat"); + g_udev_enumerator_add_match_subsystem (enumerator, "drm"); + + devices = g_udev_enumerator_execute (enumerator); + if (!devices) { + g_debug ("GdmLocalDisplayFactory: udev has no candidate graphics devices available yet."); + return FALSE; + } + + node = devices; + while (node != NULL) { + GUdevDevice *device = node->data; + GList *next_node = node->next; ++ const gchar *id_path = g_udev_device_get_property (device, "ID_PATH"); + g_autoptr (GUdevDevice) platform_device = NULL; + g_autoptr (GUdevDevice) pci_device = NULL; + ++ if (g_str_has_prefix (id_path, "platform-simple-framebuffer")) { ++ node = next_node; ++ continue; ++ } ++ + platform_device = g_udev_device_get_parent_with_subsystem (device, "platform", NULL); + + if (platform_device != NULL) { + g_debug ("GdmLocalDisplayFactory: Found embedded platform graphics, proceeding."); + factory->seat0_has_platform_graphics = TRUE; + is_settled = TRUE; + break; + } + + pci_device = g_udev_device_get_parent_with_subsystem (device, "pci", NULL); + + if (pci_device != NULL) { + gboolean boot_vga; + + boot_vga = g_udev_device_get_sysfs_attr_as_int (pci_device, "boot_vga"); + + if (boot_vga == 1) { + g_debug ("GdmLocalDisplayFactory: Found primary PCI graphics adapter, proceeding."); + factory->seat0_has_boot_up_graphics = TRUE; + is_settled = TRUE; + break; + } else { + g_debug ("GdmLocalDisplayFactory: Found secondary PCI graphics adapter, not proceeding yet."); + } + } + node = next_node; + } + + g_debug ("GdmLocalDisplayFactory: udev has %ssettled enough for graphics.", is_settled? "" : "not "); + g_list_free_full (devices, g_object_unref); +-- +2.41.0.rc2 +