Processors optimize

10 ways to make Linux boot faster

On those infrequent occasions when you need to reboot Linux, you may find that the process takes longer than you'd like. Jack Wallen shares a number of tricks you can use to reduce boot times.

On those infrequent occasions when you need to reboot Linux, you may find that the process takes longer than you'd like. Jack Wallen shares a number of tricks you can use to reduce boot times.


Linux rarely needs to be rebooted. But when it does, it's often slow to boot. Fortunately, there are ways to speed things up. Some of these methods are not terribly difficult. (although some, unfortunately, are). Let's take a look.

Note: This information is also available as a PDF download.

#1: Disable unnecessary services

Depending upon the use of the machine, plenty of services won't be needed. Using Linux just for a desktop? Then you won't need sendmail, httpd, and many other services. If your server is only a Web server, you can shut off many services as well. To do this, you can go to the Administration menu and take a look at the Services entry. Just deselect all of the services you don't want to start.

#2: Disable unnecessary kernel modules

If your desktop is wired to the Ethernet, you don't need to have a wireless kernel module loaded. This task is a bit more difficult and will require a kernel recompilation, which is not the easiest task to undertake. To do this, you will need the kernel sources. Then, follow the standard steps for compiling a kernel. The difference is that you're going to go through your system and disable all of the modules you don't need.

The best way to find out what kernel modules currently install and run on your system is to install Bootchart. Not only will this give you a good list of modules, it will illustrate for you what is happening during your system boot. You can also issue the command chkconfig --list | grep 3:on to find out what services are running. Once you know what loading modules you don't need, you can remove them during a kernel recompilation. While you're at it, compile the kernel to exactly match your architecture.

#3: Use a lightweight window manager instead of GNOME or KDE

I plug smaller footprint window managers for a reason -- they drastically reduce graphical boot time. Instead of having to wait that extra 30 to 60 seconds for GNOME or KDE to boot up, why not wait two to 10 seconds for Enlightenment or XFCE to boot up? Not only will they save you boot time, they will save your memory and the headache of dealing with bloatware.

#4: Use a text-based login instead of a graphical login

Most of my Linux machines boot to run level 3 instead of run level 5. This will halt at the text-based login, where I only have to log in and issue startx to start my desktop of choice. The graphical logins do two things: increase load times and create headaches trying to recover from an X windows fubar.

#5: Use a lighter-weight distribution

Instead of loading the heavyweight Fedora, why not try a Gentoo, Arch, or Puppy Linux? The boot times for these smaller distributions are far faster than the more bloated Fedora (and even Ubuntu). Of the larger distributions, OpenSuSE claims to boot the fastest, but I have not personally tested this. Between the latest Fedora and Ubuntu, Ubuntu blows Fedora's boot times away (and that is out of the box).

#6: Use an OpenBIOS

If you're savvy enough to upgrade your PC's firmware, you might consider migrating to an open source BIOS. One caveat to using open firmware is that it allows Linux to actually initialize the hardware as it boots (instead of relying on the BIOS). On top of that, many open BIOSes can be configured to meet your machine's specific needs. If you don't go the open BIOS route, you can at least configure your BIOS to not search for a floppy drive that's not there or to boot directly to the first hard drive (instead of the CD drive first).

#7: Avoid dhcp

If you are working on a home network (or a small business network) where address lease isn't a problem, go with static IP addresses. This will keep your machine from having to call out to a dhcp server to get an IP address. If you take this approach, make sure you configure your /etc/resolve.conf to reflect your DNS server addresses as well.

#8: If you can spare it, get rid of hotplug

Hotplug is the system that allows you to plug in new devices and use them immediately. If you know your server won't need this system, delete it. This will cut down on boot time. On many systems, hotplugging consumes much of the boot time. Removing hotplug will vary depending upon the distribution you use. NOTE: udev has, for the most part, replaced hotplug. But if you're running an older distribution, this does apply.

#9: If you are REALLY daring, you could give initng a try

The initng system serves as a replacement for the sysvinit system and promises to drastically decrease boot times in UNIX-like operating systems. If you would like to see the initng system in action, you can give the Pingwinek livecd a try.

#10: Use a hack with Debian

If you're using Debian, there is a simple hack you can use to switch your startup scripts to run in parallel. If you look at the /etc/init.d/rc script, you will see: CONCURRENCY=none around line 24. Change this line to CONCURRENCY=shell and you should see a reduction in boot times.

That's about it. Of course there are always more and better hacks out there. But the above should mostly cover everything. The good news is that you're most likely already running Linux, so the burden of boot times is generally eased by the infrequency of reboots.

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

15 comments
dsad
dsad

you are, at best, an ignorant. your knowledge of computer or linux systems is many orders of magnitudo worst of my very very very poor english. #1: yes, true. #2: what about using `lsmod` or `modprobe` to list your fscking kernel modules. What's that shit you're speaking about called Bootwhatever? And finally chkconfig is present only on a small set of distributions and display/set services that starts at boot not modules. blah i'm now going to bed, don't have time to go on.

stupid
stupid

@3 Does it really take you 30-60 seconds to boot into GNOME or KDE? Are you serious? Did you just make that up for fun? I'm running the latest Ubutun (Hardy Heron) and I boot straight to a fully functional GNOME desktop with Compiz & AWN in ~30 seconds from power-on. I run KDE on my laptop and it doesn't take more than about the same time (minus Compiz). @4 I do not see the point of this since I've tried it. It gets really tiring to login & type startx. On my laptop I have KDM automatically log me in & turn on the screensaver with password lock, then all I have to do is enter my password to get straight to a ready desktop.

candraadiputra
candraadiputra

I thinks this article is too complicated. recompile the kernel?, remove module, or use openBIOS. just only geek would use this way. But wait.. who is audience for this article? developer, ADmin or user?

Doug Vitale
Doug Vitale

I used Linux Mint, a derivative of Ubuntu which is a derivative of Debian. I set the option to CONCURRENCY=shell and after that I noticed two undesirable changes. First, Linux Mint would no longer recognize my NIC. Second, when I would go to exit the system, it would only give me 3 choices - logout, restart, shutdown. Normally I have 5 choices - the aforementioned three and Standy and Hibernate. When I set the parameter back to CONCURRENCY=none, these two problems disappeared.

daniel
daniel

All good with this article, but most people want to see the before and after times to believe it makes a huge difference.... Show us something! For example, item 5, 6 and usually 7 are not going to give ou a shole lot of benefits in most cases! Cheers, Daniel http://www.nexl.dk/daniel

sephiroth230
sephiroth230

A quick bit of advice: disable rhdb from Fedora and Redhat distros, its an extra 5 seconds. I call BS about the distro comment. Fedora boots a lot faster than gentoo every time I've run them head to head. The Fedora guys spend a lot of time working on quick boottimes, can't say the same about Ubuntu though. Arch is the quickest. My boottime benchmarks are here http://www.geocities.com/sephiroth230/ 23sec Arch, 37sec Fedora4, 38 sec Gentoo, 47sec Slackware,55sec Ubuntu. Yes, and thats with all those default Fedora services starting.

d.subhas
d.subhas

Hi, I appreciate most of your points which are valid. But one universal hack is to get a "faster" file system and disabling access times. installing reiserfs would make a big difference! and if you're using one file system - stick to it for all of your partitions. Subhash http://www.indispice.com

rssenyonjo
rssenyonjo

NOW I'VE LEARNT HOW TO IMPROVE MY LINUX BOX PERFORMANCE.ATHANKS

tmb_ayebe
tmb_ayebe

I disabled gdm following your advice but I don't think it's a good idea. I am running Ubuntu 8.04 on an EeePC. Starting X from the command line looks ugly: You get this old school checkerboard screen and lots of flickering as it changes screen modes. Once the desktop was loaded I got two error messages. I can't remember what the first one was, the second one was telling me that the fast user switcher has failed to load. I was left with the impression that gdm is more integrated with gnome than you give it credit for.

CharlieSpencer
CharlieSpencer

You write English well. You talk about Linux badly. Go to bed and come back when you can talk without insults.

wratholix
wratholix

I usually dont reboot much and my box will run for months until i decide to reboot it. So what is the point in slicing seconds of the boot time as it is not a major issue, rather worry about runniing my OS rock solid in high performance. I admit back in the day I was a big fan of tweaking my machine when i had win95, i knew all the registry tweaks off by heart. Hence this called for alot of reinstalls and weak stability. A full boot into gui under 60seconds is really good time to for the average user. My old p1-133/32mb ran slakware well and now i have a reasonable Quadcore intel with SATA2 drives. There's nothing that will beat good hardware with a well configured operating system. So It all depends on your own requirements and ability to maintain your hardware/software configuration. Recompiling the kernel does have its advantages as loading drivers via modules has minimal performance impacts compared to build in. By all means if you are comfortable enough to do so, build everything about the core system in. Avoid usb drivers etc and stuff for removable hardware into the kernel and you are set.

tommy higbee
tommy higbee

Why would you need to recompile the kernel to keep from loading a kernel module? Just disable the module from loading, and you've accomplished the same thing without having to retrieve sources, configure, and compile.

speculatrix
speculatrix

whilst recompiling the kernel for your specific hardware can make it quicker, removing modules only saves disk space, it only loads drivers for existing hardware.. see manual page for "depmod" for information about how kernel knows what drivers to load. one thing I have noticed is that grub is much faster to load the kernel than lilo.