Index: gdm-49.2/daemon/gdm-local-display-factory.c =================================================================== --- gdm-49.2.orig/daemon/gdm-local-display-factory.c +++ gdm-49.2/daemon/gdm-local-display-factory.c @@ -585,11 +585,12 @@ on_display_status_changed (GdmDisplay /* if this is a local display, ensure that we get a login * screen when the user logs out. */ + int initial_vt_target = (getenv("GDM_INITIAL_VT_TTY1") != NULL) ? 1 : GDM_INITIAL_VT; if (is_local && ((g_strcmp0 (session_class, "greeter") != 0 && (!seat_active_session || g_strcmp0(session_id, seat_active_session) == 0)) || #if defined(ENABLE_USER_DISPLAY_SERVER) - (g_strcmp0 (seat_id, "seat0") == 0 && factory->active_vt == GDM_INITIAL_VT) || + (g_strcmp0 (seat_id, "seat0") == 0 && factory->active_vt == initial_vt_target) || #endif g_strcmp0 (seat_id, "seat0") != 0)) { /* reset num failures */ @@ -1352,7 +1353,8 @@ on_vt_changed (GIOChannel *source, * on it (unless a login screen is already running elsewhere, then * jump to that login screen) */ - if (factory->active_vt != GDM_INITIAL_VT) { + int initial_vt_target = (getenv("GDM_INITIAL_VT_TTY1") != NULL) ? 1 : GDM_INITIAL_VT; + if (factory->active_vt != initial_vt_target) { g_debug ("GdmLocalDisplayFactory: active VT is not initial VT, so ignoring"); return G_SOURCE_CONTINUE; } Index: gdm-49.2/daemon/gdm-session-worker.c =================================================================== --- gdm-49.2.orig/daemon/gdm-session-worker.c +++ gdm-49.2/daemon/gdm-session-worker.c @@ -1307,7 +1307,8 @@ gdm_session_worker_initialize_pam (GdmSe if (g_strcmp0 (seat_id, "seat0") == 0 && worker->seat0_has_vts) { /* Temporarily set PAM_TTY with the login VT, PAM_TTY will be reset with the users VT right before the user session is opened */ - g_snprintf (tty_string, 256, "/dev/tty%d", GDM_INITIAL_VT); + int initial_vt_target = (getenv("GDM_INITIAL_VT_TTY1") != NULL) ? 1 : GDM_INITIAL_VT; + g_snprintf (tty_string, 256, "/dev/tty%d", initial_vt_target); pam_set_item (worker->pam_handle, PAM_TTY, tty_string); } @@ -1813,14 +1814,15 @@ jump_back_to_initial_vt (GdmSessionWorke if (worker->session_vt == 0) return; - if (worker->session_vt == GDM_INITIAL_VT) + int initial_vt_target = (getenv("GDM_INITIAL_VT_TTY1") != NULL) ? 1 : GDM_INITIAL_VT; + if (worker->session_vt == initial_vt_target) return; if (g_strcmp0 (worker->display_seat_id, "seat0") != 0 || !worker->seat0_has_vts) return; #ifdef ENABLE_USER_DISPLAY_SERVER - jump_to_vt (worker, GDM_INITIAL_VT); + jump_to_vt (worker, initial_vt_target); worker->session_vt = 0; #endif } @@ -2258,7 +2260,8 @@ set_up_for_new_vt (GdmSessionWorker *wor * 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); + int initial_vt_target = (getenv("GDM_INITIAL_VT_TTY1") != NULL) ? 1 : GDM_INITIAL_VT; + g_snprintf (tty_string, sizeof (tty_string), "/dev/tty%d", initial_vt_target); initial_vt_fd = open (tty_string, O_RDWR | O_NOCTTY); if (initial_vt_fd < 0) { @@ -2267,7 +2270,7 @@ set_up_for_new_vt (GdmSessionWorker *wor } if (worker->display_is_initial) { - session_vt = GDM_INITIAL_VT; + session_vt = initial_vt_target; } else { /* Typically VT_OPENQRY is called on /dev/tty0, but we already