[ Table Of Contents ][ Answer Guy Current Index ] greetings   Meet the Gang   1   2   3   4   5   6   7 [ Index of Past Answers ]

(?) The Answer Gang (!)

By Jim Dennis, Ben Okopnik, Dan Wilder, Breen, Chris, and... (meet the Gang) ... the Editors of Linux Gazette... and You!
Send questions (or interesting answers) to The Answer Gang for possible publication (but read the guidelines first)

(!) Starting many X sessions

Answered By Ashwin M, Heather Stern, Jay R. Ashworth, Chris Gianakopoulos, Robos

(!) [Ashwin] Hi,
I am a relative newbie to Linux, hence this tip may be common or may have been already published.
(!) [Heather] This is a particularly clear description of it, and the thread turned a curious direction as well. Welcome to the pages of The Answer Gang, Ashwin.
(!) [Ashwin] Yes! You can have more than one X session running at the _same time! By default your X session will be running on virtual terminal 7 (that is why you use Ctrl-Alt-F7 to get to it).
To start a new X session get to a terminal session (F1 - F6) and type "startx -- :1". A new X session starts up. Now to go back to the older X session, use Ctrl-Alt-F7. For the new X session use Ctrl-Alt-F8.
(For more X sessions use the next numbers after 1 like 2,3 and so on. They don't have to be in order like 1 next 2 and so on. No matter what number you use here the Ctrl-Alt-Fx number will be assigned the next available number after 7)
(!) [Heather] Strictly speaking, the first available open terminal; on most major distro setups that's 7, after your 6th text console, but if you're an oddball like me who uses enough text consoles that you set up, say, 10, then it would show up on console 11 instead.
Of course if you do that too, make sure Xdm or its cousins don't think they are supposed to take a console used by a text getty.
(!) [Ashwin] Now, why would anyone need another X session? Some reasons could be -
You may think "why would I need this?". But, once you know this trick you will find new ways to use it for your work :-)
Note: I found this not to work on some (very few) systems with old video cards and less VRAM.
thanks, Ashwin
(!) [Chris G] That's a cool tip. I just tried it out, and it works with Version 3.3.6 of X.
(!) [Heather] My favorite reasons to run multiple X sessions on the same machine are:
In the modern era you could also use Xnest to provide the reduced depth to the stupid app, but it's less confusing to do the above than to make sure you're running something inside the nest.
Not that it's hard mind you - make the nest's first client an xterm with a custom color fg and bg, then launch things you want in the nest from the special xterm.

(?) [Robos] Well, I knew this, but did you know that the keyboard and mouse are bound to one? Meaning you can't - like I tried - run two xsessions on two grafik cards and share the keyboard between them. This is only possible if you use a ps/s keyboard and a usb version. I want to do that, but I haven't got the usb keyboard yet that I would like: small form factor (84 keys), english layout (I'm in germany) and usb...

(!) [Jay] You are supposed to be able to do that.
And indeed, a quick test proves that you can.
RH 7.1, and whichever X ships with that. I did Ctrl-Alt-F1 to a text login, logged in as root, did 'startx -- :1', and was whisked over to tty8, where I got a KDE desktop as root (that being the default choice on my laptop).
Ctrl-Alt-F7 switched me right back to the desktop I'm on (KDE under KDM, logged in as myself), and I could C-A-F8 right back to the other one; mouse and keyboard worked in both.
And indeed they should: X switches to a free vt before it binds the hardware, and what it gets is the virtualization of the hardware that it produced by the multi-console driver. It doesn't bind directly to the hardware.

(?) [Robos] Well, a misunderstanding and a wrong memory on my part (I run memtest86 later on me, it always takes so long...). I meant that I wanted to run two xservers on two graphic cards and have two keyboards too. My motivation: Running quake3 and chatting with my pals in irc at the same time. Thought about either two xservers or one xserver and one mga framebuffer. But, as said, no usb keyboard yet.

(!) [Jay] What is hard is having two X servers on different physical display adapters with separate keyboards. Hard, but often very useful.

(?) [Robos] And cheaper than two computers, not to mention the noise reduction.

(!) [Heather] While I had interpreted this confusion as wanting both X servers to listen to the keystrokes in tandem, implying that they'd both be grabbing keyboard events from the same pool. Which given his usage example, of course is not what you'd want ;) I could see some vague reason why somebody might want to do it (test the same app on two video cards at once) and I can certainly imagine the USB model of how devices work being much better for handling it.
X 4 lets you designate entirely different screen layouts to be stored in its config file, and you can specify which one to use by passing -layout "layout[1]" (or whatever ID you named it) down to X. Of course your usual methods of starting X may try to protect you from doing this, but with startx it's pretty easy: startx -- -layout secondhead :2
With X 3.3.x you probably have to just keep seperate config files.
If anyone out there is crazy enough to be trying this, let us know how it works out for you. And then there's always the Linux Terminal Server Project: http://www.ltsp.org
Or better yet the K-12 Linux Terminal Server Project: http://k12ltsp.org/contents.html

This page edited and maintained by the Editors of Linux Gazette Copyright © 2002
Published in issue 80 of Linux Gazette July 2002
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/

[ Table Of Contents ][ Answer Guy Current Index ] greetings   Meet the Gang   1   2   3   4   5   6   7 [ Index of Past Answers ]