Slashdot Mirror


Booting Linux Faster

krony writes "IBM's DeveloperWorks explains how to decrease boot times for your Linux box. The concept is to load system services in parallel when possible. Most surprising to me is the use of 'make' to handle dependencies between services." The example system shown is able to cut its boot time in half, but the article stresses the effectiveness can vary widly from machine to machine.

28 of 625 comments (clear)

  1. Predicted response by Anonymous Coward · · Score: 5, Insightful

    "Who cares how long it takes to boot Linux? My uptime is 400 days!!!"

    Yup.. just keep talking about that and wonder why Linux never becomes mainstream.

    1. Re:Predicted response by homer_ca · · Score: 2, Insightful

      The whole reason behind the success of Linux has been the friendly and responsive user and developer community. You want to talk about arcane commands and a smug attitude about technical superiority, just look at the BSDs. Technically, they were way ahead of Linux for years since they had an existing stable codebase, and they're still developing lots of good features for servers, but the user friendliness has never advanced past Slackware.

    2. Re:Predicted response by Crispy+Critters · · Score: 5, Insightful
      "This is the current state of the Linux community."

      No it isn't. I am on a local LUG mailing list, and people are politely helping newbies all the time, going out of their way to explain things that weren't even asked, just in case it might help.

      "Not only the case on Slashdot, but go to any IRC help channel and you'll find the same the majority of the time."

      IRC and /. were not exactly designed for thoughtful interaction.

    3. Re:Predicted response by Trepalium · · Score: 5, Insightful
      In order for him to get a straight answer he had to pre-emptively insult himself "Guys, I know I'm entirely retarded, but does anyone know how to get mplayer to play X?"
      Uhm, so you think that just because someone insulted himself during the post means that everyone who might provide you with free technical support on Linux is a prick? Hate to break this to you, but that's hardly Linux's fault. Regardless of what you look for support on, you'll find idiots who want to give you snide comments like RTFM, or go do it yourself. My experience is that most people will try to help you provided you show that you made some effort to solve the problem yourself (such as state what you tried that didn't work).

      Lets assume that you call a vendor for support. You'd likely to have paid for the support, so the vendor will likely allow you to be somewhat abusive of their support personelle because the money you pay them is worth the inconvenience. Now, most of the support you get on newsgroups is by people not getting any income for answering your questions, so their tolerance to put up with crap is significantly decreased. If you even ask a question in such a way that makes you look like you might be one of the assholes they deal with in the support business, you will be dropped as quickly as possible. When you want something for nothing, being polite and courteous versus appearing to bark out demands is the difference between getting an answer, and getting "RTFM". BTW, this applies equally to proprietary software lists (unmanned by paid employees) as to free software lists. Lists and discussion groups with paid employees answering questions (such as microsoft.public.*) can be friendlier, but you get boilerplate responses more often, and the same answer three times over before someone finally gets that their solution doesn't work for your problem.

      --
      I used up all my sick days, so I'm calling in dead.
    4. Re:Predicted response by irc.goatse.cx+troll · · Score: 3, Insightful

      You're vulnerable to the ptrace exploit, among others.

      The key to reliability is not uptime but redunancy. I'd rather have an array of 10 servers with 20day uptimes each cycling their reboots than on server with a 200day uptime suffering from old vulnerabilities and other problems that come with age.

      --
      Pain lasts, kid. Its how you know you're alive. Sometimes I think this growing up thing is just pain management-TheMaxx
    5. Re:Predicted response by cygnusx · · Score: 3, Insightful

      > Learn to search www.google.com

      I agree, but the users who need help *the most* don't even know what to search for.

    6. Re:Predicted response by kelnos · · Score: 4, Insightful

      seriously... after reading through a bunch of these posts, i see soooo many "why do i care how long it takes to boot up? i just boot it and leave it for a year." a few are joking, but most are just ignorant idiots. sure, there are some of us (myself included) that don't turn off their machine (i probably would to save on the utilities bill, but i host websites for a few student orgs at my school, among other things). anyway, there are _plenty_ of people that could make a faster boot useful. laptop users, for one. people that only use their computers for a few short tasks a day, and turn it off. people that don't need to run it overnight for whatever reason, and actually like the idea of saving a little energy.

      get a little perspective, people. ignorance is so first millennium...

      --
      Xfce: Lighter than some, heavier than others. Just right.
  2. Another way to speed up booting Linux by Anonymous Coward · · Score: 2, Insightful

    Develop a better initialization sequence. Relying on a scripting language, such as bash, to initialize each system component slows down bootup time. Instead design a standard such that daemons can be stop/started/restarted with a standardized set of command line options.

    1. Re:Another way to speed up booting Linux by pudding7 · · Score: 5, Insightful

      Anyone ever wonder how we got ourselves into a situation where we spend so much time saving ourselves time?

    2. Re:Another way to speed up booting Linux by Anonymous Coward · · Score: 1, Insightful

      Which makes perfect sense, since an hour spent working on something that would save even 1 second will begin paying for itself if it is re-used 3600 times.

    3. Re:Another way to speed up booting Linux by shellbeach · · Score: 2, Insightful
      ... or simply don't run the services you don't need? Distros try to please all the people all of the time. That doesn't mean you need to run half the stuff that's provided.

      A very interesting experience for me was starting from scratch and only *including* the stuff I needed when playing around with a minimal linux distro (crux linux). You'd be amazed how much crud you don't need and how much faster the system boots ...

  3. Make? by JohnGrahamCumming · · Score: 5, Insightful

    Most surprising to me is the use of 'make' to handle dependencies between services."

    Really? That's an odd statement. How surprising that they choose to use an open-source software application that is designed to compactly represent dependencies for representing dependencies.

    Perhaps they should have drawn Visio diagrams instead!?

    John.

    1. Re:Make? by buttahead · · Score: 1, Insightful

      no... use make to append each rc script to a file. this file now has the order of start up scripts. to shut down, run make again, and reverse sort the file.

    2. Re:Make? by Jellybob · · Score: 3, Insightful

      I can understand the most blindingly obvious things being surprising.

      If you were to drop someone with no knowledge of electricity into a room with a switch, and they flicked that switch, they'd be surprised when the light comes on, despite it being "obvious".

      And that's because things are only obvious once you know them, right up until that point, they're just an unsolved problem.

    3. Re:Make? by Feztaa · · Score: 4, Insightful

      I think it's clever, because (possibly) nobody ever thought of doing it before. Make is a tool that makes it easy to compile programs, not for booting your system.

      I've heard that a program isn't truly successful until it's been used in a way unimagined by the original author. I guess make is now truly successful :)

    4. Re:Make? by Anonymous Coward · · Score: 2, Insightful
      For most make programms (certainly GNU make)

      network: sshd rpcd

      is equivalent to

      network: sshd
      network: rpcd

      with is very easy to create from

      sshd: network
      rpcd: network

  4. Re:Timely by Arker · · Score: 2, Insightful

    Why is it taking long to boot up? That's not my experience. Loading a lot of services?

    --
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Friends don't let friends enable ecmascript.
  5. Re:Hmm by 4of12 · · Score: 4, Insightful

    someone has a use for this

    You bet.

    How long are you willing to wait for your stereo receiver to boot up, your TV, or your TiVo?

    This is a really important issue for embedded devices like consumer electronics built on Linux.

    --
    "Provided by the management for your protection."
  6. Re:Faster Booting by taxtropel · · Score: 2, Insightful

    9 second boot time from power-up to X-windows

  7. Re:boot? by kcurtis · · Score: 5, Insightful

    > I rarely have to boot ever after the first boot and patch!

    Probably true. But one goal of linux is to become the predominant desktop/laptop OS.

    I work for a public school system. I'd rather not have all these computers eating up power all night when they're not being used.

    In most work environments, pc's get turned off over night, and sometimes even at lunch.

    This is one more way someone is helping to make Linux a better candidate for your casual end user.

  8. This is actually important by augustz · · Score: 4, Insightful

    I see there are already a ton of linux fanboys and girls posting about the incredible uptime of their linux boxes, and claiming that a) boot time doesn't matter because linux doesn't go down or b) linux boots very fast.

    They are wrong. Boot time matters.

    It matters for perception. Boot time is one of the periods where a user spends the most time looking at a screen not being able to do anything (even if that happens rarely). A faster boot time leads to a sense that the whole system is faster, because it is a first impression, and a significant impression. If linux bliped on from a cold start in 5 seconds, I'd be studies would show it appeared faster.

    Boot time matters because not everyone (in fact, very few people) leave their systems on all the time. Slashdot fan boys living at home may not agree, but they are wrong.

    Think about business systems. At my place of work, everyone turns their computer off at the end of the day, and on at the beginning of the next. My mother doesn't leave her computer running 24/7, she turns it OFF when she is done using it. My roomates do the same thing. Even I do it sometimes.

    Boot time matters because power management is still evolving under linux. As power management requires the cooperation of a number of pieces of a system, power management is still a work in progress. Once power management with every peripheral is flawless, then we can start to dial back boot time worries (only a little).

    Boot time matters server side too. I know folks are going to complain that I focus on the user too much. But boot time matters server side as well. We have UPS units on our servers. They have however a limited lifetime. So when the power drops for a few minutes (which it does here somewhat often) automatic shutdown process starts.

    When the power comes back on, people power up their computers. These being Windows XP machines they actually start pretty quickly (or never went off if on a UPS). If folks were in the middle of something, they expect that with the power their logon and other services will be back in action. Then all the individual computers start timing out / locking up, generating help calls.

    On the server side, if there was an emergency security patch, or we were coming up from a power outage, the faster the boot time the better, if I can beat out even 20% of the client connect attempts.

    Boot time matters, a big bravo to the folks working to improve this.

  9. why not start them all at once by TornSheetMetal · · Score: 3, Insightful

    Since you have to work out the dependices yourself, why not imbed the dependices in the startup scripts themselves? So for example, the nfs startup script would block until the network script got started. The status can be checked by parsing /etc/rc.d/init.d/network status. You may want a timeout on the blocking. If you do this you could just start all the scripts at once.

  10. Re:Hmm by MatthewB79 · · Score: 3, Insightful

    I think this will be useful only for desktops actually. Embedded devices do not usually run as many services as desktops. And the embedded Linux implementations seem to boot plenty fast as it is.
    For example, my Linksys WAP boots up in about 10 seconds.
    For a better embedded example, look at a Compaq iPAQ H3650 circa 3 years ago running Familiar Linux with the Opie desktop. It boots up in about 8 seconds. Then it's "instant" on/off unless you hard reset the device. It's also running more services than the default install.

  11. Re:Dual (or more) cpus by vadim_t · · Score: 3, Insightful

    I've got a dual Athlon 2000+. The boot time improvement is next to inexistent. Overall it boots slower, due to the initial delay (about half a minute) to initialize ECC RAM, and the second or two Linux needs to initialize SMP.

    Now, it's definitely a really big improvement over a 1 CPU system.

    It's really smooth, and I can:

    Burn CDs at 24x and play Quake 3

    Compile programs using both CPUs and play videos at the same time.

    Kill high priority programs (like sound daemons) that went mad for some reason and got into an infinite loop. This happened me with KDE a few months ago. With 1 CPU my computer froze for minutes until it could react to my request to kill the daemon. With SMP, no problem, I still have an idle CPU.

    It's really nice for Gentoo. KDE compiles in several hours, and my computer isn't slowed down noticeably by the compilation. The basic Gentoo installation is done in a day, I can get all the necessary programs compiled during the second day.

    The hardware is really stable too. Never locks up, never crashes. ECC RAM gives great peace of mind, too.

  12. power down? Grid!! by LinuxHam · · Score: 2, Insightful

    And if you stick around long enough at DeveloperWorks, you'll make a grid out of those PCs and offer the district more compute power than they ever realized they had.

    --
    Intelligent Life on Earth
  13. Re:Parallel startup implemented in Mac OS X by klui · · Score: 2, Insightful

    You beat me to it. OS X also implements dynamic disk mounts even for root. Disks are mounted and assigned to a device on a first-come first-served basis.

  14. Re:boot? by dakryx · · Score: 2, Insightful

    Some people like to conserve energy when possible. Just do it! It's good for the environment!

  15. Right but Wrong; be careful. by qortra · · Score: 2, Insightful

    Ok, I agree that boot time is important in many specific cases. However, you say

    I see... fanbody and girls... claiming that... b) linux boots very fast. They are wrong.

    This seems to be the prevailing wisdom here, so this is for everybody. I just have to disagree. A standard GNU/Linux distro (like Mandrake, for instance) will startup a buttload of services (depending on what you select at install time), and do far more than a standard Windows install (for instance). It will in fact run at startup every service that you've told it to install (again depending on if you tell it to, but I believe it will do this by default). Often this includes one or more databases (postgres, mysql), a web server (apache), perhaps a few file sharing services (samba, nfs, ftp), a few remote command services (ssh, telnet), and its usual collage of helpful newbie services (autodetect hardware, boot numlock, etc). Now, with all of this crap running on my antique P Pro 200-64mb, I boot in less than a minute from lilo to login prompt (and X is about 5 seconds more). I think XP home would barely beat that time on a system that old, and it can't serve things. And yes, faster systems scale nicely; my Debian system is extremely fast lilo->kdm; as good as my XP pro in fact, and it still has all the server trimmings.

    Now, on the other hand (for a fair comparison), if you've ever experienced a windows 2000 server machine with active directory, you know real pain. From boot.ini to load of video drivers is fast, but after that, restoring network connections can take as long as five minutes even on a fast system.

    So in conclusion, a default install of any random distro may or may not be slower starting up than another OS (read Windows), but just make sure you're making a fair comparison. If look through your /etc/rc3.d and find a whole bunch of services whose names you don't know, just remember that they might actually extend functionality beyond what you could get with another OS. If you ever truly do make your installation sleek and tiny, then give it another test and see what you find.