Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

  • Print
  • + Share This
  • 💬 Discuss

This chapter is from the book

Starting X

You can start X sessions in a variety of ways. The Fedora installer sets up the system initialization table /etc/inittab to have Linux boot directly to an X session, using a display manager (that is, an X client that provides a graphical login). After you log in, you use a local session (running on your computer) or, if the system is properly configured, an X session running on a remote computer on the network. Logging in via a display manager requires you to enter a username and password. You can also start X sessions from the command line. The following sections describe these two methods.

Using a Display Manager

An X display manager presents a graphical login that requires a username and password to be entered before access is granted to the X desktop. It also allows you to choose a different desktop for your X session. Whether or not an X display manager is presented after you boot Linux is controlled by a runlevel—a system state entry in /etc/inittab. The following runlevels are defined in the file:

# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)

Runlevel 5 is used for multiuser mode with a graphical X login via a display manager; booting to runlevel 3 provides a console, or text-based, login. The initdefault setting in the /etc/inittab file determines the default runlevel:


In this example, Linux boots and then runs X.

The default display manager might also be specified in /etc/inittab, like this:

x:5:respawn:/usr/bin/xdm -nodaemon

However, Fedora uses a shell script named prefdm, found under the /etc/X11 directory, to set the display manager:

x:5:respawn:/etc/X11/prefdm -nodaemon

According to this script, the display manager is based on the file named desktop under the /etc/sysconfig directory. The words GNOME, KDE, and XDM following a DESKTOP= entry determine what display manager is used for login. The following sections describe how to configure the three most commonly used display managers: gdm, kdm, and xdm.

Configuring gdm

The gdm display manager is part of the GNOME library and client distribution included with Fedora, and it provides a graphical login when a system boots directly to X. Its login (which is actually displayed by the gdmlogin client) hosts pop-up menus of window managers, languages, and system options for shutting down (halting) or rebooting the workstation. Although you can edit (as root) gdm.conf under the /etc/X11/gdm directory to configure gdm, a much better way to configure GNOME's display manager is to use the gdmsetup client.

You can use the gdmsetup client to configure many aspects and y. You launch this client from the GNOME System Menu, under Administration, Login Screen, or from the command line, like this:

# gdmsetup &

After you press Enter, you see the GDM Setup window, as shown in Figure 3.8.

Figure 3.8

Figure 3.8 You use gdmsetup to configure the gdmlogin screen when using gdm as a display manager.

You can specify settings for security, remote network logins, the X server, and session and session chooser setup by clicking on the tabs in the GDM Setup dialog.

Configuring kdm

The kdm client, which is part of KDE (which is covered later on in this chapter), offers a graphical login similar to gdm. You configure kdm by running the KDE Control Center client kcontrol, as the root operator, which you do by clicking the Control Center menu item from the KDE kicker or desktop panel menu. You can also start KDE Control Center by using the kcontrol client at the command line like so:

$ kcontrol &

In the Index tab of the left pane of the KDE Control Center window, you click the System Administration menu item to open its contents, and then you click the Login Manager menu item. The right pane of the Control Center window displays the tabs and configuration options for the kdm Login Manager, as shown in Figure 3.9.

Figure 3.9

Figure 3.9 You configure kdm by choosing tabs and settings in the Control Center dialog box.

To make any changes to the KDE display manager while logged in as a regular user, you must first click the Administrator Mode button, and then enter the root operator password. You can click on a tab in the Control Center dialog to set configuration options. Options in these tabs enable you to control the login display, prompts, user icons, session management, and configuration of system options (for shutting down or rebooting). After you make your configuration choices in each tab, click the Apply button to apply the changes immediately; otherwise, the changes are applied when the X server restarts.

Using the xdm Display Manager

The xdm display manager is part of the Xorg distribution and offers a bare-bones login for using X. Although it is possible to configure xdm by editing various files under the /etc/X11/xdm directory, GNOME and KDE offer a greater variety of options in display manager settings. The default xdm login screen's display is handled by the xsetroot client, which is included with Xorg, and Owen Taylor's xsri client, as specified in the file Xsetup_0 in the xdm directory under /etc/X11. The xsri client can be used to set the background color of the login display's desktop and to place an image in the initial display.

Starting X from the Console by Using startx

If you have Fedora set to boot to runlevel 3, a text-based console login, you can start an X session from the command line. You use the startx command (which is actually a shell script) to do so. You launch the X server and an X session by using startx, like this:

$ startx

startx first looks in your home directory for a file named .xinitrc. This file can contain settings that will launch an alternative desktop and X clients for your X session. The default system .xinitrc is found in the /etc/X11/xinit directory, but a local file can be used instead to customize an X session and launch default clients.

Using a custom .xinitrc is not necessary if you're using Fedora's desktop, which runs X and either a GNOME-aware window manager or KDE as a desktop environment.

You can also use the startx command with one or more command-line options. These options are passed to the X server before it launches an X session. For example, you can use startx to specify a color depth for an X session by using the -depth option, followed by a number such as 8, 16, 24, or 32 for 256, thousands, or millions of colors (as defined in the X configuration file and if supported). Using different color depths can be useful during development for testing how X clients look on different displays, or to conserve use of video memory, such as when trying to get the highest resolution (increased color depth can sometimes affect the maximum resolution of older video cards).

For example, to start a session with thousands of colors, you use the startx command like this:

$ startx -- -depth 16

Another option that can be passed is a specific dots-per-inch (dpi) resolution that is to be used for the X session. For example, to use 100 dpi, you use the -dpi option followed by 100, like this:

$ startx -- -dpi 100

You can also use startx to launch multiple X sessions. This feature comes as a result of Fedora's support for virtual consoles, or multiple text-based displays. To start the first X session, you use the startx command followed by a display number, or an X server instance (the first is 0, using screen 0) and a number that represents a virtual console. The default console used for X is number 7, so you can start the session like this:

$ startx -- :0 vt7

After X starts and the window manager appears, you press Ctrl+Alt+F2 and then log in again at the prompt. Next, you start another X session like this, specifying a different display number and virtual console:

$ startx -- :1 vt8

Another X session starts. To jump to the first X session, press Ctrl+Alt+F7. You use Ctrl+Alt+F8 to return to the second session. If you exit the current session and go to another text-based login or shell, you use Alt+F7 or Alt+F8 to jump to the desired session.

Using startx is a flexible way to launch X sessions, but multiple sessions can be confusing, especially to new users, and are a horrific resource drain on a system that does not have enough CPU horsepower and memory. A better approach is to use multiple workspaces, also known as virtual desktops, as discussed in the following section.

Using Fedora's switchdesk Client

You can use Fedora's switchdesk client to change the default window manager or desktop environment such as GNOME or KDE. Most desktop environments also include the capability to save a session state (such as running applications, the applications' window sizes and positions, and so on), using a feature known as session management.

You can also use the switchdesk utility when running X or at a text-based console, along with a keyword (such as GNOME or KDE), to set the default X desktop before launching X. For example, to specify that you want to use the KDE desktop environment as the default, you use switchdesk like this:

$ switchdesk KDE
Red Hat Linux switchdesk 4.0
Copyright (C) 1999-2004 Red Hat, Inc
Redistributable under the terms of the GNU General Public License
Desktop now set up to run KDE.
For system defaults, remove /home/andrew/.Xclients

This example shows that the default X session will now use KDE. Settings are saving in the file named .Xclients in the home directory. You can launch switchdesk during an X session by clicking the Desktop Switching Tool menu item from the System, Preferences menu or from the command line of an X11 terminal like this:

$ switchdesk-gui &

After you press Enter, you get a graphical dialog offering a choice of window managers for X sessions (depending on the window managers that are installed on the system), as shown in Figure 3.10.

Figure 3.10

Figure 3.10 You use switchdesk to set the default window manager for X sessions.

Choosing a window manager is a matter of preference, necessity, or policy. You might prefer to use one of the other window managers—such as the Tab Window Manager (twm) or XFce —on legacy PCs because they have lower system resource requirements (that is, they require less hard drive space, CPU horsepower, and system memory). Newer desktop environments require 128MB or even more memory for good performance. The following sections describe some of the most popular window managers and their uses.

  • + Share This
  • 🔖 Save To Your Account
Fedora 7 Unleashed

This chapter is from the book

Fedora 7 Unleashed


comments powered by Disqus