Reducing Boot Time On a General Linux Distro
Linzer writes "In this blog entry, Fred Crozat (head of Mandriva's engineering team in France) explains in great detail how his team has been detecting and getting rid of bottlenecks in the boot process, from the early stages to loading the desktop environment, thus decreasing overall boot time. An informative tour of the nuts and bolts of the boot process and how they can be tinkered with: initrd, initscripts, udev, modprobe calls. The basic tool they use for performance analysis is bootchart, which produces a map of process information and resource utilization during boot. The final trick: preloading desktop environment files while waiting for the user to type her password."
I can see optimizing this for the sake of the geeky goodness of it and all that but, really, how often does someone reboot a Linux box, that this even enters into it? Maybe I'm unusual but mine usually stay up until there's a new version of my distro of choice to upgrade to. Time to boot just doesn't impact me very much.
The final trick: preloading desktop environment files while waiting for the user to type her password.
A female Linux user?!? You can compile and install Gentoo while waiting for that to happen. : p
This guy's the limit!
I see what they're getting at but not how to achieve similar gains. Anybody out there feel like putting together a slightly more practical guide?
...so now I need a sex change to run Linux. Sheesh!
I am sure both Mandriva users will be very happy.
The final trick: preloading desktop environment files while waiting for the user to type her password."
Has it gotten so bad that we are unable to use proper English in case we upset someone?
It *SHOULD* read:
The final trick: preloading desktop environment files while waiting for the user to type their password."
Support NYCountryLawyer RIAA vs People
Well, it helps if it's installed on a laptop or on old hardware.
Also it goes to quicker recovery time in case of outages. Coming from the Solaris world before they had journaling UFS filesystem it could take hours to FSCK a large partition before the OS would come up. On a production system that is a big deal.
Hm... prefetch, anyone?
On my systems, it's the BIOS that takes a very large chunk of the overall boot time. As far as it goes, I think the Core2 machine takes about the same amount of time to start loading the OS as the old 486 used to.
Having an x86_64 architecture is nice, but why oh why are we still lumbered with that legacy piece of you-know-what? I think I want a Mac Mini now, just because of that...!
-- Steve
Thanks for playing, but you're wrong:
Each student is singular -- the is instead of are proves it -- so the colloquial their (a plural) doesn't agree with the verb, and is frowned on by traditionalists. It's common enough in speech -- "A friend of mine called me." "What did they say?" -- but, although many writers have used it (see examples from Jane Austen), it often sets off alarm bells among the fussier readers of formal writing today.
The correct answer is "there is no answer". There's plenty of "right" ways that have either fallen out of favor (such as using "type one's password"), or that get repetitive and annoying ("type his' or her's password")
I suggest brushing up on your Grammar Youth Movement handbook at http://andromeda.rutgers.edu/~jlynch/Writing/s.html#sexist
UTF-8: There and Back Again
My problem is not the linux distro coming up to a login prompt, but the server getting past all the cards prompts to get to the normal boot. What with scsi controller cards having their own bios, the system bios, and miscellaneous others, it can take longer to get past the post then to boot linux. The HP DL360 G5's we have can take almost 30 seconds just to starting booting the linux kernel.
My password is just the letter 'a'. Like in 'apple'. No luck for me then.
Why not simply use sleep or hibernation (bind i to the power button)? All modern hardware/OSes support it. No need to load all drivers and background apps every single time. Actually hibernation saves time and energy due to shorter boot times.
Just be sure not to use crappy software/hardware that doesn't support it.
And when you gaze long enough into the code, the code will also gaze into you.
Just be sure not to use crappy software/hardware that doesn't support [sleep].
And pay multiple times over for return shipping when I find that one or more components of my computer don't come out of sleep properly. Or do you know of a good whitelist of makes and models of commodity PC hardware that have the fewest defects in their ACPI implementation?
NICE try "Steve" or is it "Mr. Jobs"? Attempting to infiltrate our "Linux discussion" with your MAC hype!!
Has no one here heard of hibernate or sleep?
It appears Acer's testers haven't. My cousin tells me his Acer Aspire One subnotebook running Windows XP Home comes out of sleep with some hardware not properly awake.
I have a linux laptop that I tote with me. I generally like to power-down when moving place-to-place to reduce HD damage if I jostle it too much.
Why not just get hibernate to work well and do that?
There is a lot of CPU chewed in the booting process and you can only do so much to speed it up.
Comment removed based on user account deletion
Amazon EC2 images (et alia) would find this useful.
They will come online faster.
[% slash_sig_val.text %]
After post, I have my Archlinux based laptop booting in 11-14sec consistently. I have added a daemon or two since this bootchart, but until then I was at 12 seconds every boot. Now it's still only 14sec. I don't see how these guys call their bootcharts fast. Their athlon xp 3400 system (closest to my 3200 x2) booting in 22 secs is supposed to be fast.
If they are preloading desktop environment files, while waiting for the user to type in a password, that can allow people to guess usernames!
Back in the days of yore, you could tell if you typed in a valid username by how long it took to validate the login attempt. A valid user with invalid password was reported immediately; an invalid user took longer. This was changed to always take a constant time, to prevent username guessing attacks.
With preloading desktop environment files, if a user is sitting at the machine, they could type in a username, and listen for disk activity. No activity? Try a different username!
And yes, I know, if the machine is not in a secure location, it isn't secure. But the preload behaviour for valid usernames may open up other attack vectors. For example, if the user environment files are on NFS, a flurry of network activity may signal a correctly guessed username.
You know, some of us try to lower our CO2 footprint by not using power needlessly.
This article is a lame dupe and an attempt at stealing some of the thunder of the work done by Arjan and Auke as presented at the Linux Plumbers Conf almost two weeks ago:
http://www.linuxplumbersconf.org/program/speakers/getspeaker.php?speaker=avandeven.txt
From LWN (article becomes free tomorrow): "At the Linux Plumbers Conference Thursday, Arjan van de Ven, Linux developer at Intel and author of PowerTOP, and Auke Kok, another Linux developer at Intel's Open Source Technology Center, demonstrated a Linux system booting in five seconds. The hardware was an Asus EEE PC, which has solid-state storage, and the two developers beat the five second mark with two software loads: one modified Fedora and one modified Moblin. They had to hold up the EEE PC for the audience, since the time required to finish booting was less than the time needed for the projector to sync."
Sure, it's good that some distros threaten to get their heads out of the asses regarding boot time, this guy is just referencing other peoples work and is following not leading.
Come on, how come the third paragraph is an attempt at getting the reader to believe they've been working for years on speeding up boot... if they've done that much work, everyone would be running mandriva...
If they've been doing it for years, then fail.
Arjan and Auke got down to five seconds between submission for LPC and LPC, how long is that Mandriva dude?
If the best idea for desktop boot speedup is preload during gdm idle, fail.
Translation: Wait to be able to read the LWN article on Arjan and Auke's talk at LPC this year and hope that other distros start accepting the idea that making 99% wait for things needed by 1% is a bad idea.
I shut my laptop down when I'm not going to use it for a while, instead of putting it into suspend. On battery less boot time means more time to actually use the machine, so I'm interested.
On the other hand, my battery should probably be replaced as I can only get about an hour out of it on a single charge.
Saying "I'll probably get modded down for this" in a post is the best way to get it modded up.
What's a "her" ?
On Linux usb ports can be powered down to save power. However it turns out that many USB devices are broken and can't cope with being powered down. Now the question comes up what version of Linux are you using? If it's something older than 6 months then there's a good chance this has been fixed (the list of things allowed to be powered down has gone from a blacklist to a whitelist of large categories). See this commit talking about the kernel no longer powering anything down bar USB hubs for some more details.
A very short term band aid might be to disable usb autosuspend on that device via /sys/.
I don't suspend to disk because it usually sucks... NetworkManager fails, wireless complains... And somehow some videos causes X to crash beyond what restart of X fixes... Probably a really bad graphics driver... Or maybe I haven't configured it to reload the graphics driver correctly. I did that using config files in earlier versions to enable compiz after wakeup..
When I used SuSE 10.0 (Which I dumbed when their package manager broke ever more) suspend to disk worked just fine... Now I run Ubuntu and I know I ought to run something less buggy..
But suspend to ram and disk isn't the most stable feature... Sometimes it just really sucks... Nevertheless it's actually one of the most important features.
If you want to let the BIOS "know" you can use the platform option in /sys/power/disk. If this is broken you can use shutdown instead. I believe the former effectively uses S4 and may have beneficial results (e.g. faster startup when powering back on, power light pulsing while hibernating/restarting) if it isn't broken.
You can see a video of Arjan's EeePC 901 5 second boot on youtube. It's not the 3 seconds you're asking for but it's still somewhat fast right?
While servers still seem to take hours to get past their BIOSes, modern laptops often have options for skipping the POST and generally taking shortcuts enumerating devices. The EeePC has a "BootBooster" option where it caches BIOSes results to solid state disk so the BIOS finishes in less than a second (rather than 4 or 5). It is so fast it can be a pain when you actually DO want to change a BIOS option!
...and wants to do something malicious then I'd worry about something other than not having to guess a correct username. Unless you're using full disk and virtual memory encryption why wouldn't they just boot off a CD/USB key (or possibly take your disk out and put it in another machine)?
If you read the summary, one culprit is modprobe - for each kernel module loaded at boot time, it scans several hundred Kb of config files.
I have patches to fix this behaviour of modprobe, which can shave several seconds off boot-time. I submitted them months ago but I think so far the sole maintainer has been too busy.
Anyone interested, poke me and maybe I'll have another go... .
The final trick: preloading desktop environment files while waiting for the user to type her password.
I once heard someone say that only girls use Fedora, but until now I always figured it was just some kind of snide remark.
/dev/sda1 has not been checked in 60 days. Check forced ... ... /dev/sda1 clean
That's right, in 2008 the EXT3 filesystem still needs to be offline for a read-only consistency check.
Unfortunately even with journals one still needs regular fs checks so we can't just tune2fs -i our volumes to make the problem go away.
"Nine times out of ten, starting a fire is not the best way to solve the problem." - my wife
Combine these efforts with IBM's recommended use of Make for startup dependencies, and Fedora's One Second X project and we should have some marked improvements in boot time.
"Nine times out of ten, starting a fire is not the best way to solve the problem." - my wife
Here's a poweropint presentation about this work. If you're an LWN subscriber you can you read an article and comments about the 5 second boot presentation at the Linux Plumbers Conference (it will become viewable by all on from the 2nd October 2008). Finally you might be able to test drive some of this work if you are willing to sacrifice a USB key and destroy your existing EeePC install by because Moblin may include this work.
I've always wondered, why does it take so ridiculously long to reboot a computer? The basic problem seems to be that you want to send every program on the computer a signal to quit (sighup or sigterm or something like that), and those processes then each begin doing things like writing data to disk, closing file descriptors, running destructors to 'properly free' allocated memory, etc.
Now, here's the thing - yes, programs need 'cleanup' for a reboot, but I think simply writing data to disk and closing files would be much faster than completely shutting down programs, and doing all the *unnecessary* memory cleanup that implies. Yes, filesystems need to be flushed/unmounted, but I think that probably 80 percent of the stuff that happens during a typical computer shutdown or reboot is just unnecessary, particularly doing things like running destructors on complex data structures (like the 800 megs of model, texture, animation, particle effect, sound, and state [e.g. character inventory, stats, etc] data that a game might have loaded in memory, for example). Seems like all you need to do for a shutdown or reboot is send a signal to programs to write data and close files, then when that is finished, umount filesystems, then send the appropriate instructions or interrupts to the CPU to trigger the shutdown/reboot. Who cares if programs don't free() their memory or properly terminate if you are rebooting or shutting down?
Chicken and egg: as long as it's so slow, people are going to go to great lengths to avoid doing it. (Like, say, leaving it up until a new version arrives. Do you leave your lamps on all night long, but covered, in case you want to use them quickly?)
The biggest reason to keep your computer running 24/7 is to allow it to be instantly usable. Most people aren't actually making use of those CPU cycles when they're asleep. Computers use power, and make noise.
This is one of those cases where a big enough quantitative change brings about a qualitative change. Bringing boot time from 240 seconds to 230 seconds is geeky goodness. Bringing boot time down to under 5 seconds brings about a change in how people use their computers.
The article is about Mandriva linux, don't you guys feel the difference?.. Gentoo users should read http://gentoo-wiki.com/TIP_Speed_up_your_boot_time and http://jolexa.wordpress.com/2008/09/22/gentoo-improve-boot-time/
I've been known to butcher the init scripts, there is a TON of stuff in there that doesn't need to be there. (I'm from the slackware days when tampering with init was a fairly normal way to configure a system)
Also once did linux from scratch, and wrote my own init subsystem from scratch. It's amazing how fast linux can be made to boot when you rip out stiff that doesn't strictly need to be there.
The whole initialization subsystem is one of the things I really dislike about almost every linux (and freebsd) distribution I've ever seen. WAY too much junk in there.
You should be able to trace from init down to login: withing about 3 minutes, by just reading the scripts.
In the USA it generally takes one of two forms with the public school systems(note:the number of variations and combinations of Middle School and/or Junior High School for grades 5 through 9 is astounding):
grades 1 through 5=Elementary School, or in some areas Primary School
grades 6 and 7=Middle School
grades 8 and 9=Junior High School (commonly referred to as "Junior High")
grades 10, 11, and 12=High School
or...(as when and where I went to school: southern Maryland-graduated High School in 1976)
grades 1 through 5=Elementary School
grades 6, 7, and 8=Middle School
grades 9 through 12= High School
BTW, I agree with your reply, and fully endorse it.
Down With Slashdot BETA!!! I've been around the corner and seen the oliphant; you can only abuse me from your perspecti
Another time-eater at boot that might be eliminated is the routine fsck e.g. with ext3 filesystems at mount. It's unfortunate when, once in a while, it can take 5 minutes (!) or more to boot for a routine check. Granted, you can esc-abort it (a new feature in newer Ubuntus), change the intervals or switch it off altogether, but (a) Joe user doesn't know how to do that, and (b) the checks shouldn't be abandoned, since they actually make sense. Maybe it would be a good idea to find a way to delay the (routine) checks and somehow perform them in the background when the filesystems are already mounted?
fixed for you all: Think Adam's family ... it!
The final trick: preloading desktop environment files while waiting for the user to type its password."
--- I am known for the ones who want to find me on the net. Is that a privacy risk or a privilege? One might wonder..
I have that problem with my laptop. It was fixed by adding "irqpoll" to the Linux kernel's boot options.
Why not pay someone to do that for you and just buy a system?
I bought an Acer Aspire One laptop running Windows XP Home, and my employer bought a Dell desktop. I hibernated both, and both came back without video after filling the progress bar at the bottom of the screen.
For the people wanting to speed up their boot time, look at your bootloader. How many seconds is the delay?
lilo, set timeout to 0, boots without a delay, but hold control when it goes to boot and you can still get to the lilo prompt.
grub, set timeout to 0 and it boots without a delay and no chance to get to the grub prompt.
I sent in one patch (subject: [PATCH] hold shift or control to disable timeout even timeout=0), to disable the timeout when control or shift are held, seems the 10 assembly instructions I added to the core was frowned upon as that routine wasn't called in the core, so they had half a point. If I get time I'll rework it again.
The bit I positively hate about Windows is that it pretends to be usable while in reality it is still miles away from it. It boots, you log in and then you get a desktop. If have the nerve to touch anything in the first 3 minutes you extend the time to get a moderately responsive desktop by minutes.
In the end you have to watch the disk light to get some sort of idea at which point it is, and that's just a relatively normal XP based laptop with all the crud removed.
And just when you think you can use the box, Windows update pops up telling you that it has found new reasons to reboot and go through it all again..
Insert