This post provides an overview of the Linux X-Windows System and discusses how to resolve basic X-Windows related issues on Enterprise Linux.
The X Window System – What is it?
The X-Window system is the software that provides the low-level, graphical interface for Linux. When the X-Window system is started, the X-Server process takes control of the graphics card, keyboard, and mouse, providing the user bit-mapped graphics on their X-display.
The X-Window system uses a network protocol (the X protocol) that allows you to view the X Display to your local display device or over the network to a remote display device. The X protocol is a client/server protocol – it provides visual rendering services to a client program, such as a terminal emulator.
A higher level Window/Display Manager is required for anything more than just a movable cursor and few windows. Some Window Managers use very little resource, so are a good choice for systems of a low-end specification. Some Window Managers are bundled as part of a complex set of programs that provide the user with rich features, but use a lot of resource and processing power. KDE (K Desktop Environment – http://www.kde.org) and GNOME (http://www.gnome.org) are examples of more complex user interfaces.
Linux provides the user with numerous graphical interface choices. The X-Windows system design allows for most policy decisions and configuration to be made by higher level pieces of software, making it very easy to develop new user interfaces.
The Main Players
The two most common versions of the X-Window system used are:
- XFree86
- Xorg
For some years, the XFree86 project (http://www.xfree86.org) maintained and freely provided their version of the X-Window system – many Linux vendors included it as the X-Windows system as part of their distribution. However, changes to the terms of XFree86 software saw many Linux vendors seeking an alternative. Using the last version of the XFree86 software released under the old licensing terms, the X organisation (X.org Foundation – http://www.x.org) produced an open source version of the X-Windows system. Today, most current Linux distributions now use the Xorg version of the X-Window system.
Configuration and Log File Locations
The configuration file for the XFree86 version of the X-Window System is /etc/X11/XF86Config-4 or /etc/X11/XF86Config. The log file for the XFree86 version of the X-Window System is /var/log/XFree86.0.log (or similar).
The config file for the Xorg version of the X Window System is /etc/X11/xorg.conf. The log file for the Xorg version of the X Window System is /var/log/Xorg.0.log (or similar).
Configuration Issues – Basic Things You Can Try
Configuring the X-Window system to work on your hardware largely falls into two categories:
- It Just Works – Most current Linux distributions provide automatic hardware detection and drivers for most common graphics hardware and can configure the X-Window system automatically during initial installation.
- It Doesn’t Work – Typically, you are using graphics hardware that isn’t supported by the X-Window system, the display isn’t recognised by the X-Window System or something is unrecognised. Though much information and knowledge sharing is available, troubleshooting X-Window issues for a given Linux/X/hardware/driver combination can be challenging.
Besides reading HOWTO’s on the X-Window system (available from the Linux Documentation Project – http://tldp.org), there are several ways to troubleshoot the X-Window System.
If you have another system available, log in to the problem system remotely and try to start the X-Server by running startx (/usr/X11R6/bin/startx, /usr/bin/startx). This should at least display any error messages that may be produced. If you run ‘startx’ on the local system, the error messages may be masked by the graphics system or Windows Manager. Sometimes, the X-Window system takes control of the keyboard and mouse but then seems to ignore any further input. Being able to login to the problem system remotely allows you to view log files and error messages, even if the local keyboard isn’t working.
Try booting from a ‘Live CD’ version of Linux to see if you can configure the X-Window system. In my experience, Knoppix (http://www.knoppix.org) has done a very good job of automatically configuring the X-Window system. If the Live CD works, you might try copying the Live CD generated X configuration and using it under your installed version of Linux.
Review your X-Window system configuration file (typically /etc/X11/xorg.conf) to see if it matches the configuration you think you have. The configuration file usually contains many comments explaining the configuration choices available. The X-Window system source code also contains much information on configuration choices.
Common Problems and Solutions
This section describes common X-Window problems and their solutions.
1. I did not install the X-Window System during initial Linux install – how can I install it now?
First, mount your Enterprise Linux CD/DVD, navigate to the RPMS directory, then install the appropriate X related packages. Or if you have the repository configured, use the “yum” package manager to install the xorg-x11-apps packages as shown below.
# yum install xorg-x11-apps
2. How to get a graphical login all the time until the next reboot?
If your system boots up to text/character mode only, there are two ways to configure a graphical environment; manually and automatically.
Manual Method: A user can start an X-Windows session as needed by running the startx script (/usr/bin/startx) from a terminal session. Remember that when you next log in, only a text-based console will be provided.
Automatic Method: Linux can be configured to automatically boot in graphical mode by using the init command (/sbin/init). To configure graphical mode on boot, edit the value of the initdefault parameter in the /etc/inittab file from 3 (character mode) to 5 (graphical mode), for example:
# /etc/inittab ... # Default runlevel. The runlevels used by RHS are: # 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) # id:5:initdefault: ...
3. When logging into the GNOME environment, I get a warning saying that I’m already logged in.
This could be caused by one of several things. Usually, it means exactly what it says i.e. you’re logged into another computer somewhere else. You can still choose to log in, but your other login session may begin to behave unusually. It’s best to only be logged into one machine (graphically) at a time. If you’re not logged in anywhere else, it’s safe to bypass the warning and log in. This is quite often caused by incorrectly or abruptly exiting the GNOME display manager, such as machine crash, or by logging out of one machine and into another before GNOME has had time to clean up the remnants of the last login session.
4. When attempting to shut own the system from the Gnome logout menu, a window with a red ‘X’ appears. Likewise, when I try to shut off the machine using ‘halt’, ‘poweroff’ or ‘shutdown’ I get other errors.
Your Linux System Administrator has disabled the ability to shut down the server – this is likely done for a number of reasons:
- Linux servers are multi-user systems – by shutting down the machine, you may be causing other users on the same system a great deal of grief.
- Linux servers must remain available at all times for maintenance reasons. Patching, configuration updates and accounting tasks are run daily, requiring the servers be powered on.
5. How do I mount/unmount CD-ROM/DVD/floppy disks?
The GNOME environment allows access to CD-ROMs, DVDs and floppy disks by right-clicking anywhere on the graphical desktop and selecting the appropriate device type from the ‘Disks’ sub-menu. Once the disk is mounted, an icon will appear on the desktop and a check-mark will appear in the menu next to the mounted disk(s). To unmount the floppy disk, CD-ROM or DVD, follow the same procedure as you did to mount the disk. Click on a device in the ‘Disks’ sub-menu to unmount the disk (CD-ROMs and DVDs will be ejected).
Under KDE, an icon for the CD-ROM, DVD and floppy drive may already exist on the desktop. If not, right click anywhere on the desktop and select the device you want to use from the ‘Create New’ menu. After the device icon appears on the desktop, the device can mounted and unmounted by right-clicking on the device’s icon itself.
6. The X-Server seems to have crashed – there is no Enterprise Linux login screen, just a command prompt.
This could be due to several reasons – the following are the most common:
- A user has switched to a virtual console – though the X-Server is still running, it’s just not visible to the console monitor – a virtual console is currently being displayed
- The X-Server has stopped running
In the first case, simply press CTRL+ALT+F7 to switch to the X-Server’s virtual console. If nothing is displayed, the X-Server may not be running. Do not attempt to reboot the machine. Refer to the system message logs and Display manager/X-Window log files for further details.
7. The keyboard shortcuts seem to have changed – what are the new shortcuts?
The following lists common Desktop environment keyboard shortcuts and their function.
- ALL “CTRL+ALT+F1…F7” switches between virtual consoles (F7 being the default graphical console)
- GNOME “CTRL+ALT+arrow keys” switch between virtual desktops
- GNOME “ALT+TAB” switches between applications within a virtual desktop
- KDE “CTRL+TAB” switches between virtual desktops
- KDE ‘ALT+TAB” switches between applications within a virtual desktop
8. How to run a graphical clock on the desktop?
The X-Windows software provides a graphical clock application called xclock (/usr/X11R6/bin/xclock, /usr/bin/xclock). This light-weight graphical clock application is commonly used to test whether a user can successfully display X applications to their X-display. Run the xclock command to display the xclock application, for example:
$ xclock &
9. I ran startx, but all I get is a black screen – What should I do?
It’s possible that X-Windows is incorrectly configured. If this is the first time you are attempting to run in graphics mode, configure the X-Windows/Display manager using the system configuration utility (/usr/bin/system-config-display).
If you have previously been able to configure and obtain a graphical environment, try running running ‘init 5‘ from the command prompt – if it similarly fails, check the system message log and X-Window/Display Manager logs for errors.
Enter the “CTRL+ALT+Backspace” keystroke combination. This key combination should cause the X-Server to exit (crash) and, if possible, restart. If that fails, you may need to reboot the system. After the system has rebooted, verify that your video hardware is compatible.
10. When I run startx, I get errno 111 – What does this mean?
Error number 111 (Connection refused) is a message from an X client (any program attempting to connect with the X-Server e.g. the Window Manager) advising that it tried to connect to the X-Server but failed to do so for some reason. Generally, you only see the last few lines of the error message. For the entire message (to help troubleshoot this issue) run the following command:
# X -probeonly >& startx.out
This will create a file called start.out which will contain the complete error message. Review the error information for clues concerning the real problem with starting X.