I see this discussion petered out in November, but as I missed the followups after the change in subjects for the thread, I had seen only Dan Nicholson's initial attempt at rectifying this problem<br>
<br>I've seen the philosophical discussion, but the real problem traces to the GDM version 2.20, which involved a major rewrite of the code and a regression in configurability. (Has anyone heard of MAJOR release numbers? Version 2.20 should have been 3.0, imho.)<br>

<br>Anyhow I've extended Dan Nicholson's approach in what I think is a more reliable manner. I don't use XDM, so I can't comment on that, but I see that KDM in the standard distribution has been configured to start X on vt1 and then go up from vt7 for later sessions. Since reconfiguring KDM versus the upstart files involves multiple changes, I leave that to the experts. (See the file /etc/kde/kdm/kdmrc to see what I mean.)<br>

<br>I leave /etc/event.d/tty1 alone and start it, if need be, when /etc/X11/prefdm kicks in. The logic in prefdm, by the way, kicks in AFTER plymouth shuts down, not before, in case it feels like re-creating the /var/spool/gdm/force-display-on-active-vt file. I also discovered that GDM removes that file each time a session ends, so I modified /etc/gdm/PostSession/Default to take that into account. This is why the first session was created on vt1 but all subsequent sessions after that user logs out were created on vt7.<br>

<br>The basic idea of "forcing" the display on an active VT is invalid, I think. It affects only vt1, not any of the others. If Sam is working on vt2 and Julie starts a new session, do you want Sam to be kicked off entirely? No. The only issue is with vt1, which the kernel uses to write boot messages. If you do "fgconsole --next-available", you'll see that vt1 is NEVER available, and if you try "deallocvt 1" you'll see why ...  "VT 1 is the console and cannot be deallocated".<br>

<br>So the only issue is that GDM won't start X on vt1 if it thinks it's already allocated, even if there are no processes running there. "fuser -v /dev/tty1" tells us whether we *really* want to start (or continue) X there.  <br>

<br><div>I've tested this pretty thoroughly from runlevel 5 (killing gdm-binary from within the gdm session and other weird states) and it seems to work. </div><div></div><div>The "telinit 5" situation also seems to work fine.<br>
</div>
<br>--- /etc/X11/prefdm.orig    2009-08-31 20:38:02.000000000 +0200<br>+++ /etc/X11/prefdm    2009-09-01 13:27:45.000000000 +0200<br>@@ -8,6 +8,10 @@<br> # Run preferred X display manager<br> quit_arg=<br> preferred=<br>
+<br>
+# Hack for Fedora-modified GDM<br>+FORCEACTIVEVT=yes<br>+<br> if [ -f /etc/sysconfig/desktop ]; then<br>     . /etc/sysconfig/desktop<br>     if [ "$DISPLAYMANAGER" = GNOME ]; then<br>@@ -31,6 +35,22 @@<br> # shut down boot splash<br>

 /usr/bin/plymouth quit $quit_arg<br> <br>+# Tell Fedora-modified GDM to reuse VT1 if it's really inactive or if X is already there;<br>+# otherwise, tell it not to use VT1 (and start a terminal there if need be)<br>
+TTY1_TASK=$(fuser -v /dev/tty1 2>&1|awk -v RS='' '/ / { print $9 ; exit }')<br>
+if  [ -z "$preferred" ] || [ "$preferred" = /usr/sbin/gdm ]; then<br>+    if [ "$FORCEACTIVEVT" = yes ]; then<br>+        if [ -z "$TTY1_TASK" ] || [ "$TTY1_TASK" = Xorg ] || "$TTY1_TASK" = X ]; then  <br>

+            touch /var/spool/gdm/force-display-on-active-vt<br>+        fi<br>+    else<br>+        rm -f /var/spool/gdm/force-display-on-active-vt<br>+        if [ -z "$TTY1_TASK" ]; then<br>+            initctl start tty1 >/dev/null<br>

+        fi    <br>+    fi<br>+fi<br>+<br> shopt -s execfail<br> <br> [ -n "$preferred" ] && exec $preferred "$@" >/dev/null 2>&1 </dev/null<br><br>--- /etc/gdm/PostSession/Default.orig    2009-07-27 16:41:41.000000000 +0200<br>

+++ /etc/gdm/PostSession/Default    2009-08-31 19:25:54.000000000 +0200<br>@@ -1,3 +1,26 @@<br> #!/bin/sh<br> <br>+PATH=/sbin:/usr/sbin:/bin:/usr/bin<br>+<br>+# Hack for Fedora-modified GDM<br>+FORCEACTIVEVT=yes<br>+<br>
+if [ -f /etc/sysconfig/desktop ]; then<br>
+    . /etc/sysconfig/desktop<br>+fi<br>+<br>+# Tell Fedora-modified GDM to reuse VT1 if it's really inactive or if X is already there;<br>+# otherwise, tell it not to use VT1 (and start a terminal there if need be)<br>

+TTY1_TASK=$(fuser -v /dev/tty1 2>&1|awk -v RS='' '/ / { print $9 ; exit }')<br>+if [ "$FORCEACTIVEVT" = yes ]; then<br>+    if [ -z "$TTY1_TASK" ] || [ "$TTY1_TASK" = Xorg ] || "$TTY1_TASK" = X ]; then  <br>

+        touch /var/spool/gdm/force-display-on-active-vt<br>+    fi<br>+else<br>+    rm -f /var/spool/gdm/force-display-on-active-vt<br>+    if [ -z "$TTY1_TASK" ]; then<br>+        initctl start tty1 >/dev/null<br>

+    fi    <br>+fi<br>+<br> exit 0<br><br>.<br><i>From</i>: "Dan Nicholson" <dbn lists gmail com><ul><li><i>To</i>: "Development discussions related to Fedora" <fedora-devel-list redhat com></li>

<li><i>Subject</i>: Re: Reasons to preseve X on tty7</li><li><i>Date</i>: Tue, 11 Nov 2008 20:05:38 -0800</li></ul>


<hr>


<pre>On Tue, Nov 11, 2008 at 1:28 PM, Bill Nottingham <notting redhat com> wrote:<br>> Dan Nicholson (dbn lists gmail com) said:<br>>> > Further testing with this is giving me some bizarre errors and hangs<br>

>> > relating to VT switching that don't happen with this patchset backed<br>>> > out. Unless I can track those down, I can't really recommend using<br>>> > it.<br>>><br>>> Without doing anything from event.d, there's nothing on tty1 for the<br>

>> `telinit 5' from runlevel 3 case, right? I don't want you to use a<br>>> broken patch, but I do think the current behavior is wrong.<br>><br>> It's 'wrong', but it's predictably wrong without side-effects on the<br>

> rest of the interface (crash, hang, etc.) and easily explained what<br>> to do. At this stage of the release cycle, that's better than a patch<br>> that fixes it for some cases and does really bizarre things in ways<br>

> that I haven't characterized yet. (I've seen hangs in the VT switch<br>> code, and I can reliably reproduce a condition where the console<br>> is perfectly fine... but not actually updating on the screen.)<br>

> Still poking at it, though.<br><br>That's understandable. It would be nice if the display manager would<br>be taken into account since kdm and xdm users will just get nothing on<br>tty1 in runlevel 5 at all times. I'm sure you'll come up with<br>

something sooner or later.<br><br>--<br>Dan<br><br></pre><br>
<br>