How To Speed Up Linux Booting
An anonymous reader writes "A common complaint about Linux is the amount of time the operating system takes to start. Like Linux itself, there are plenty of options and lots of flexibility for boot-time optimization. From dependency-based solutions like initng to event-based solutions like upstart, there's an optimization solution that should fit your needs. Using the bootchart package, you can dig in further to understand where your system is spending its boot time to optimize even more."
My Linux setup is so optimised that this first post is actually made before opening Firefox and typing slashdot.org.
Ha!
I thought one of the arguments for linux was that you didn't need to reboot - like you do with Windows. So the boot time should not matter :-)
Any sufficiently advanced bug is indistinguishable from a feature.
in /etc/conf.d/rc:
rc_parallel_startup="yes"
(actually that should be in caps, but the lameness filter doesn't like it)
Most bootscripts are very generic in that they will try to load all sorts of RAID drivers, various services that are not needed, special fonts, etc.. I've gone in on my computers and wrote a very simple, quick, and to-the-point bootscript (easy to do with a little BASH knowledge), and my system boots up remarkedly fast. Granted, my bootscript isn't very portable, but one of the benefits of Linux is the ability to customize it.
Another trick is to prelink files and let KDE (if that is what you use) know about it. Even the startkde script can be long and drawn out, so trimming the fat and only including what's needed on your system can make a big difference. I've shaved over 13 seconds off a boot sequence by writing a minimum bootscript for my hardware, and that was using a relatively fast distro to start with.
-Mike
There are more things in heaven and earth, Horatio, Than are dreamt of in your philosophy.
The "bootchart" tool mentioned in the article looks promising. But it's mostly unlabeled bars. Until they figure out how to correctly identify all the processes running during boot, it's not too helpful.
The CPU utilization during booting is much higher than I would have expected. That's interesting, and unexpected. For most of the first ten seconds of post-kernel startup, the system is CPU bound, while the disk is idle more than half the time. Where is all that CPU effort going?
Fascinating article, but while searching through aptitude for some of those alternative init engines, I came across bootsplash instead and I couldn't resist!
:P
http://www.bootsplash.org/
Uh, yeah, I guess I could make good use of bootchart from the article too... mmm... more eye candy.... and you can keep looking at / admiring your stats / comparing with you friends' stats long after after you've booted up anyway!
Seriously, real Linux servers don't reboot
(burned by playing with runit some time ago)
A common complaint about Linux is the amount of time the operating system takes to start.
Actually, it's a common insult and FUD. Understanding your boot process is nice and all, but your distribution already does this and has come to reasonable compromises. If you want to tweak with it, more power to you but you won't really save much. With proper power management you don't have to boot at all. For instance, the laptop I'm using says:
12:47:33 up 65 days, 15:12, 21 users, load average: 1.20, 1.50, 1.61
I put it to sleep when I'm done and it wakes up when I need it. I can't tell you how much time I saved by not having to reopen all of my applications and remember what I'm working on every day. The price of booting is far greater than the minute or so it takes to get your desktop, it's a loss of placekeeping and continuity. If I were using Windoze, I'd probably have to wipe and reload by now.
People who complain about long gnu/linux boot times have either not learned how to use their much better systems yet or are FUDing astroturfers.
Friends don't help friends install M$ junk.
If it can be done on a 200MHz ARM9 processor in just over a second, anyone else can do it:
http://www.embeddedarm.com/epc/ts7400-spec-h.htm
When I went out to take advantage of the article's suggestions, I found that, according to this thread in the Ubuntu Forums that Ubuntu 6.10 already uses Upstart.
I did used the "profile" command in my bootup once, after reading about it in another article recently. So I guess my Ubuntu is booting about as fast as it can (unless I have useless processes starting up. I'm still trying to figure that out--I'm a noobie).
Comparing fresh Linux and XP and OS X installs, Linux is by far the slowest to boot. If your school's XP installs boot slowly, they are probably doing a lot of work like transferring lots of data over a slow network connection.
Or maybe he's just counting the time until the computer is actually usable. With Linux once the computer is booted, and you see the desktop, it's ready to use. With windows, it takes another 20 seconds (at least) after the desktop appears for it to actually become usable.
Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
Replying to my own post? Nice. I found this comparison between upstart and launchd. Long story short, launchd isn't event driven.
Anybody else appalled by the amount of people saying "just don't turn it off"?. I know I am. It's shocking for various reasons:
If you leave your computer on 24/7 just for convenience, then perhaps you ought to consider the possibility that you are a spoilt rich selfish pussy and not the infallible sysadmin you undoubtedly believe yourself to be.
I am running Kubuntu 6.10, and I have to say that I have been pleasantly surprised with Upstart, for the most part. It really is much quicker than the older boot sequences, as well as Windows XP, in my personal tests. I still have a couple qualms, however.
/boot/grub/menu.lst and commenting out "quiet splash" takes care of it, but I don't always want to perform a status check when booting. This is a really simple thing to provide accomodation for, and I may just be unaware of a more simple solution that is already in place. If anyone knows of one, please enlighten me.
The lack of a method to switch back to the traditional, detailed boot sequence is annoying. Editing
The other problem comes as a result of the first. There is, with no option to switch to a detailed boot sequence, also no way to skip network detection. I am used to just issuing 'Ctrl+C' to skip it, and so it is quite frustrating sometimes. If you aren't connected to a network, or if you connect only after you have brought the system up, you are stuck waiting however long the default timeout is, unless you, again, perform a manual edit. This wouldn't be so much of an issue if arguments could be passed by default at boot-time, but as far as I know they cannot.
Once again, if anyone knows of solutions to these issues that I am ignorant of, I'd be grateful to hear them. Other than what I have related, though, K/X/Ubuntu 6.10 boots very quickly, and I am quite happy with it.
"We may face a scorched and lifeless earth, but they're accountable to their shareholders first."
A common complaint about Linux is the amount of time the operating system takes to start.
No it isn't. Of all the things I've heard people complaining about Linux about, the start up time isn't one of them.
Get your own free personal location tracker
All in all, playing with parallelized OS startup is very nice but the real problem lies elsewhere...
In my experience (data center, 350+ Intel-based servers, Linux + Windows plus a bunch of SPARC Solaris boxes), the OS boot time is negligible compared to the time needed for hardware initialization:
- BIOS startup
- Memory check
- Remote Console init (DRAC/XSCF etc.)
- RAID Controller(s) init, disk spinup
- RAID Consistency Check, volume initialization
- Start Boot Sequence
Especially the disk subsystems cause large delays - most time is spent waiting for the GRUB screen.
Parallelizing the hardware initialization is where we could make some significant progress.
-- Gxis! Ed.
Because I only reboot my computers when I have to, like when I get an update to the kernel. The rest of the time, they just waste electricity and CPU cycles, and generate excess heat my A/C unit has to deal with! :-)
No matter where you go... there you are.
Or maybe he's just counting the time until the computer is actually usable. With Linux once the computer is booted, and you see the desktop, it's ready to use. With windows, it takes another 20 seconds (at least) after the desktop appears for it to actually become usable.
For my machine and GNOME, not true. GNOME goes through its splash screen and shows a desktop, but it is still loading panel applets and the clock. It takes several more seconds. It's hardly usable because loading anything while it's at this stage takes forever.
I used to think KDE starts slower than GNOME. Now I think it's a dead heat. KDE shows its splash screen and it's there longer, but KDE is almost (if not entirely) done loading when it says "KDE is up and running." GNOME seems to take the Windows approach: show the desktop to fool 'em, even though it is actually still loading.
Penny - plain text accounting
That's an insult to everyone's intelligence. There is no such machine, unless you have serious hardware problems and the present article is the "more power to you" that I mentioned.
Anecdotal evidence suggests otherwise. On my (old; I ditched it this morning for a Mac...that feeling, twitter, is called cognitive dissonance) PC, XP booted in about 20-25 seconds whereas Ubuntu took about 30-40 seconds. I'm not even going to start on the prepostorous LiveCD thing...how could a full Linux/GNOME desktop booting from a CD take less time to start up than Windows XP installed on a hard disk? That makes no sense. Every time I've tried an Ubuntu liveCD it's taken a few minutes to boot up.
Microsoft continues to design complex and "extensible" non standards for power management, so it's not easy. Comfort yourself by knowing that M$'s dirty tricks make things harder for their own users than they are for you.
You mean ACPI? The one developed by Microsoft, Toshiba, Intel, HP and Phoenix? The one that comes pretty much as standard on just about every motherboard? Please.
Now, you always go on about Microsoft "blaming the user". But the subtext to your posts in this thread is "You shouldn't have to boot up at all, silly person, you should be using sleep modes. Look at my l33t uptimes." What use is it to say that? Is it just trying to divert criticism from the fact that yes, fresh stock installs of popular Linux distros do actually tend to take more time to boot up than fresh installs of Windows XP on comparable hardware?
By summer it was all gone...now shesmovedon. --
Ever since Ubuntu Edgy much of the low hanging fruit in speeding up the Ubuntu boot has already been taken. Looking at the bootcharts for my system since then shows remarkably little time when the CPU is idle once the base kernel has finished loading. This means that running anything more in parallel simply won't net me anything (in fact scheduler overhead and disk thrashing may in theory make things slower).
For example, there is an improvement in the time it takes for the clock to appear from "Ubuntu Dapper Flight 3 Default kernel" to "Ubuntu Feisty Herd 5 generic kernel". The Ubuntu folks worked hard to try an eliminate sleeps from their initscripts and when a sleep was unavoidable they would run other parts of the startup process in parallel. They also made changes to Xorg to prevent it (re)reading so much stuff on launch. There was also the introduction of the readahead script which tries to arrange for as much of the boot time reading to be done in one big chunk. Throughput is higher when the disk is only reading and can utilise it's readahead. An attempt is also made to try and request files in the order in which they are laid out on disk (to minimise disk seeks which hurt performance). In Feisty a move was made to using dash instead of bash for scripts because it was smaller and executes scripts faster.
The only things that seem to win me any gain over the default Ubuntu Feisty install are turning off initscripts for services I absolutely won't use (e.g. ipv4 autoconfig via avahi) and reducing the number of restricted binary driver modules being probed (I have long noticed that the only benefit that recompiling the kernel gives to boot speed is that you can simply leave out features not on your computer making the initial kernel startup where it probes for things you might not have (like which software RAID is faster) a shade faster). It is also worth noting that Ubuntu starts X quite early and continues loading services afterwards which means the gain from disabling one of these "after X" services (like CUPS) isn't so noticeable (but might mean your desktop actually starts responding to clicks a bit sooner).
Profiling the boot to try and improve the readahead takes a long time to run - the profile run seems to take three times as long as a regular boot. It could be argued that you will never gain back the extra time you waited on the profile run...
I suspect reducing the boot further will start to need more complicated procedures, perhaps reordering modprobe.conf and reducing the amount of needless reading of files. Eventually you end up having to do the same tricks as Windows/OSX - e.g. working out where the fastest part of the disk is and copying every file needed to boot there, bringing up the network cardafter the desktop has started, periodically defraging bits of the disk, prelinking...
echo $" failed; no link present. Check cable?"
/sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then
ip link set dev ${DEVICE} down >/dev/null 2>&1
exit 1
fi
# edited below this
echo -n $" (Background)"
{
if [ -n "$ETHTOOL_OPTS" ] ; then
fi
if
echo $'\n'$"DHCP Success for ${DEVICE}"
doRest
else
echo $'\n'$"DHCP FAILED for ${DEVICE}"
exit 1
fi
} &
I fear the Y2038 bug
The trick is just right there. It's the time until desktop shows up. Not until the system is usable.
Windows XP (and I think Vista too, but the friend that was supposed to gime her unused Vista CD hasn't yet) tries to show desktop as soon as possible, even if all services didn't finish booting.
My machine isn't brand new. I mean at all. It's an old Pentium III Tualatin with 440BX chipset and 1GB SDR 133.
On linux (opensuse with old skool init), most of what need to be started is started during boot time (which includes clamav/freshclam daemons, a couple of hardware monitoring daemons, software update service, ssh, cups/samba/nfs, etc.) it's not fast but it's not taking hours either. Once I get a log-on screen, everything I have to wait for is Gaim starting. And it seems linux is good enough at multitasking to handle it in background well enough.
On windows XP, the boot phase doesn't seem much faster. And then I have to log-in and ll hell break loose. Only after I have logged in, the system decide to rescan my USB and Firewire interface, plus my anti-virus has to terminate to load, plus it has to update its definitions, and a half a dozen of small applets has to load into the task bar, all of this constantly checked by the antivirus.
All this can take up to 5-10 minutes.
And I'm running just a minimal amount of task bar applets (Firewall, antivirus, hardware monitoring, control pannels for 3D card) I'm not running an additionnal crap (no OpenOffice.org fast loaders, nor MSOffice, no Acrobad preloader, nor Photoshop)...
It looks to me that Windows just try to show the desktop earlier to show off and give a false impression of quick boot. Or maybe it's designed to run only on last generation hardware (Athlon / P4 and upward with DDR at least). But I can't say the delay is short before I can do anything in Windows (usually : start a game).
"Sufficiently advanced satire is indistinguishable from reality." - [Tips: 1DrYakQDKCQ6y52z6QbnkxHXAocMZJE61o ]
I've noticed kernels booting faster over the last 8 months. I started with 2.6.15 and now I'm using 2.6.20. I went from a boot time that was about a minute to the current one which is probably 20-30 seconds. I'll rebo...
Wow, I love the "restore session" on Firefox. Anyway, I just timed my reboot, and from the time I hit "enter" to choose a distro (multi-boot) and the time GDM finishes loading, it's 23 seconds.
look! it's a bird, it's a plane, it's....a girl? yes, a girl browsing Slashdot on Linux
And some of us remember when it was about 5 seconds.
Of course, that was a TRS-80. :)
My beliefs do not require that you agree with them.