Making Linux Useful

by Andrew Piskorski Last Revised: 4 June 2003

This is a catch-all document for information I've found useful when using, configuring, and maintaining Linux computer systems - like the title says, things that have helped me in Making Linux Useful.

See also: CVS for UNIX configuration files.

For a taste of real system administration, read Bootstrapping an Infrastructure (or here).

Debian Package Management - apt-get, dpkg, dselect, etc.:

In additon to the defaults, here are some packages you almost certainly want to install with "apt-get install -u":

For security reasons, simply uninstall these packages:

TODO: Put my live package list and /etc/apt/sources.list here.

TODO: Useful non-Debian package sources:

TODO: Easy examples of using alien (converting Citrix ICAClient-6.0-1.i386.rpm to icaclient_6.0-2_i386.deb, etc.)

Mixing packages between stable, unstable, and/or testing:

$ cat /etc/apt/apt.conf
APT::Default-Release "stable";
E.g., "apt-get -t testing postgresql". TODO: Add more info.

Run Debian GNU/Linux:

Run Debian Linux. Why? For one thing, Debian's package management, install, and upgrade system is vastly superior to that of any other distribution. Adam Powell seems to have a pretty good list of some reasons why Debian is "the greatest distribution there is", as well as some Debian HOWTOs.

The only drawbacks I've experienced are:

adduser, addgroup:

On Debian, don't use useradd and groupadd like you would on Solaris or any other unix system. Instead, use adduser and addgroup. These are front ends to the older commands, and their defaults make much more sense.


To change which programs are the system-wide defaults for various tasks, e.g. window manager (sawfish), desktop environement (Gnome or KDE), or tclsh (tclsh8.3), simply edit the symlinks in /etc/alternatives. This stuff is maintained by update-alternatives but all you have to do is manually change the symlinks.

For example, for X-Windows I manually changed these symlinks to use Gnome and Sawfish:

x-session-manager -> /usr/bin/gnome-session
x-window-manager -> /usr/bin/sawfish
x-window-manager.1.gz -> /usr/share/man/man1/sawfish.1.gz

If you're a programmer and use ctags or etags, you probably want to install the ctags-exuberant package, and use it by changing your /etc/alternatives from this:

ctags -> /usr/bin/ctags.xemacs21
ctags.1.gz -> /usr/share/man/man1/ctags.xemacs21.1.gz
etags -> /usr/bin/etags.xemacs21
etags.1.gz -> /usr/share/man/man1/etags.xemacs21.1.gz
to this:
ctags -> /usr/bin/ctags-exuberant
ctags.1.gz -> /usr/share/man/man1/ctags-exuberant.1.gz
etags -> ctags
etags.1.gz -> ctags.1.gz


On Debian, in theory, instead of manually manipulating the symlinks in /etc/rc?.d you're supposed to use update-rc.d. However, this appears to be oriented and intended solely as an abstraction layer for use by package install scripts. For manual changes, simply change the symlinks directly.

System Configuration Tweaks:

ntpd - Network Time Protocol Daemon:

You should run ntpd to keep your system clock accurate. You should also run ntpdate on boot, as if the clock is way off (e.g., because the battery on your motherboard backing up the hardware clock died, or because you or some other operating system set the hardware clock incorrectly), ntpd will refuse to run at all. Running ntpdate at boot will insure your system clock is close enough for ntpd to work.

On Debian, if you haven't already, install these packages:

You also need to add one or more time servers into "/etc/ntp.conf". TODO: What are some good public time servers to use?

XFree86 X-Windows Configuration, etc.:

Configuring /etc/X11/XF86Config-4:

There is no One True Way to do this, AFAIK. It's always required manual debugging every time I've ever done it.

There are at least 3 or 4 ways of generating the initial Xfree86 config file. I used the first one below, which is only going to work on Debian. For non-Debian systems, try the second. Use one of these:

  1. dpkg-reconfigure xserver-xfree86 ;# runs dexconf
  2. XFree86 -configure
  3. xf86config
  4. xf86cfg
Then debug and change things manually as necessary.

You could have a bad graphics card - I've seen it happen. But first, try setting your color depth lower, as that may fix things. E.g., on my current Matrox 450 16 MB card dual headed card, I have to use 16 bit color, as if I use 24 bit the second monitor goes wacky.

TODO: Add known good copies of my various XF86Config-4 files here.

Mouse snafus:

You probably want to use gpm, as even if you don't care whether you have a mouse cursor on the Linux virtual terminal, it is useful to be able to run "/etc/init.d/gpm restart" to fix you mouse under X if you unplug/replug it or it just otherwise gets hosed up. Here are my mouse gpm settings:

$ ls -l /dev/mouse /dev/gpmdata /dev/psaux 
prw-r--r--    1 root     root            0 Dec 29 18:58 /dev/gpmdata
lrwxrwxrwx    1 root     root            7 Dec 26 19:01 /dev/mouse -> gpmdata
crw-------    1 root     root      10,   1 Jan  7 23:03 /dev/psaux

$ cat /etc/gpm.conf

Turn off xdm:

The Debian kdebase package stupidly depends on x-display-manager, so if you want to have any KDE stuff installed you have to install at least one X display manager (xdm, gdm, or kdm). But, I do not want X running all the time on my box, I'm perfectly happy to login on the console and then type "startx" when I want to run X. Debian's default run level is 2. By default xdm is starts in run levels 2-5, but I want to change it to only start in run level 5.

"sudo dpkg-reconfigure xdm" doesn't do anything at all, so presumably the xdm package insists on always installing itself in all those run levels. This would be the correct update-rc.d for what we want:

sudo /usr/sbin/update-rc.d xdm stop 01 2 3 4 . start 99 5 .
But update-rc.d is really only intended for use by Debian package install or remove scripts, and gives us a "System startup links for /etc/init.d/xdm already exist." error. So simply make the equivalent changes manually:
sudo rm /etc/rc[234].d/*xdm*
sudo cp -pd /etc/rc1.d/*xdm* /etc/rc2.d/
sudo cp -pd /etc/rc1.d/*xdm* /etc/rc3.d/
sudo cp -pd /etc/rc1.d/*xdm* /etc/rc4.d/

Web Browsers - Mozilla, Netscape:

Mozilla is in general vastly superior to Netscape 4.x, and overall, Mozilla is also much more stable and useful than Netscape 4.7x. But at least with Mozilla 1.0.0 (the version in Debian Woody 3.0), you'll still want the old Netscape 4.x browser for some things. Here's what I fall back to Netscape 4.77 for: For Netscape 4.7x, do not install the "netscape" pacakge - it won't work right, I don't know why. Instead, install "navigator", it works just fine even while Mozilla is also running.

Console video text modes:

I tried the "vga=ask" in /etc/lilo.conf, but none of the VGA modes I'd select on boot seemed to "stick". I'd see a different video mode briefly, then it would vanish and I'd be back at the usual 24x80 screen.

svgatextmode didn't work for me, on boot it says:

Invoking SVGATextMode... detected framebuffer(aborting) see STM_nocheckfb(5).
I believe the framebuffer it's talking about is a Linux module that the Debian installed seemed to think wasn't really necessary, but was probably a good idea to install - don't ask me why.


Linux Setup:

The Linux CD-R user software tools (e.g., cdrecord) all work only with SCSI devices, so if you have an IDE CD-R drive, you need to access it with the ide-scsi driver (loadable kernel module), NOT with the normal ide-cdrom driver, so that it looks like a scsi device to cdrecord. And if you want to be able to copy from you CD-ROM to your CD-R drive (you do), then you must also use the ide-scsi driver on your CD-ROM. Basically, just use ide-scsi for ALL your CD drives, and be done with it.

First you need to edit /etc/lilo.conf to tell the kernel to use the ide-scsi driver. Your CD-ROM is likely device 'hdc', but look through your /var/log/dmesg boot messages to find out for sure. Then edit /etc/lilo.conf as appropriate, e.g.:

  # Use SCSI for IDE CD-ROM/DVD and CD-R drives: 
  append="hda=ide-scsi hdc=ide-scsi"
  # /dev/{sr0,scd0} are the DVD
  # /dev/{sr1,scd1} are the CD-R
After ediing lilo.conf, run 'sudo lilo' to install your new lilo settings into your MBR, and reboot ('sudo shutdown -r now').

After successfully rebooting, again look through /var/log/dmesg to find the new, SCSI-style device name - mine was 'sr0'. Now you have to change your /dev/cdrom symlink to point to the correct new SCSI device for you CD-ROM:

$ ls -l /dev/cdrom 
lrwxrwxrwx    1 root     root            8 Nov  8 18:25 /dev/cdrom -> /dev/hdc
$ sudo rm /dev/cdrom
$ sudo ln -s /dev/sr0 /dev/cdrom
$ ls -l /dev/cdrom /dev/sr0 /dev/scd0
lrwxrwxrwx    1 root     root            8 Nov  8 18:25 /dev/cdrom -> /dev/sr0
lrwxrwxrwx    1 root     root            4 Nov  2 09:47 /dev/sr0 -> scd0
brw-rw----    1 root     cdrom     11,   0 Mar 14  2002 /dev/scd0
$ sudo cdrecord -scanbus
Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jvrg Schilling
Linux sg driver version: 3.1.22
Using libscg version 'schily-0.5'
        0,0,0     0) '3ware   ' '3w-xxxx         ' '1.0' Disk
        1,0,0   100) 'PIONEER ' 'DVD-ROM DVD-116 ' '1.22' Removable CD-ROM
        1,1,0   101) 'TEAC    ' 'CD-W540E        ' '1.0D' Removable CD-ROM

CD-R Software to Use:


The Linux Kernel:

You'll almost certainly want to change from the default vmlinuz-2.4.18-bf2.4 kernel that the bf24 Debian install gave us. Currently, Debian 3.0 has Athlon (K7) and SMP kernel flavors, but not Athlon SMP flavors. So we'll want to build our own.

If you have an SMP machine, running a non-SMP kernel will work just fine but only one of your CPUs will be used. Debian 3.0 did not ship with a pre-compiled Athlon SMP kernel, so after running the non-SMP 2.4.18-bf2.4 for a long time, I built my own. Building a kernel whose source is packaged for the Debian release your running turned out to be quite easy.

Basically, just follow the instructions in Chapter 7 - The Linux kernel under Debian of the Debian Reference. After installing the necessary packages, unziping the source tarball, and tweaking /etc/kernel-pkg.conf, it amounted to just:

$ cd /usr/src/kernel-source-2.4.18
$ cp -p /boot/config-2.4.18-bf2.4 ./.config
$ make-kpkg clean
$ make menuconfig
$ fakeroot make-kpkg --append_to_version '-myname-athlon-smp' --revision=rev.01 kernel_image modules_image
$ cd ..
$ sudo dpkg -i kernel-image*.deb

TODO: I don't know why you would or would not want to use --initrd with make-kpkg above. "grep initrd /etc/lilo.conf" showed that my system wasn't currently using initrd, so I left it that way.

Currently, 2.4.18 is the latest kernel in Debian Stable 3.0. It is possible to use newer sources, but seems to usually require upgrading various kernel build-related packages first, which I didn't really want to get into at the time.


Long ago on Debian 2.2 (Potato), my /etc/printcap didn't seem to be correct, I installed some package I don't remember (which was probably overkill), messed around and eventually got my HP LaserJet 2100M (connected to the parallel port) working fine.

Debian 3.0 comes by default with the traditional BSD lpr package, but also provides lprng and CUPS, both of which are supposed to be better. I removed lpr, installed cupsys and cupsys-bsd. CUPS worked very smoothly for me, and seems to be nicely documented.

TODO: Minor but obnoxious annoyance: My otherwise wonderful HP LaserJet 2100M has its toner saving mode turned on be default, and I don't know how to turn the default off, nor how to override it on a case-by-case basis when printing. (The printer ships from the factory with thetoner saving mode defaulted to off, but I believe sometime back 1997-99 when I was still running Windows NT for my primary desktop, I used the HP Windows software to change that, and oops, now I have no convenient way to change it back.)


Sound: As long as you have the proper Linux kernel sound module loaded (in my case, emu10k1 for a Creative Labs Sound Blaster Live), just add yourself to the audio group in /etc/group and you should be good to go. (On Debian, /dev/dsp and /dev/audio have group audio by default.)

There are also ALSA packages but I'm not really sure what why/when you would need them.

Debian sound related packages to install:

TODO: Find best mp3, etc. players.

Real Audio Player:

Links with info: one, two, three.



If you want to accept forwarded X connections, make sure you put "X11Forwarding yes" into "/etc/ssh/sshd_config".

You may also want to put "ForwardX11 yes" and "ForwardAgent yes" "/etc/ssh/ssh_config", so you don't have to manually enable them with "ssh -XA" every time you use ssh.

TODO: Try Cleverly's Burrow tool for disconnect resistant ssh connections.

Transferring Files - scp, rsync, etc.:

As far as I know, there's no way to prevent scp from following symlinks, but rsync is more flexible:
rsync -n -avrzlHpt --delete --exclude='.netscape/cache' root@oldmachine:/home /home/oldmachine-bak/


One of the most fabulously useful unix tools ever created. I use it with these aliases, as the default Ctrl-a command key conflicts with Bash and Emacs usage, but Ctrl-o doesn't:
alias scr="TERM=vt100 ; screen -e^Oo"
alias scd="TERM=vt100 ; screen -d -r"

Checking System Resource Use - top, vmstat, iowait, etc.:

Getting I/O Wait info:

Solaris top shows iowait, Linux top does not. How get iowait info on Linux? vmstat shows io, which is useful, but doesn't show iowait, so it's not obvious what the current rate limitor on the box is. I believe the 2.4 Linux kernel does not support collecting iowait statistics, but 2.6 will.


TODO: Add cacheing nameserver with djbdns.



Put entries into etc/hosts.

In Windows 2000, Microsoft has created a new transport for SMB over TCP and UDP on port 445. This replaces the older implementation that was over ports 137, 138, 139

net use x: \\vm-host\HostFS /user:atp
net use x: \\vm-host\HostFS
net use y: \\vm-host\atp

Palm Pilot:


PDF Readers:

Unfortunately, Portable Document Format isn't really as "portable" as it could be. But things have gotten better over time. Now, xpdf, gv, or gnome-gv seem to be work for most documents.

Test Your RAM: is an absolutely fabulous tool. However, note that version 3.0 seems to give bogus errors and lock up for some unusual motherboards (in my case, a Dell PowerEedge 600SC Pentium4 server using DDR2100 ECC Registered RAM).

Temperature Sensors:


For motherboards:

Power Fail Notification form UPS:

TODO: Use nut.

Make your hard disk go faster:

For SCSI disks, or for IDE disks on a 3Ware Escalade RAID array (which looks like SCSI to Linux), I think there's nothing to do.

If you're using a relatively recent IDE disk, it may be much slower than it has any need to be under Linux until you give it some reasonable (for a modern disk) settings with hdparm - or so I've heard.

These commands are safe and will all just display settings and info from your IDE drive:

$ sudo /sbin/hdparm /dev/hda 
$ sudo /sbin/hdparm -i /dev/hda 
$ sudo /sbin/hdparm -I /dev/hda 
To measure your drive's sustained transfer rate (this should also be safe), do:
$ sudo /sbin/hdparm -tT /dev/hda  ;# First IDE disk
$ sudo /sbin/hdparm -tT /dev/sda  ;# First SCSI disk
For comparison, on two Debian 3.0 systems (both with the stock bf24 2.4.18 kernel, both with ReiserFS), typical hdparm -tT results are:

TODO: Put Maxtor 6Y080L0 disk above into DMA mode to improve performance. The reason it's in non-DMA mode in the first place is because the 2.4.18 kernel doesn't recognize the Via 8235 IDE chipset on the motherboard. The most correct fix is to upgrade to a newer kernel, however, from the very small patch used to make the newer kernel recognize the Via 8235, I strongly suspect that simply using "hdparm -d1" with the existing kernel would work fine.

Links: one, two, three.


Do disk performance tests with disk basher or bonnie++.
$Id: linux.html,v 1.7 2003/06/05 03:22:28 andy Exp $