diff -Nru gdm3-3.34.1/debian/changelog gdm3-3.34.1/debian/changelog --- gdm3-3.34.1/debian/changelog 2019-10-07 16:23:07.000000000 +0000 +++ gdm3-3.34.1/debian/changelog 2020-09-04 06:24:14.000000000 +0000 @@ -1,3 +1,14 @@ +gdm3 (3.34.1-1ubuntu2) groovy; urgency=medium + + * Backport commit (f843233a, 690b3c01) from upstream to fix LP: #1845801 + + daemon/gdm-session-worker.c: + - Opens up /dev/tty1 when querying for availble VTs to make sure + !is_initial won't get tty1. + + daemon/gdm-local-display-factory.c + - Force to login screen on VT 1 even if switching user. + + -- Jeremy Szu Fri, 04 Sep 2020 06:24:14 +0000 + gdm3 (3.34.1-1ubuntu1) eoan; urgency=medium * Merge with Debian. Remaining changes: diff -Nru gdm3-3.34.1/debian/patches/series gdm3-3.34.1/debian/patches/series --- gdm3-3.34.1/debian/patches/series 2019-10-07 16:23:07.000000000 +0000 +++ gdm3-3.34.1/debian/patches/series 2020-09-04 06:13:13.000000000 +0000 @@ -12,3 +12,4 @@ ubuntu/dont_set_language_env.patch ubuntu/prefer_ubuntu_session_fallback.patch ubuntu/gdm3.service-wait-for-drm-device-before-trying-to-start-i.patch +ubuntu/force-login-screen-on-tty1.patch diff -Nru gdm3-3.34.1/debian/patches/ubuntu/force-login-screen-on-tty1.patch gdm3-3.34.1/debian/patches/ubuntu/force-login-screen-on-tty1.patch --- gdm3-3.34.1/debian/patches/ubuntu/force-login-screen-on-tty1.patch 1970-01-01 00:00:00.000000000 +0000 +++ gdm3-3.34.1/debian/patches/ubuntu/force-login-screen-on-tty1.patch 2020-09-04 06:21:45.000000000 +0000 @@ -0,0 +1,120 @@ +Description: ensure initial vt is never picked for !is_initial displays + Normally, a !is_initial display would never "get" tty1, since the system + boots to tty1. But if, for some reason, the user booted to runlevel 3, + then switched to runlevel 5, the login screen could get started when + tty1 is free. + + Force login screen on tty1 even if swtiching user. +Author: rstrode@redhat.com +Origin: https://gitlab.gnome.org/GNOME/gdm/-/commit/f843233ad4, https://gitlab.gnome.org/GNOME/gdm/-/commit/690b3c01 +Bug: https://bugs.launchpad.net/ubuntu/+source/gdm3/+bug/1845801 +Applied-Upstream: commit: f843233a, 690b3c01 +Last-Update: 2020-09-04 + +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: gdm3-3.34.1/daemon/gdm-local-display-factory.c +=================================================================== +--- gdm3-3.34.1.orig/daemon/gdm-local-display-factory.c ++++ gdm3-3.34.1/daemon/gdm-local-display-factory.c +@@ -224,6 +224,7 @@ gdm_local_display_factory_create_transie + { + gboolean ret; + GdmDisplay *display = NULL; ++ gboolean is_initial = FALSE; + + g_return_val_if_fail (GDM_IS_LOCAL_DISPLAY_FACTORY (factory), FALSE); + +@@ -235,6 +236,7 @@ gdm_local_display_factory_create_transie + display = gdm_local_display_new (); + if (gdm_local_display_factory_use_wayland ()) + g_object_set (G_OBJECT (display), "session-type", "wayland", NULL); ++ is_initial = TRUE; + #else + if (display == NULL) { + guint32 num; +@@ -248,6 +250,7 @@ gdm_local_display_factory_create_transie + g_object_set (display, + "seat-id", "seat0", + "allow-timed-login", FALSE, ++ "is-initial", is_initial, + NULL); + + store_display (factory, display); +Index: gdm3-3.34.1/daemon/gdm-session-worker.c +=================================================================== +--- gdm3-3.34.1.orig/daemon/gdm-session-worker.c ++++ gdm3-3.34.1/daemon/gdm-session-worker.c +@@ -2190,21 +2190,33 @@ gdm_session_worker_start_session (GdmSes + static gboolean + set_up_for_new_vt (GdmSessionWorker *worker) + { +- int fd; ++ int initial_vt_fd; + char vt_string[256], tty_string[256]; + int session_vt = 0; + +- fd = open ("/dev/tty0", O_RDWR | O_NOCTTY); ++ /* open the initial vt. We need it for two scenarios: ++ * ++ * 1) display_is_initial is TRUE. We need it directly. ++ * 2) display_is_initial is FALSE. We need it to mark ++ * the initial VT as "in use" so it doesn't get returned ++ * by VT_OPENQRY ++ * */ ++ g_snprintf (tty_string, sizeof (tty_string), "/dev/tty%d", GDM_INITIAL_VT); ++ initial_vt_fd = open (tty_string, O_RDWR | O_NOCTTY); + +- if (fd < 0) { +- g_debug ("GdmSessionWorker: couldn't open VT master: %m"); ++ if (initial_vt_fd < 0) { ++ g_debug ("GdmSessionWorker: couldn't open console of initial fd: %m"); + return FALSE; + } + + if (worker->priv->display_is_initial) { + session_vt = GDM_INITIAL_VT; + } else { +- if (ioctl(fd, VT_OPENQRY, &session_vt) < 0) { ++ ++ /* Typically VT_OPENQRY is called on /dev/tty0, but we already ++ * have /dev/tty1 open above, so might as well use it. ++ */ ++ if (ioctl (initial_vt_fd, VT_OPENQRY, &session_vt) < 0) { + g_debug ("GdmSessionWorker: couldn't open new VT: %m"); + goto fail; + } +@@ -2212,9 +2224,6 @@ set_up_for_new_vt (GdmSessionWorker *wor + + worker->priv->session_vt = session_vt; + +- close (fd); +- fd = -1; +- + g_assert (session_vt > 0); + + g_snprintf (vt_string, sizeof (vt_string), "%d", session_vt); +@@ -2227,14 +2236,20 @@ set_up_for_new_vt (GdmSessionWorker *wor + "XDG_VTNR", + vt_string); + +- g_snprintf (tty_string, 256, "/dev/tty%d", session_vt); +- worker->priv->session_tty_fd = open (tty_string, O_RDWR | O_NOCTTY); ++ if (worker->priv->display_is_initial) { ++ worker->priv->session_tty_fd = initial_vt_fd; ++ } else { ++ g_snprintf (tty_string, sizeof (tty_string), "/dev/tty%d", session_vt); ++ worker->priv->session_tty_fd = open (tty_string, O_RDWR | O_NOCTTY); ++ close (initial_vt_fd); ++ } ++ + pam_set_item (worker->priv->pam_handle, PAM_TTY, tty_string); + + return TRUE; + + fail: +- close (fd); ++ close (initial_vt_fd); + return FALSE; + } +