Speeding up Slackware

Introduction

     I wrote this due to all the times I have been asked how to make Slackware run faster.  Here are some things that I think will help with making Slackware Linux run faster.
    NOTE: this is an old page, so your mileage may vary.

When You Install

    When you install Slackware Linux, I would recommend that you choose the Reiser File System.  Most home users don't really need that much of a difference in speed, but I prefer this filesystem for its speed and balance. Speed trials here
    Also, I would recommend that you pick the bareacpi.i kernel to boot from AND to install on your machine.  Unless your machine is slower than say around 400mhz cpu speed, your system should be (9 times out of 10) compatible with ACPI.  The few that are faster than 400mhz that are not compatible with ACPI are usually low-price motherboards built by unscrupulous manufacturers.  SiS hardware comes to mind.  ACPI is sometimes required for some machines to even boot properly.  Mine is one of them.

After Installing: Services

    First, you should log in as root.  Let's go look at what boot-time options are enabled in /etc/rc.d.  In this directory you should see something like this:

/etc/rc.d/

Those in color are enabled boot time scripts.  They are executable.  To turn one "on", you make it executable ("chmod +x rc.udev" for example).  To turn one "off", you make it unexecutable ("chmod -x rc.udev" for example).  I have some custom files in here, but the idea is the same.  Do you need people to log into this machine from the network using Secure Shell?  If not, shut off rc.sshd, etc.  Most home users won't need SendMail (rc.sendmail) or NFS (rc.nfsd), but always check your system.  Last, do NOT mess with rc.4, rc.6, or any other file that you are unsure of what it does.  The last thing you want to do is lock yourself out of your own computer.

A New Kernel

    The kernels that come with Slackware are typically built to fill the needs of as many people as possible.  This is the smart way to design Slackware.  However, sometimes this can also seem to cause kernel "bloat", i.e. excess code being loaded into memory on boot.  You can try compiling a new kernel in order to try to remove some of this "bloat", but it's more of a user option.  Compiling a new kernel can also allow you to pick better options for your specific computer.
    On my Acer Laptop (see here for more specifics), I noted a difference of about 4 seconds (at least) in boot speed between pressing the enter key at the LILO prompt and the first time I'm asked to input my LUKS password.

Wrong kernel options and/or bad drivers

    Sometimes you can pick wrong kernel options and this can slow down your computer.  Similar to this, but not identical in concept, is installing bad drivers.  The Linux kernel (2.6.16.20 when this was written) contains enough functionality that most people can do what they need with Linux.  However, some drivers, including but not limited to nVidia and ATI drivers, are not written well for Linux.  They may be unstable at unpredictable times.  This is not disrespect, it is just a warning.  If you think a driver may be causing a problem, report the problem to whoever is in charge of it.  Also, misconfigured drivers can cause a slow down.  I remember one version of Mandriva hanging for 5 minutes at boot time only because I forgot to install the firmware for one of the network drivers I am using.

LILO options

    Sometimes hard drives get mis-detected by boot loaders due to machines with an inferior (shoddy) BIOS.  I have seen some poorly written BIOSes cause all number of problems with Linux.  You should configure the boot loaders and/or kernel to adapt to this.  One famous one is hard drives without DMA support.  Mostly this is caused, ironically, by lack of ACPI support in the kernel, but sometimes this can be fixed using boot loader options to pass info to kernel modules at boot.
    As for LILO itself, you can specify "compact" at the top of your lilo.conf to tell LILO to enhance boot time, and there are other options to help speed up the overall process.  Be sure to read the documentation on as many programs as you can to be as well educated as you can be.  The more you know, the more capable you can be when you need to troubleshoot a slow boot.

Miscompiled Software

    Sometimes it is incorrectly configured or compiled software.  Gentoo Linux in its early years was suspect in this, as its users would specify extreme, unstable options when compiling their operating system, and then wonder why it ran slower and was less stable.  Usually, stability and speed are not compatible goals.  However, software compiled incorrectly, when this causes it to be unstable, can become much slower than more conservatively compiled software.  This is because the software can have internal problems that it either tries over and over to overcome, which takes time, or else it simply shuts itself down, causing you to have to run it over again.

Initialization Scripts

    While Slackware Linux is designed to run smoothly and properly on as many computers as possible, there are some things you can do to increase boot speed.  Slackware Linux's initialization scripts are located in /etc/rc.d/rc.*.  One thing you can do, if you have a newer computer, is set all the wait periods in these scripts to a faster setting.  Usually the "sleep" command is used to give a pause between commands to allow hardware to stabilize or initialize as the system boots up and is configured.  You can set these sleep commands such as "sleep 4" to "sleep 1", which is one second of wait time.  WARNING: before modifying any script, ALWAYS back up the script so that if the change causes problems, you can restore the original quickly and (hopefully) painlessly.  I recommend that before you modify any script, copy it to (for example) rc.S.old, etc.

InitRD

    To run Slackware Linux's generic-smp kernel, at time of writing, the computer admin (i.e. you) for Slackware Linux had to make an initrd so that support for the filesystem chosen for the root partition was loaded, so that one could successfully use the generic-smp kernel.  Also, those using any "advanced" configuration (LUKS, RAID, LVM, etc) are required to use an initrd.  One thing written into the initrd script is a wait period for devices such as hard drives to be ready for further commands.  This is something that can be modified.  When you use the mkinitrd command to create your initrd, you can specify a wait time such as 0 (as in no wait).  This is a way to shave some seconds off your boot time.  To do so, add the "-w 0" option to mkinitrd.  WARNING: if your hardware is a bit slow (either due to age or some other reason), this may cause your computer to be unable to boot.  Always have an alternate kernel configured to boot from so that if your changes don't work, you can still boot some other kernel.

Hard Drive Parameters

    Another way I've found to increase boot time is to put the hard drive in maximum performance mode (as opposed to power saving mode) at boot.  This can be done by adding the "hdparm -B 254 /dev/sda" command at the very top of /etc/rc.d/rc.S.  See WARNING in Initialization Scripts.

In The End

    In the end, most boot time sluggishness and overall lazy system performance is your computer itself.  I've seen a well-configured, simple Linux installation boot much faster than an optimized Windows install, and also act more responsive for months.  Sometimes your hardware just can't go any faster.  Time to upgrade your computer.

Conclusion

    Computer performance can usually be improved by properly configuring Linux.  However, sometimes it's just a slow computer.  Hopefully this has helped you figure out why and how to fix it.  Have fun!