Lots of X Windows
A large number of readers had queried further about managing multiple Windows (i.e. multiple X sessions, refer article- How to attain Linux nirvana –Get some more breeze through your X-Windows, LFY, April 04 page 25) on their Linux Computers. Apparently, due to the very nature of Linux- it installs differently with entirely different configurations for different desktop managers and for different distributions. Some readers had experienced difficulty in running multiple X sessions on their Linux computers due to this very reason. The scope of the said article was to give you very basic idea which works on most cases with default configurations. However, a little extra explanation is needed for platform specific cases. Besides that, there are many more ways through which you can have more windows in your Linux computer. Just follow these steps to have them-
Unlimited Desktops?
Graphical Display, the screens- called ‘X Window system’ on Linux is handled through the present generation X server called XFree86. XFree86 is advanced enough to handle practically an infinite number of desktops (independent screens where you can work in graphical mode) including remote ones from a single computer simultaneously. But often, due to limitations in supporting applications and system resources, you can effectively use a very few. To get multiple X Sessions on the same Computer (to get multiple GUI Login screen with the help of Ctrl+Alt+Function key combinations) you need to install XFree86 along with XDMCP (X Display Manager Control Protocol) compliant display managers like GDM, KDM or XDM. If your Linux computer has Gnome and/or KDE installed with default installation scripts, it is most likely that you had preinstalled GDM and/or KDM along with XDM.
Scenes behind your desktop:
When you start Linux in graphical mode i.e. runlevel 5, it runs several script/binary files in sequence during its graphical startup. Configurations from files, /etc/X11/XF86Config and /etc/inittab are read and a command- /etc/X11/prefdm is run that in turn read preferred display manager entry in /etc/sysconfig/desktop file. If it finds a preferred entry for a particular display manager, it starts that preferred display manager and if it does not find any, it starts the first it could find among GDM, KDM or XDM in your installation, in that order. On most default settings, only one X Session is defined in the configuration settings, and therefore you could login to only one graphical screen locally. Again, on most system, by default, it is defined at Virtual Terminal 07 (vt07) that you can access by pressing Ctrl+Alt+F7. As XFree86 is capable to handle multiple X sessions simultaneously, you can run several instances of X session in various ways, either manually or automatically by changing configuration files suitably.
Run multiple X session manually
If you are already running Linux in graphical mode and want to run another instance of X without bothering to change any configuration settings etc., you can do this by giving following command:
startx -- :1
And it will start another instance of X session in next available virtual terminal. If your present graphical Linux is available in virtual terminal 07 as screen 0, the next screen 1 will be available on virtual terminal 08. You can switch between the terminals by pressing Ctrl+Alt+F7 (for vt07, screen 0) and Ctrl+Alt+F8 (for vt08, screen 1) keys alternatively. Further, if you want yet another instance of X, the third one, then you can give command:
startx - - :2
And it will open the third instance of X session on vt09 and so on. You can order an application to open on any running X session from any other X session. For example, you can give command from vt07 to run an application on vt08. You can do this by following way- give following command in any terminal, say from konsole of screen 0.
kedit - - display :1
The command will open kedit on screen 1 (the one which you had started by giving command startx -- :1). Similarly, if your /etc/X11/XF86Config file has entries for different color depths and screen resolutions, you can start different screens with different attributes. For example, you can have screen 0 to be of 256 colors and screen 1 to have 16 million colors. To start the screens with different color depths (say, for 8 bit colour), command syntax will be-
startx - - :1 - depth 8
The above command will open X session on screen 1 with 8 bit color display provided there is configuration entry in XF86Config file to display 8 bit color, else you will encounter error message. Similarly, all the above commands can be extended to start X session in remote computer connected to your network. For example, to start X session on a remote host’s display 1, you can use command-
startx - - :1 –query remote_host
It will query for the remote computer named remote_host, search for an empty screen 1 and if it find other conditions favorable, it will start an instance of X session at that remote host.
More X sessions
With default configuration, you can have up to 6 X sessions on your local computer one each on vt07 to vt12. If you want few more, you need to edit /etc/inittab file. Here, you will have to disable some virtual consoles (text console), defined in the said file. In this file you will find entries like this-
# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
1:2345:respawn:/sbin/mingetty tty2
1:2345:respawn:/sbin/mingetty tty3
1:2345:respawn:/sbin/mingetty tty4
1:2345:respawn:/sbin/mingetty tty5
1:2345:respawn:/sbin/mingetty tty6
Now, to have three more virtual terminals for your X sessions, comment out the last three entries. After editing, the edited lines will look like this-
# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
1:2345:respawn:/sbin/mingetty tty2
1:2345:respawn:/sbin/mingetty tty3
# 1:2345:respawn:/sbin/mingetty tty4
# 1:2345:respawn:/sbin/mingetty tty5
# 1:2345:respawn:/sbin/mingetty tty6
With 3 more virtual terminals namely- vt04, vt05 and vt06 you can have total 9 numbers of X windows running in parallel! Incidentally, you can have up to 16 independent desktops on each X sessions, therefore, you can have 16*9=144 windows to work on a single computer. Surely it’s a lot of windows!
Running multiple X session automatically
While above methods needs manual starting of X session every time when you need, you can configure display managers to start a predefined number of X servers at predefined terminals. When it is configured to start automatically with runlevel 5, all you have to press Ctrl+Alt+Respective_Function_Key to jump to that display. If you have installed GNOME desktop, then it is very likely that by default, your display starts with GDM, the Gnome Display Manager. GDM uses a configuration file normally resides as /etc/X11/gdm/gdm.conf. By default, gdm.conf file has entry for only a single X session in its server section. With default configuration, the server section of the gdm.conf file looks like this-
[servers]
# These are the standard servers. You can add as many you want here
# and they will always be started. Each line must start with a unique
# number and that will be the display number of that server. Usually just
# the 0 server is used.
0=Standard
Now add separate lines for each display you want to use that will start automatically during login. If you want two more X session to start during X startup, the configuration will look like this-
[servers]
# These are the standard servers. You can add as many you want here
# and they will always be started. Each line must start with a unique
# number and that will be the display number of that server. Usually just
# the 0 server is used.
0=Standard
1=Standard
2=Standard
Now whenever you start X session through GDM, 3 X servers will start automatically and will be available for use at Screen 0, 1 and 2 respectively, that can be accessed by pressing Ctrl+Alt+respective_function_key. If you use KDM or XDM as your display managers, they use different configuration file, /etc/X11/xdm/Xservers for providing multiple X session automatically. By default, the file has only one entry for Display 0 –
:0 local /usr/X11R6/bin/X :0 vt07
For each additional display, you need to add corresponding lines indicating particular display. For 3 additional displays, your file will look like this-
:0 local /usr/X11R6/bin/X :0 vt07
:1 local /usr/X11R6/bin/X :1 vt08
:2 local /usr/X11R6/bin/X :2 vt09
:3 local /usr/X11R6/bin/X :3 vt10
Now, whenever you press Ctrl+Alt+F7 to F10 respectively, you will be presented with graphical login window for each. You can have 4 different Linux running simultaneously. In one session you can have Gnome, other may have KDE the third one may have your own language other than English interface and the forth one may have another user and so on... And you can switch between them any time. Note that if your system had preinstalled GNOME desktop’s GDM, it will start first as has been defined in /etc/X11/prefdm script. You can run KDM or XDM in pareller with GDM to use multiple X session through these or you can edit /etc/sysconfig/desktop file to have your preferred display manager either KDM or XDM. Add a line to the file exactly like this-
DISPLAYMANAGER=“KDE”
For display manager KDM, and for the not-so-fancy, generic display manager, XDM, the line must be-
DISPLAYMANAGER=“XDM”
Next time when you will start X, either KDM or XDM as the case may be, will start instead of GDM, and according to your configuration in /etc/X11/xdm/Xservers file, you can use multiple X sessions. Multiple X sessions through KDM/XDM is recommended since they are not started automatically as the case with GDM, they only start when you press key combinations for respective X session. It is also recommended that unless you have ample resources like powerful processor and tons of RAM, do not use multiple X sessions more than a few (say, 2 or 3), else you will see serious performance degradation. And, occasionally, some of your application may get confused to which display they should appear especially if they are invoked from some terminals through command line arguments. Again, there are some serious security issues involved if you set your networked computer for multiple X sessions. And, above all, do not disturb/change other settings of the vital configuration files mentioned in this article else you may end up with no X sessions at all!
Screenshot descriptions:
- More-windows01 To start multiple X session automatically through GDM, you need to add one additional definition line each for every corresponding additional display in gdm.conf file.
- More-windows02 To start multiple X session through KDM/XDM it is required that you should add one additional configuration line each for corresponding display in the file /etc/X11/xdm/Xservers file.
- More-windows03 To get more room for X session, i.e. to have more than default 6 X sessions in a local computer, delete/comment the virtual console entries in the file /etc/inittab
- More-windows04 You can define your preferred display manager (the login screen that you see during graphical login) in the file /etc/sysconfig/desktop
No comments:
Post a Comment