Make Debian boot faster
Posted by peterhoeg on Wed 27 Jul 2005 at 20:42
Several people have written guides on booting Debian systems faster. Most of these involve reordering initscripts, and other significant changes. There is a much simpler alternative to speeding up boot times though, whilst it might not work for all it's an interesting hack.
A simple one-line hack is to run scripts in parallel, merely by changing the startup script /etc/init.d/rc.
Changing the line:
startup $i start
to the following:
startup $i start &
This idea originated here.
[ Send Message | View davrieb's Scratchpad ]
Some services assume that some other services are already up and running. With your proposal this can no longer be guaranteered. This services may now fail or not fail depending if everything starts in the right order.
I am not saying, that this is really a bad idea, but it can break things in non-obvious ways and you should know about that before doing that
[ Parent | Reply to this comment ]
However, Debian seems to start all critical services in single user mode, so I have not yet seen any problems.
[ Parent | Reply to this comment ]
--------
Felipe Sateler
[ Parent | Reply to this comment ]
http://initng.thinktux.net/index.php/Main_Page
[ Parent | Reply to this comment ]
The post found at the end of the link in the article also has some more references to how other people did various things to speed up the boot process, but none of them are as simple as mine.
[ Parent | Reply to this comment ]
It's a daemontools like thing with BSD license and cleanup (additional features too!)
Take a look: http://smarden.org/runit
It is a part of debian so: apt-get install runit
(installing runit-run replaces init)
But this requires a lot of work (as seen in the other comment above).
-- cstamas
[ Parent | Reply to this comment ]
box faster, replace init with runit. which is only three stage booting process. Check more on..... http://smarden.org/runit
With Cheers,
Hardik Dalwadi.
[ Parent | Reply to this comment ]
... echo "Loading kernel for kexec()" /usr/local/sbin/kexec \ --load /vmlinuz \ --command-line="root=301" \ --append="root=301 panic=5" echo -n "Deactivating swap..." ...and kexec the kernel in /etc/init.d/reboot:
PATH=/sbin:/bin:/usr/sbin:/usr/bin echo -n "Rebooting... " /usr/local/sbin/kexec -e reboot -d -f -i
[ Parent | Reply to this comment ]
My conclusion: it's little bit faster, on Workstation box it should not fail on anything, but boot time from grub-init2 is longer than init2-gdm screen. Pure kernel initialization and hotplug from rcS are the slowest ones.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
Five seconds of difference on my laptop using this simple tweak! (bootchart shows an improvement from ~45s to ~40s)
Debian Sid on a 1,73GHz centrino laptop
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
thank you in advance my e-mail is Justin_Kubicek@hotmail.com
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
[ Parent | Reply to this comment ]
startup $ACTION $SCRIPTSwith:
startup $ACTION $SCRIPTS &?
[ Parent | Reply to this comment ]
I am not using etch myself, but give it a go. It seems like shutdown sequences also will be done in parallel this way which may or may not be a good thing.
You can modify your script to look like this:
if [ "$ACTION" == "start" ] ; then startup start $SCRIPTS & else startup $ACTION $SCRIPTS fi
Untested but it should work.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
if [ "$ACTION" == "start" ] ; then
startup start $SCRIPTS &
else
startup $ACTION $SCRIPTS
fi
didn't work. it boots. and really quickly. but what from what i can see most of the boot processes aren't allowed to finsh. for example, routine reiserfs check fail, and X doesn't start up, unable to load the mouse module.
is there similar code that would work for /etc/init.d/rc in sid?
[ Parent | Reply to this comment ]
For sarge, the hack would only parallelize the tasks/services that are run after single user mode (normally runlevel 2).
Send me a mail with your rc file and I will take a look. My address is peter at hoeg dot com.
[ Parent | Reply to this comment ]
# Specify method used to enable concurrent init.d scripts.so in your /etc/init.d/rc just replace:
# Valid options are 'none', 'shell' and 'startpar'
CONCURRENCY=nonewith:
CONCURRENCY=shellthis change reduced boot time on a debian/sid, Pentium III, 600MHz, runninig kernel 2.6.16-2-686 from 245 seconds to 205 seconds. i should note, not sure why, but kernel 2.6.16 boots extremly slow on this machine: 205 seconds isn't exactly fast. but other kernels boot much faster.
thanks for the help peter!
[ Parent | Reply to this comment ]
CONCURRENCY=none
with:
CONCURRENCY=shell
in /etc/init.d/rc : found a dramatic boot time improvement from 1'50" to 1'04" from pressing the power button (thus including bios & grub wait) to the gdm beeping ready, on my laptop dell D800 Pentium 1.60GHz, debian 4.0.
Some of the spared time comes from the system not standing still and waiting for DHCP to provide an address...
Thanks to all for the precious advice! I think this hack should be either included in the standard distribution or advertised more extensively, especially for laptop users.
All the best,
Nick
http://www.mi.infm.it/manini/
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]