6.5 xdm

As Linux becomes more and more useful as a desktop operating system, many users find it desirable for the machine to boot straight into a graphical environment. For this, you will need to tell Slackware to boot straight into X, and assign a graphical login manager. Slackware ships with three graphical login tools, xdm(1), kdm, and gdm(1).

xdm is the graphical login manager shipped with the X.org system. It's ubiquitous, but not as fully features as alternatives. kdm is the graphical login manager shipped with KDE, The K Desktop Environment. Finally, gdm is the login manager shipped with GNOME. Any of the choices will allow you to log in as any user, and choose what desktop you wish to use.

Unfortunately, Slackware doesn't include a nice program like xwmconfig for choosing what login manager to use, so if all three are installed you may have to do some editing to choose your preference. But first, we'll discuss how to boot into a graphical environment.

In order to start X at boot, you need to boot into run-level 4. Run-levels are just a way of telling init(8) to do something different when it starts the OS. We do this by editing the config file for init, /etc/inittab.

# These are the default runlevels in Slackware:
#   0 = halt
#   1 = single user mode
#   2 = unused (but configured the same as runlevel 3)
#   3 = multiuser mode (default Slackware runlevel)
#   4 = X11 with KDM/GDM/XDM (session managers)
#   5 = unused (but configured the same as runlevel 3)
#   6 = reboot

# Default runlevel. (Do not set to 0 or 6)
id:3:initdefault:

In order to make Slackware boot to a graphical environment, we just change the 3 to a 4.

  # Default runlevel. (Do not set to 0 or 6)
  id:4:initdefault:

Now Slackware will boot into runlevel 4 and execute /etc/rc.d/rc.4. This file starts up X and calls whatever login manager you've chosen. So, how do we choose login managers? There are a few ways to do this, and I'll explain them after we look at rc.4.

  # Try to use GNOME's gdm session manager:
  if [ -x /usr/bin/gdm ]; then
    exec /usr/bin/gdm -nodaemon
  fi

  # Not there?  OK, try to use KDE's kdm session manager:
  if [ -x /opt/kde/bin/kdm ]; then
    exec /opt/kde/bin/kdm -nodaemon
  fi

  # If all you have is XDM, I guess it will have to do:
  if [ -x /usr/X11R6/bin/xdm ]; then
    exec /usr/X11R6/bin/xdm -nodaemon
  fi

As you can see here, rc.4 first checks to see if gdm is executable, and if so runs it. Second on the list is kdm, and finally xdm. One way of choosing a login manager is to simply remove the ones you don't wish to use using removepkg. You can find out more about removepkg in Chapter 18.

Optionally, you can remove the executable permission from those files that you don't want to use. We discuss chmod in Chapter 9.

# chmod -x /usr/bin/gdm

Finally, you can just comment out the lines for the login manager you don't want to use.

  # Try to use GNOME's gdm session manager:
  # if [ -x /usr/bin/gdm ]; then
  #   exec /usr/bin/gdm -nodaemon
  # fi

  # Not there?  OK, try to use KDE's kdm session manager:
  if [ -x /opt/kde/bin/kdm ]; then
    exec /opt/kde/bin/kdm -nodaemon
  fi

  # If all you have is XDM, I guess it will have to do:
  if [ -x /usr/X11R6/bin/xdm ]; then
    exec /usr/X11R6/bin/xdm -nodaemon
  fi

Any lines preceded by the hash mark (#) are considered comments and the shell silently passes them. Thus, even if gdm is installed and executable, the shell (in this case bash) won't bother checking for it.