XWN740 X-Windows Configuring and Using Starting X Windows (Chapter 2: Pages 25 – 39 ) Agenda Starting X Windows Virtual Terminals Enabling/Disabling Display Manager at Boot startx Starting Multiple Servers Working in X Without a Mouse Terminating X Windows Session Starting X Windows Review from Last Week: We mentioned last week that only first two layers of diagram are required, and we can mix and match other layers... We will now see how this can be done... Starting X Windows Virtual Terminals in X Linux, FreeBSD, and many other modern Unix kernels support a virtual terminal (VT) (or virtual console) capability, which provides independent virtual video cards. The monitor, keyboard, mouse, and physical video card are associated with only one VT at a time, and each virtual video card can be in a different display mode. Some of these terminals are in text mode, others in graphical mode. Learning how to access these modes can be very useful... Starting X Windows Virtual Terminals in X To switch virtual terminals, press <CTRL><ALT><Fx>, where Fx is a function key F1 through F12. If you are currently in a virtual terminal you can then press <ALT><Fx> if the current virtual terminal is in text mode. Keys <ALT><Right Arrow> and <ALT><Left Arrow> to move to next / previous X server if you are in display NOT running X Windows server. Starting X Windows Virtual Terminals in X Virtual Terminals 1 – 6 (Text Based). Virtual Terminals 7 – 12 (Graphical). These rules may may depend on Linux Distro Starting X Windows Starting X Windows Server Manual Start Disadvantage: No client(s) are started – only root window. Must start client applications manually Advantage: Precise control over X server startup options (i.e. Just run the client program you want – eg. kiosk) Starting X Windows Starting X Windows Server Manual Start Examples: X :1 X :2 & sleep 2 ; DISPLAY=2 xeyes X :1 -terminate & sleep 2;DISPLAY=:1 xterm X Windows server terminates upon client app terminating Starting X Windows Starting X Windows Server Manual Start with Display Manager Examples: init 3 startx Used to set run level to text-based mode with network support (init 5 sets to graphical with network) Starting X Windows Permanently Change Runlevel To permanently change the default runlevel, add the following line in the /etc/initab file: id:5:initdefault: or id:3:initdefault: Debian based systems (eg Ubuntu) have different methods... Starting X Windows Manually Starting X Windows: Using startx command Purpose The xinit utility can be used to start an X server with specified clients, but the startx wrapper script provides a friendlier interface. Also, as sys admin, runlevel 3 is avoids further overhead of X Windows system unless required every now and then.... Examples: startx startx -- :1 startx /usr/bin/xterm -bg yellow -geometry 180x50 --:1 Starting X Windows What Starts the Display Manager Automatically? Depending on your system configuration, the display manager may be started directly by init, or through an init script. It's useful to know how the display manager starts so that you can make changes and so that you know what will happen if the display manager exits (or crashes!). In some Linux distributions, the display manager is directly started by init. For example, in Fedora's /etc/inittab, you will find this entry: # Run xdm in runlevel 5 x:5:respawn:/etc/X11/prefdm -nodaemon Starting X Windows What Starts the Display Manager Automatically? Some Linux distributions use startup scripts to execute the display manager. Similar to the prefdm script used by Fedora, this script finds your preferred display manager using a configuration file—in this case, /etc/sysconfig/displaymanager—or it uses XDM if that file is missing. Starting X Windows AUTOMATIC CONFIGURATION (MULTIPLE X SERVERS) XDM (Xt) XDM and older versions of KDM (pre-3.4) use the Xservers file to configure the number of servers started by the display manager. The location of this file varies; try /etc/X11/xdm/Xservers or /opt/kde3/share/config/kdm/Xservers. To start additional X servers, simply add lines at the bottom of this file: :1 local /usr/bin/X :1 vt8 :2 local /usr/bin/X :2 vt9 Starting X Windows KDM (Qt) If you're using KDE 3.4 or higher, the local X server configuration is controlled by the kdmrc file (/etc/X11/xdm/kdmrc or /opt/kde3/share/config/kdm/kdmrc). In the [General] section of that file, you can specify a list of local displays to be started by adding a StaticServers key: StaticServers=:0,:1,:2 Starting X Windows GDM (GTK+) GDM is configured using two files; the first specifies default values, which may be overwritten when GDM is updated, and the second provides local values, which are never overwritten. The name and location of these files varies; on an Ubuntu system, the defaults are in /etc/gdm/gdm.conf and the local settings are in /etc/gdm/gdm-custom.conf, while on a Fedora system, the defaults are in /usr/share/gdm/defaults.conf and the local settings are in /etc/gdm/custom.conf. Starting X Windows GDM (GTK+) There are two sections in the GDM default configuration file that deal with local X servers. The first defines the command to be used to start a new server, and it looks like this: [server-Standard] name=Standard server command=/usr/bin/X flexible=true This will start a single server with a display number of :0. To configure GDM to initially start additional servers with the same configuration, add a servers section to the local configuration file: [servers] 0=Standard 1=Standard 2=Standard Starting X Windows Pointing without Mouse in X Windows Purpose Useful to know there is a method to use pointer if mouse is not working Press <SHIFT><NUMLOCK> to toggle mouse keys mode Unavailable on keyboards that do not have NUMERIC keys Terminating X Windows FROM COMMAND LINE: Can use the killall command Examples: Killall X Killall xdm Killall kdm Killall gdm-binary Killing display manager has benefit of still running X Terminating X Windows Terminating X Windows Session Within Graphical Session When the server is hopelessly messed up, zapping it may be your only available option short of a hard reset—and it is safe to do when no clients are connected Press <CTRL><ALT><BACKSPACE> to toggle mouse keys mode Disadvantage: Any work-in-progress may be lost, and files may be left in an indeterminate state.