Some tips on speeding up Slackware 12.2 Boot

My Slackware laptop had decently fast boot times (a little over a minute), but I'm impatient and decided to see if I could speed it up some more. Here's the changes I made and the results down the bottom. This is on a Dell Vostro 1510, with 4GB of ram and a 2.1GHz Core 2 Duo. Obviously the results will vary depending on your hardware.

Lilo and the Kernel

Probably the easiest piece of low hanging fruit is Lilo's "compact" option. This gets rid of the "Loading Linux................" pause straight after the Lilo prompt.

# Start LILO global section
boot = /dev/sda
compact

Another popular step that can provide not inconsiderable speed advantages is to compile yourself a custom kernel.

/etc/rc.d/rc.M

There are quite a few options in rc.M that you can either run in the background (add & to the line) to speed up the boot times, and there's even a few that you can just comment out and ignore.

Starting from the top and going down we have the optical drive symlinks, simply add an "&" to the end of the "/bin/sh /lib/udev/rc.optical-symlinks" line in the following code segment:

# If we're using udev, make /dev/cdrom and any other optical drive symlinks
# if some udev rule hasn't made them already:
if grep -wq sysfs /proc/mounts && grep -wq tmpfs /proc/filesystems; then
  if ! grep -wq nohotplug /proc/cmdline ; then
    if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then
      /bin/sh /lib/udev/rc.optical-symlinks &
    fi
  fi
fi

After that there's fc-cache, gtk-update-icon-cache, and ldconfig; these can be run manually whenever you install a new Font, icon set, or library, so I simply commented out these lines:

## Update the X font indexes:
#if [ -x /usr/bin/fc-cache ]; then
#  echo "Updating X font indexes:  /usr/bin/fc-cache -f &"
#  /usr/bin/fc-cache -f
#fi
## Update any existing icon cache files:
#if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then
#  for theme_dir in /usr/share/icons/* ; do
#    if [ -r ${theme_dir}/icon-theme.cache ]; then
#      echo "Updating icon-theme.cache in ${theme_dir}..."
#      /usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1> /dev/null 2> /dev/null
#    fi
#  done
#  # This would be a large file and probably shouldn't be there.
#  if [ -r /usr/share/icons/icon-theme.cache ]; then
#    echo "Deleting icon-theme.cache in /usr/share/icons..."
#    /usr/bin/gtk-update-icon-cache -t -f /usr/share/icons 1> /dev/null 2> /dev/null
#    rm -f /usr/share/icons/icon-theme.cache
#  fi
#fi
## Update all the shared library links:
## Can do this manually after installing new libraries
#if [ -x /sbin/ldconfig ]; then
#  echo "Updating shared library links:  /sbin/ldconfig"
#  /sbin/ldconfig
#fi

Then there's another stack of services that I start running in the background by adding ampersands:

# Start networking daemons:
if [ -x /etc/rc.d/rc.inet2 ]; then
  . /etc/rc.d/rc.inet2 &
fi
# Start the Network Time Protocol daemon:
if [ -x /etc/rc.d/rc.ntpd ]; then
  sh /etc/rc.d/rc.ntpd start &
fi
# SCIM and other GTK+ input methods like this file kept updated:
if [ -x /usr/bin/gtk-query-immodules-2.0 ]; then
  echo "Updating gtk.immodules:  gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules"
  /usr/bin/gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules 2> /dev/null &
fi
# Start the print spooling system.  This will usually be LPRng (lpd) or CUPS.
if [ -x /etc/rc.d/rc.cups ]; then
  # Start CUPS:
  /etc/rc.d/rc.cups start &
elif [ -x /etc/rc.d/rc.lprng ]; then
  # Start LPRng (lpd):
  . /etc/rc.d/rc.lprng start &
fi
# Start netatalk. (a file/print server for Macs using Appletalk)
if [ -x /etc/rc.d/rc.atalk ]; then
  /etc/rc.d/rc.atalk &
fi
# Start the sendmail daemon:
if [ -x /etc/rc.d/rc.sendmail ]; then
  . /etc/rc.d/rc.sendmail start &
fi
# Load ALSA (sound) defaults:
if [ -x /etc/rc.d/rc.alsa ]; then
  . /etc/rc.d/rc.alsa &
fi

/etc/rc.d/rc.inet1

Finally I recommend decreasing the DHCP timeout used in rc.inet1; the default is 30 seconds (it used to be 60), I decreased mine further down to 15 seconds:

# 30 seconds should be a reasonable default DHCP timeout.  60 was too much.  :-)
echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -d -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS} ${1}" | $LOGGER
/sbin/dhcpcd -d -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS} ${1}

The Results

Boot time from Lilo to login prompt was approximately one minute thirty before I performed these changes, and that decreased to twenty-five seconds. Once you include the time from first power on till Lilo it comes to about 35-40 seconds boot time, plus another five seconds to login and start X. The biggest speed increase seems to be from using compact in Lilo and the custom kernel.

References

There where a couple other resources on the Internet that got me started on this, and pointed out several of the ideas that I used: The section on boot speed in the Slackware tips article on f'(x) and an alt.os.linux.slackware thread on boot time.

Categories: Computers, Howto, Linux
Date: 2009-02-14 23:03:54, 15 years and 46 days ago

Leave reply

No html allowed in reply

Notify me of follow-up comments via email.