Henry Griggs Rambling
Recent TopicsVisit to Australia 2002
Sydney house 2002
Circular Quay 2004
Circular Quay 2002
Centrepoint Tower 2004
Oz Birds 2004
Oz Birds 2002
Bridge Climb 2002
Popular TopicsGallbladder removal
Photo of the day
Geek Alaska 2003
UK in 2003
Geek Caribbean 2002
Photo Of The Day
Setting up X on Slackware
3rd September 2001
updated 26th May 2004
Until a few years ago, setting up X was my biggest problem with getting a new Linux installation working. However the last few years have seen great improvements and a large amount of simplification of the configuration files. Slackware 8.0 and upwards have proved to be very easy to get X going. Originally, I wrote a set of notes for someone new to it, and put them here. They have proved popular, so I have upgraded them a little.
I don't like to do a Linux installation and have it boot straight into X for a GUI login. If you haven't setup X properly, then you can never boot and log in. I set it up initially for command line logging in, then I get X working properly, and only then do I set it up for the GUI logon.
For these instructions, I assume that you have installed Linux, with all the X packages, and you can login at the command line.
During installation, you will have been given a lot of choices. In Slackware, the packages you need are
The two optional packages are
If you didn't install X and XAP, you will need to go and install them. If you want Gnome or KDE or both, go back and install the Gnome and KDE packages. I usually install both Gnome and KDE because I like to go and look at them occasionally, and show them off to other people, and disk space is not a problem. I don't actually use the desktops, as I prefer my configuration of fvwm2, but I do use some of the Gnome or KDE programs under fvwm2. Once these are installed, you can continue.
The X Window System is a two tiered structure.
I use fvwm2 for my window manager because it lets me do everything I need, it's configurable through one simple text file (none of this mouse/menu configuration stuff), it's fast, doesn't use much memory, and I'm used to it. Yes, I have tried other window managers, but I keep coming back to fvwm2. In 2003, I tried Blackbox, and a derivative called Fluxbox. These were really nice window managers. Very fast, low memory usage, lightweight, and very very pretty. The themes, and the easy configuration caused me to switch to them for a few months. However the functionality of fvwm2 drew me back, and I learnt how to make themes for fvwm2 and how to make fvwm2 just as pretty as Blackbox and Fluxbox.
There is often an optional third layer on top of this, and that's the Desktop. This provides lot of applications and utilities and applets and GUI configuration tools. There are a couple of these around:
You don't have to run a Desktop. I generally don't. But you can if you want to. These are sometimes described as Window Managers, and are offered instead of Window Managers in installation menus, but they aren't. Underneath them is still a Window Manager, even if they try and hide it.
Your job is to get each of these 3 levels configured and working. The first level, the X Server, can be tricky. The other two are very easy.
Configuring the X Server
To get the whole process started, we have to configure the X-server. To do this we have to supply the details of your hardware:
You are probably using a standard mouse and keyboard so that won't give you any grief. It's the video card and monitor that often frustrate people. What you should do before you start is make a note of what make and model your video card is. For your monitor, make a note of the make and model, and look through the manual, or search the manufacturer's website for details about the horizontal and vertical refresh rate. Don't get too upset if you can't find this. If you can find it, you'll get more precise control of the system, but if you can't, you can still run X.
First you must log on as root. X configuration is done at root level. Then there are two paths you can go by, depending on your version of XFree86.
"xf86config" for earlier XFree86
"X -configure" for XFree86 4+
Okay, now let's test your config file. Change back to root's home directory. Stay logged in as root. Type "startx 2> x.log". You'll get one of four outcomes:
When you achieve success, exit back to the command line.
Fine-Tuning the X Server Configuration
That should get you going. You won't be happy though. There is fine tuning required to get the screen to look good and to work at the resolution you probably want. That is all done by hand editing the file /etc/X11/XF86Config. Use mine as a reference. The important section to look at is the Screen Section at the end.
Here is my Screen Section:
Section "Screen" Identifier "Screen 0" Device "Card0" Monitor "Monitor0" DefaultDepth 24 Subsection "Display" Depth 8 Modes "1024x768" "640x480" "800x600" ViewPort 0 0 EndSubsection Subsection "Display" Depth 16 Modes "1024x768" "640x480" "800x600" ViewPort 0 0 EndSubsection Subsection "Display" Depth 24 Modes "1024x768" "640x480" "800x600" ViewPort 0 0 EndSubsection EndSection
There are several things that I fiddle with - the default colour depth and the resolution order.
Default Colour Depth
I set the default colour depth to 24 (DefaultDepth 24). That gives me plenty of colours and doesn't slow the system down. The range of depths is:
You should be able to discover the mathematical progression in that list.
I like to have my screen running at 1024 x 768 pixels. To set that up, I edit XF86Config. I go to the Screen section, and choose the Display Subsection that matches my DefaultColourDepth. Then I edit the Modes line, so that "1024x768" comes first. The first one in that line is what the X Server will start up with. Each time you press Ctrl-Alt-Num+ it will advance to the next one on the line. Each time you press Ctrl-Alt-Num-, it will move to the previous one. So set them up in with the one you want to start with in first place, and the rest in the order that you want to move through.
Type "startx 2> x.log" and test it. Test that it starts with the one you want and that they move in the right order. If it doesn't start in the right one, or misses some when you move through the list, exit and check the log file x.log. You'll probably find that your video card/monitor combination isn't set up to handle the missing combinations. The log file will show you what's wrong. You can correct XF86Config and try again.
These days it's impossible to buy a decent three button mouse. All you can get are two button mice with a scroll wheel where the middle button should be. As a sop, you can click down on the scroll wheel and get the middle mouse click. I loathe these things. I absolutely hate scroll wheels. I want a decent three-button mouse, with no scroll wheel. Logitec used to make them, but now pander exclusively to the Windows world. Thankfully, eBay still digs up the old Mouseman and I stay in stock.
However, most people have scroll wheels on their mice, and want to use them. You can do it with X too. It's been documented by others, so try these sites:
If you want to get into all this some more, then you should do some reading. Your reading should start with "man XF86Config". Then try the brief HOWTO written by Eric Raymond, found in Slackware at /usr/doc/Linux-HOWTOs/XFree86-HOWTO. Then use Google and STFW.
Then read some other books like:
If you want to get heavily into the video timings and get a deeper knowledge of such things, you should read Eric Raymond's HOWTO about video timings, found in Slackware at /usr/doc/Linux-HOWTOs/XFree86-Video-Timings-HOWTO.
Now that the X Server is running, the next thing to do is shift to a graphical login so you can choose your Window Manager, and then you can start configuring it.
What you want now is to have an automatic graphical login. That is, when you boot into Linux, you don't get a command line, you get a nice fancy graphical screen, and you can login and choose your Window Manager on the fly.
NOTE This is for Slackware. With Slackware, runlevel 4 starts graphical login. On other Linux distributions, a different runlevel is required.
From now on, when Linux starts, you will get a graphical login screen. This could be one of three programs:
Which one is used? You've changed the default boot process from runlevel 3, to runlevel 4. So look in /etc/rc.d and have a look at rc.4. This startup script shows which login program will start first. It tries gdm, then kdm, then xdm and then gives up. That is, it tries GNOME's gdm first. If it doesn't find it (maybe you didn't install the Gnome desktop), then it tries KDE's kdm. If that doesn't exist (maybe you didn't install KDE) then it tries the old standby xdm. And if that doesn't exist (maybe you deleted it in a fit of pique), then it says that you can't use runlevel 4 without one of those three programs installed, and then it will reboot. It will probably reboot and reboot until you do something tricky like forcing a runlevel 1 boot, and changing inittab's initdefault back to runlevel 3.
If you want to force use of kdm, or gdm or xdm, then edit /etc/rc.d/rc.4 and change the script to do what you want it to do.
xdm is a legacy of the past. It's primitive. You get to enter your logon name and password, and then a Window manager starts up. This is controlled by your $HOME/.xsession, or if you don't have one, by the default /etc/X11/xdm/Xsession. Have a look at this file to see how it's done. It's interesting. xdm can be configured quite a lot, by editing /etc/X11/xdm/xdm-config. Use 'man xdm' as your starting point. I think you can even set it up to choose which Window Manager. If you want to know more, check out these books. They have large chapters on xdm and its configuration.
gdm is an adequate graphical logon. You can configure it on the fly, by selecting Session -> Configure, and entering your root password, and then fiddling with all the options. You can choose which window manager to use at each logon. I don't like the logon name and password on different screens, and I don't like the positioning of the window manger choice. Too many steps. But that's just my prejudices at work. You might prefer it like that.
kdm is the default graphical logon for Slackware. It's the second choice in /etc/rc.d/rc.4. I prefer to use it, so I edit the file and make it the first choice. You can organise rc.4 to suit yourself. I prefer kdm because I like how I can enter logon, password and window manager choice very cleanly. Configuration is done the way I like it. You edit a text file. Edit the file /opt/kde/share/config/kdm/kdmrc. I usually change it so that it doesn't show the heads and list the logon names, replaces the KDE logo with a clock, and I change the greeting to something like "astoria on Henry's Network", where astoria is the host name of my machine.
So I stick with the KDE graphical logon, kdm, and this lets me enter my name and password and choose which Window Manager or Desktop I want to work with.
When you do get to kdm or gdm, you'll notice that they will offer both Desktops and Window Managers as Window Managers. That's okay. The Desktop options will automatically start whatever Window Manager they favour this month, and then insert themselves on top.
Configuring the Window Manager
Each Window Manager (and Desktop) is configured completely differently. I'll leave that as an exercise for the reader. However, I'll include my .fvwm2rc so you can see how I configure that to suit my needs. This file used to be stored in my home directory, but the latest version of fvwm2 expects to see it located in $HOME/.fvwm/.fvwm2rc, so I store it there now.
You'll notice that all the menus I use have no little icons attached to them. With fvwm2, you can put a mini icon on every menu, if you are visually inclined. However, I learnt to read as a child and have no need for such reminders. I removed them all. All my menus are text, small, and slick. I don't have to worry about finding a whole bunch of small silly icons and making them available in the right paths.
If you use the Gnome or KDE Desktops, or pretty much any of the Window Managers, you can attach little icons to almost anything, customising your window environment way past the useful stage.