Optimize startup for faster boot times

Few operating systems seem to boot quickly enough, and unfortunately Ubuntu is amongst them. However, there are four things you can do to reduce delays and generally speed-up startup:

• Reduce or eliminate the boot menu countdown;

• Make boot runtime scripts start in parallel;

• Build a read-ahead profile personalized to your PC;

• Reduce the number of GNOME startup programs.

Reducing the boot menu delay

If you dual-boot Ubuntu and Windows on your computer the boot menu appears for 10 seconds, during which you can select either Windows or Ubuntu. If you only have Ubuntu installed, a prompt appears for three seconds telling you that you can hit a key to see the boot menu.

This delay can feasibly be reduced to one second, providing you have quick enough reactions—hitting a key during that second will cause the countdown timer to stop so you can make your choice at leisure.

Alternatively, you can configure the system so the boot menu never appears. This will deny access to the other boot menu options but if Ubuntu is the only operating system on your computer then this could be a good arrangement.

Start by opening the boot menu configuration file in Gedit: $ gksu gedit /boot/grub/menu.lst

Then search for the line that reads timeout 10 and change the 10 to read either 1 , for a one second countdown, or 0, to disable the boot menu completely. See Figure 3.1, on the following page for an example from my test pC.

Save the file and then reboot to test the settings. Run boot-time scripts in parallel

Whenever Ubuntu boots it runs several scripts that start necessary background services. By default these are set to run one-by-one but if you have a processor with more than one core, such as Intel's CoreDuo series or AMD's Athlon X2, you can configure Ubuntu to run the scripts in parallel. This way all the cores are utilized and quite a bit of time can be saved at each boot.

To make the change, type the following to open the necessary configuration file in Gedit:

$ gksu gedit /etc/init.d/rc

¡niB

iJiiiiur/yriJiu - y=>tJ):

LsjijaJL

File

Edit View

Search

Tools Documents Help

C6

t£j „

B

H %

New

Open

Save

Print... Undo Cut Copy

Find Replace

# is the entry saved with the command 1savedefault1.

# WARNING: If you are using dmraid do not use 1savedefault1 or your

# array will desync and will not let you boot your system, default 0

# is the entry saved with the command 1savedefault1.

# WARNING: If you are using dmraid do not use 1savedefault1 or your

# array will desync and will not let you boot your system, default 0

## timeout sec

# Set a timeout, in SEC seconds, before automatically booting the default entry

# [normally the first entry defined), timeout 1

## hiddenmenu

# Hides the menu by default (press ESC to see the menu) #hiddenmenu

# Pretty colours

#color cyan/blue white/blue

# If used in the first section of a menu file, disable all interactive editing

Figure 3.1: Changing the boot menu countdown (see Tip 8, on page 66)

Look for the line that reads CONCURRENCY=none and change it so it reads CONCURRENCY=shell. Then save the file and reboot your computer.

Using this method I managed to shave a massive 20 seconds off my desktop PC's usual start-up time of just under a minute.

Build a readahead profile personalized to your computer

Ubuntu includes a software called readahead that, according to the official blurb, "allows the user to specify a set of files to be read into the page cache to accelerate first time loading of programs". In other words, it allows Ubuntu to cache frequently accessed files to avoid searching around for them at startup. A default readahead profile is included with Ubuntu but you can create your own, tailored to your system.

Reboot Ubuntu and, at the boot menu, ensure the usual Ubuntu entry is highlighted. Then hit [e). This will let you temporarily edit the boot

[ Minirial BflSH-like line editing is supported. For the first word, TAB lists possible coMMaiid comp let i oils. Anywhere else TAB lists the possible coMpletions of a deuice/f i lenarie. ESC at any tiMe exits. ]

<8-262a-4250-9f90-3b6a93627875 ro quiet splash profile_

Figure 3.2: Resetting Ubuntu's readahead profile (see Tip 8, on page 66)

menu entry. Use the cursor keys to move the highlight down to the second line that beings kernel and hit Q again. Use the right arrow key to move to the end of the line and, after the words quiet and splash, add the word profile. See Figure 3.2 for an example taken from my test PC. Then hit [Enter] and then (b to boot your computer. Note that the first boot will be slow because the readahead cache will have to be rebuilt. In subsequent boots, however, you should see speed improvements.

I experienced a couple of seconds improvement by building a new readahead profile. This isn't a dramatic increase but it was certainly worth doing.

Trimming the GNOME startup programs

Once you've logged into the GNOME desktop, you'll face yet another delay as all the GNOME background software starts. A few seconds can be saved by trimming this list and that can be done using the GNOME Sessions program (System ^ Preferences ^ Sessions). Ensure the Startup Programs tab is selected and then look through the list for items you might want to prune. For example, if you're never going to use Evolution's alarm function then Evolution Alarm Notifier can be disabled by removing the check alongside it. One word of warning: Volume Manager isn't related to audio. Instead it enables the automatic detec tion of external storage devices that are attached to your computer. As such it should always be enabled. Nor should you disable Network Manager—this is necessary to get Ubuntu online if you're using wifi. (If you absolutely have to disable it, follow the instructions in Tip 43, on page 103, which explains how to configure Ubuntu's network component using the older Network Settings tool.)

For another optimization hack, see Tip 293, on page 340, and, if you're using Wubi to run Ubuntu, Tip 19, on page 77.

Was this article helpful?

0 0

Post a comment