Difference between revisions of "Improve boot performance"

From ArchWiki
Jump to: navigation, search
(/boot/grub/menu.lst: updated kernel boot line for linux 3 kernel))
m (/etc/rc.conf: rw)
Line 63: Line 63:
 
  DAEMONS=(alsa network gdm)
 
  DAEMONS=(alsa network gdm)
  
Then move your Login manager (in this case 'gdm') to front, and background all DAEMONS.
+
Next, move your Login manager (in this case 'gdm') to the front, and background all DAEMONS.
 
  DAEMONS=(@gdm @alsa @network)
 
  DAEMONS=(@gdm @alsa @network)
  

Revision as of 02:42, 21 October 2011

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Summary help replacing me
This article attempts to aggregate methods on how to improve the boot performance of a system.

Preface

Improving the boot performance of a system can provide reduced boot wait times and a means to learn more about how certain system files and scripts interact with one another. This article attempts to aggregate methods on how to improve the boot performance of a system.

Modifying boot files

/etc/inittab

Asynchronous startup

Note: Using this means there are no guarantees that daemons are all started before X. This can cause problems if your setup expects dbus to be running (ck-launch-session, gnome, kde, etc.).

The initscripts can be started asynchronously instead of running in a strict order.

# use once instead of wait
rc::sysinit:/etc/rc.sysinit
rs:S1:wait:/etc/rc.single
rm:2345:once:/etc/rc.multi
rh:06:once:/etc/rc.shutdown
su:S:once:/sbin/sulogin -p

TTY terminal management

agetty is Arch Linux's default terminal manager. By default it will generate six terminals, which can be access by typing Template:Codeline. To increase performance you can comment out unused terminals. It is important to not comment the first two terminals (i.e. Template:Codeline and Template:Codeline). Template:File

Additionally, consider using a lighter terminal manager such as Template:Package Official, which consists of the minimal tty manager, Template:Package AUR, that has been stripped of printfs and compiled against Template:Package Official.

Note: fgetty currently doesn't support sha512 password hashing by default; a patched fgetty-pamAUR is available in the AUR. (see SHA password hashes)
# pacman -S fgetty

Then replace Template:Codeline with Template:Codeline on the following lines: Template:File

/boot/grub/menu.lst

This file lets you modify the kernel command line at boot. A couple ways to speed up boot time using this file to modify the kernel commandline is to remove framebuffer entries, and set the kernel loglevel to a low level of logging with quiet. For more kernel parameters and Template:Filename examples check out the page on GRUB. Remove existing Template:Codeline framebuffer resolution entries and logo.nologo, parameters to the desired kernel:

kernel /vmlinuz-linux root=/dev/disk/by-uuid/UUID ro logo.nologo quiet

/etc/mkinitcpio.conf

Delete the HOOKS you do not need, and consider using just base (sometimes udev is needed too) along with the MODULES you need for your root device (and keyboard, instead of usbinput).

Read more in the mkinitcpio article.

/etc/rc.conf

In the network section, make sure you only load the network interface you need. Manually configuring your network is also faster than using dhcp. Then find and remove all DAEMONS you do not need.

DAEMONS=(alsa network gdm)

Next, move your Login manager (in this case 'gdm') to the front, and background all DAEMONS.

DAEMONS=(@gdm @alsa @network)

Another thing you could do about daemons is finding the best, or rather, "sweetest" arrangement.

DAEMONS=(syslog-ng @acpid arptables iptables network pdnsd @alsa @dbus @mpd @crond @sensors @ntpd @dropboxd)

You should try to background as many DAEMONS as possible, making sure to start dependent DAEMONS after what they require (in the above example, pdnsd depends on network, ntpd and dropboxd depend on pdnsd and network, because 127.0.0.1 is the dns server). You can still background daemons that are required by other things (dbus is required by the Xorg), but they need enough time to start (it can take some experimentation to get it all to work well).

/etc/rc.sysinit

This script is responsible for the majority of output you see during boot, meaning this is a system-critical configuration file which looks up other files like rc.conf and loads modules, sets up mounts, handles errors, and basically tries to be your best friend.

There are certain lines here which you may not need. Removing or commenting them out may save you a few seconds at most. Do this at your own risk. For example, if you do not have RAID, LVM or encryption, then you would not need any lines concerning that.

It's also possible to add some ampersands (&) to make it more asynchronous, but be careful - lots of things are expected to be finished during later parts of the script.

Compiling a Custom Kernel

To decrease boot time, a stripped kernel is a must. Read more about compiling a kernel.

Additional Resources