When I first started using Linux, I used Red Hat and Mandrake, both of which booted into a graphical environment by default.
One of the first things I noticed about Slackware when I first installed it was the fact that it booted into a command line only interface by default. From there, I had to log in, and if I wanted a GUI, I had to type “startx” and then it’d start X-windows and go into whatever my default window manager was.
I remember being a little confused about this at first; it wasn’t a problem, but I knew there had to be a way to change that. I figured I’d write up a brief few paragraphs on that subject, since I ended up having to dig around the web some at first to figure that out.
Runlevels in Slackware
Whether Slackware boots into a CLI (command line interface, for those of you who may be unfamiliar with that term) or into a graphical login manager is dependent on something called a runlevel.
Other distros handle this differently from Slackware, so a word of caution here: if you are already familiar with this concept, but are new to Slackware, it still pays for you to not skip over this part.
In Slackware, the default runlevel is 3. What this means is that on boot, the machine will be multiuser and will boot to a CLI only. Basically the only thing missing is X.
Runlevel 4 is the same, but it also starts X with whatever is your default login/session manager.
For most users’ purposes, these are the only two runlevels that matter; experimenting with the others can get you into some trouble that you probably don’t want to mess with.
In Slackware, runlevel is handled on boot in the file called
/etc/inittab, in the first active line of code after the comments at the header of this file.
If you boot your runlevel 3 Slackware box and log in as root, or log in with your normal account and
su, edit this file with whatever command line text editor you prefer (I use nano) and you should find the first active line that looks like this (along with the comment directly above it, for clarity):
# Default runlevel. (Do not set to 0 or 6)
Simply change that “3” to a “4” and save your changes, and this will tell Slack to boot into X from now on.
Default Login Manager
In Slackware, what this does is tells the machine to use
/etc/rc.d/rc.4 to fire up your default login manager. Slackware ships with two, XDM (a.k.a., the “X Window Display Manager”), and KDE‘s login/session manager, called “KDM”. The
/etc/rc.d/rc.4 file also has support for GNOME‘s login manager, “GDM”. This is placed first in this file, in case you have installed GNOME on your machine.
What’s the difference? Not much, truth be told. It’s all a matter of what you prefer. However, if you want one over the other, particularly if you have something like Dropline GNOME installed (and that’s a separate discussion, believe me) but don’t want to use GDM as your login manager, you’ll want to edit
/etc/rc.d/rc.4 and make some changes.
If you type
nano /etc/rc.d/rc.4 you’ll notice there are two “if” statements for GDM, an “if” statement for KDM, and then finally an “if” statement for XDM.
Myself, I prefer the KDM login manager, and since I have Dropline GNOME installed (which means that the first “if” will cause it to fire up on boot in runlevel 4) I have edited my
/etc/rc.d/rc.4 file and commented out the first two GDM “if” clauses with the “#” character on each line. What this does is prevents it from executing those lines, so that the first active lines of code in
/etc/rc.d/rc.4 are the ones checking to make sure KDM is present and then executing them.
If you want XDM instead of KDM, you’ll want to comment out the KDM lines as well, leaving the XDM “if” statement as the only active one in this file.
Then save your changes, exit, and reboot by typing (as root)
shutdown -r now.
If you did everything right, your Slackware machine should boot into a graphical user interface with the login manager you selected in
For reference, here is a link to my
/etc/rc.d/rc.4 file, so you can see what I have commented out and what I have left as active code: Trent’s rc.4 file
Drat, I was thinking of this for my next Slackware tip/HOWTO. Another excellent piece though, keep up the great tutorials.