Subject: Re: Multiple X servers, via virtual consoles?
To: None <netbsd-help@netbsd.org>
From: Richard Rauch <rkr@rkr.kcnet.com>
List: netbsd-help
Date: 01/04/2000 21:45:23
Okay, I've now got multiple (2, at the moment) X servers running
concurrently.  Thanks to mcr for telling me that it could be done.

Since it's not sufficiently prominant how to do this (IMHO) and one person
thought that I might have to recompile X and/or the kernel, I thought that
it was worth following up on my own message.  Probably this is all
documented somewhere if you look in the right spot, but I only found out
after triggering the X server's ``how to run me'' message.

I use startx, but of course any differences in the mechanism should only
affect how you get it started.



The upshot, if you are using startx, is that you can do it by simply
running:

  startx -- :N [other options, if any]

...where N is a display number.  (Using :0.N doesn't seem to work.)  If
you don't specify a :N, :0 is assumed.  For example, I have a pair of X
sessions (one 8bpp, the other 24bpp) right now:

  8bpp: startx
 24bpp: startx -- :1 -bpp 24

To keep the diagnostic output seperated, I ran each on a seperate virtual
console (using a single console with window(1) should work just as well).  
I can now select among my 4 tty-connected consoles (2 are tied up with
startx) and my 2 virtual consoles with running X servers.  To so so, I use
<Ctrl>-<Alt>-<Fn> where <Fn> is one of the Function keys, F1..F6.

I.e., I swap using normal virtual console swapping.



If you start X with xinit, then you probably know more about X than I do,
but just in case: I think that the same conventions hold (anything after
``--'' is passed directly to the X wrapper, and thence to the X server).  
Simply put ``:N'' right after the ``--''.  If you don't already use
``--'', then append a ``-- :N'', for some integer N, to the end of your
xinit command.



If you use xdm or kin, I have no idea.  Presumably it can be done, but
I've never configured xdm, and don't use it on my machine.



Caveats:
 * startx doesn't terminate until the X session is over.  At the moment,
   I have two startx's running in seperate virtual consoles.

 * It seems to me that (with or without multiple X sessions) there is some
   danger that you will leave yourself logged in on a different virtual
   console.  If you use csh at least, I think that you could arrange to
   show ``where else am I logged in'' via a .logout.  With virtual
   consoles, this is probably worth spending some time to setup.  (^&

   (Although, since I use NetBSD in the home, I may not bother.  In a less
   secure environment, it just wouldn't do to leave accounts logged in on
   hidden virtual consoles.  (^&)


Uses:
 * Letting multiple users leave an X session running concurrently.
   (Suggested by mcr.  (^&)  I can see some use for this---e.g., trying
   to snare my nearer brother into using NetBSD in place of MS-WINDOWS.
   (He probably wouldn't use it much, but he drops by about once a day.
   If _I'm_ not using the 'puter, I might be able to talk him into giving
   it a whirl.)

   It would be nice if I could let him have a fairly complete local
   environment without logging myself off.

 * Debugging/escaping buggy/in-development window managers and X servers.

 * Running different programs that are picky about their display quality.
   (Notably, some programs just do not like to run in 24-bit).

 * Testing things like window managers and desktops without giving up
   your current preference.


All in all, not essential IMHO, but a fairly nifty feature.  Kudos to the
folks that made the magic work.  (^&


  "I probably don't know what I'm talking about."  --rkr@rkr.kcnet.com