View previous topic :: View next topic |
Author |
Message |
thundersteele Apprentice
Joined: 30 Aug 2003 Posts: 219
|
Posted: Wed Feb 11, 2004 6:31 pm Post subject: |
|
|
I just took a watch:
Laptop (4200 rpm), 1.5 GHz Pentium M, 512 Ram:
46 seconds from grub to working kde (auto login, some karamba apps). It was about 22 seconds until X started to start, so I think I could reach about 30 seconds using an lighter WM
My desktop needs some more time, I need to start net.eth0 and cups there. Didn't use parallel startup on desktop until now (I think I just forgot).
I read some trick here a while ago how to speed up modules loading. It was about putting an "&" somewhere in /etc/init.d/modules to load them at the same time, not one after the other. (the last &)
Code: | modprobe -q ${x} ${modargs[${i}]} &>/dev/null & |
Windows:
OK, it is quite fast. But on my desktop for example I have to wait about 10 - 15 additional seconds after Windows seems to have finished booting (no more hour glass) until I can connect to the Internet. KDE instead is ready when It says it is ready, and my internet connection is working a long time before.
Last edited by thundersteele on Thu Feb 12, 2004 1:23 am; edited 2 times in total |
|
Back to top |
|
|
pranyi Apprentice
Joined: 06 Mar 2003 Posts: 293 Location: Germany
|
Posted: Wed Feb 11, 2004 10:56 pm Post subject: |
|
|
thundersteele wrote: |
Code: | modprobe -q ${x} ${modargs[${i}]} &>/dev/null [color=red]&[/color] |
|
It is standard in the current gentoo scripts.
I have tried something deifferent, which can be used to gain some seconds (I gained 5 out of 40)
I had my internet connection and several server startups in the default runlevel. Since X takes about 10 seconds to start on my machine, I wanted that X starts as soon as possible. However, because of some dirty reasons, the X does not start parallely to the other stuff, because it is not really started in the default level, just put into some dummy runlevel by a dirty hack. Now I hacked the following dirty trick.
Therefore I made a new runlevel (called server), and deleted almost all services from the default runlevel and added to this new runlevel. I just let hdparms, local and metalog there. Moreover, and this is important: I added xdm to the new runlevel also. So xdm is contained in both default and server.
And now comes the real hack: I want that this new runlevel starts automatically. So I added the line
at the end of /etc/X11/startDM.sh
Now, if I start my box, then xdm boots before internet and all other services like net.eth0,adsl,postgres,mpd,speechd,..., etc. This can save some "precious" seconds.
The only drawback I see is that the vt1 will contain some garbage logs instead of the login prompt after booting up, which is not really elegant. However, pressing returns gives a new login prompt.
Last edited by pranyi on Thu Feb 12, 2004 2:06 pm; edited 1 time in total |
|
Back to top |
|
|
int2str Guru
Joined: 29 Sep 2003 Posts: 362
|
Posted: Wed Feb 11, 2004 11:04 pm Post subject: |
|
|
I played with it some more:
- Moved some of the stuff I don't use every day (like firewire) into modules
- Commented out module dependancy search
- Moved xdm to boot runlevel
New time power-on to kde *completely* up and running: 1:00.
Not great, but getting there.
Man I still wish I could suspend (to ram preferably)... _________________ Adpot an unanswered post today! |
|
Back to top |
|
|
pranyi Apprentice
Joined: 06 Mar 2003 Posts: 293 Location: Germany
|
Posted: Wed Feb 11, 2004 11:16 pm Post subject: |
|
|
int2str wrote: |
- Moved xdm to boot runlevel
|
If you read the xdm script, you can see that in general it is dangerous to let X start before the getty is up.
On your particular machine, it may be a good idea, but if some service blocks getty, then you may get into trouble: no keyboard in X.
BTW, I have already commented out the depmod stuff, but it did not help much on my box.
I am considering moving some not-important boot stuff into my extra runlevel such as USB startup etc, but am unsure whether it's possible. |
|
Back to top |
|
|
pranyi Apprentice
Joined: 06 Mar 2003 Posts: 293 Location: Germany
|
Posted: Wed Feb 11, 2004 11:20 pm Post subject: |
|
|
Another ide would be to allow mounting a lot of stuff after X is mounted,
setting hdparms for the other two harddrives may be postponed to a later time (if it is needed at all, I don't know anynmore) |
|
Back to top |
|
|
pranyi Apprentice
Joined: 06 Mar 2003 Posts: 293 Location: Germany
|
Posted: Thu Feb 12, 2004 2:12 pm Post subject: |
|
|
thundersteele wrote: | It was about 22 seconds until X started to start, so I think I could reach about 30 seconds using an lighter WM |
I would propose openbox. It loads fast as hell, and it's very convincing.
BTW, It seems that the boot-time of KDE also improved a bit 3.2 relative to 3.1.0, but it's just a feeling not supported by any numbers on my side. |
|
Back to top |
|
|
dsd Developer
Joined: 30 Mar 2003 Posts: 2162 Location: nr London
|
Posted: Thu Feb 12, 2004 7:38 pm Post subject: |
|
|
it suprised me that i havent seen it mentioned already, but when comparing bootup times to windows-based operating system, you should bear in mind that windows shows the loginbox/desktop *before* everything has finished starting up. a typical system is generally slow/unusable for quite a few more seconds after that point.
linux will start everything and only then show you the login box. _________________ http://dev.gentoo.org/~dsd |
|
Back to top |
|
|
ett_gramse_nap Apprentice
Joined: 01 Oct 2003 Posts: 252 Location: Göteborg, Sweden
|
Posted: Thu Feb 12, 2004 8:48 pm Post subject: |
|
|
dsd wrote: | it suprised me that i havent seen it mentioned already, but when comparing bootup times to windows-based operating system, you should bear in mind that windows shows the loginbox/desktop *before* everything has finished starting up. a typical system is generally slow/unusable for quite a few more seconds after that point.
linux will start everything and only then show you the login box. |
Mmm, most people seem to neglect this obvious fact! Every Windows-box is practically useless for a couple of seconds after the login... _________________ Don't bother! |
|
Back to top |
|
|
Boris27 Guru
Joined: 05 Nov 2003 Posts: 562 Location: Almelo, The Netherlands
|
Posted: Thu Feb 12, 2004 9:08 pm Post subject: |
|
|
Well, one should also bear in mind that most linux boxes are running more services than WinXP boxes. Like sshd, proftpd, nfs, webmin or postgres. |
|
Back to top |
|
|
Oo.et.oO Apprentice
Joined: 23 Apr 2002 Posts: 291 Location: burlington
|
Posted: Thu Feb 12, 2004 9:48 pm Post subject: |
|
|
dsd wrote: | it suprised me that i havent seen it mentioned already, but when comparing bootup times to windows-based operating system, you should bear in mind that windows shows the loginbox/desktop *before* everything has finished starting up. a typical system is generally slow/unusable for quite a few more seconds after that point.
linux will start everything and only then show you the login box. |
this WAS mentioned. look above. |
|
Back to top |
|
|
markfl Apprentice
Joined: 10 Apr 2003 Posts: 240 Location: Kent, UK
|
Posted: Thu Feb 12, 2004 10:11 pm Post subject: |
|
|
starting services after login is dangerous on windows - there exists a situation in win2k where you can screw yourself royally
services continue starting during and after login but at login the system saves the last known good config
if that config turns out not to be good then you cannot change the config and its possible to have a non-working config.
So its best to wait a lil while before logging in on win.
markfl _________________ Life it seems, will fade away
Drifting further every day |
|
Back to top |
|
|
xkjyeah n00b
Joined: 10 May 2003 Posts: 72
|
Posted: Mon Feb 16, 2004 8:15 am Post subject: |
|
|
But I just did what windows does:
# mkdir -p /etc/svc/bin
/etc/svc/bin/initsvc.sh:
Code: |
#!/bin/sh
# WARNING: Must be executed with depscan.sh sourced
STARTED_DIR=/var/lib/init.d/started
NET_FILE=/etc/svc/net
AUTO_FILE=/etc/svc/auto
# Execute AUTO stuff
AUTO_FILES=$(< $AUTO_FILE)
for autosvc in $AUTO_FILES
do
/etc/init.d/${autosvc} start
done
if [ ! "$(/bin/ls $STARTED | /bin/grep 'net\.' | /bin/grep -v 'net\.lo')" = "" ]
then
for netsvc in $(< $NET_FILE)
do
/etc/init.d/${netsvc} start
done
fi
|
/etc/init.d/initsvc:
Code: |
#!/sbin/runscript
start () {
ebegin "Starting service loader"
/etc/svc/bin/initsvc.sh 2>/var/log/svcinit.log 1>/var/log/svcinit.log &
eend
}
stop() {
ebegin "Stopping service loader" #Doesn't need to be stopped, because process has ended anyway
eend
}
|
/etc/svc/auto:
Code: |
ifplugd
alsasound
apache2
cupsd
gpm
netmount
samba
|
/etc/svc/net: (local because I update my router's port forwarding config)
Then rc-update del all the crap in /etc/runlevels/default, leaving (in my case), metalog, vixie-cron, xdm, xfs and of course, initsvc.
All these services hopefully do not depend on each other, so it works. As for the net part, it needs some fixing, if your DHCP server takes a long time to respond (not so with net.*, but applicable to ifplugd).
Then check your status with /var/log/svcinit.log
This, together with preventing update of module dependencies slashes my startup time by 10 secs, so it is currently at 20s for Gentoo vs 10s for Windows XP. I think this is the best I can go, the rest is all the stuff that cannot be changed (clock, modules, random numbers, loggers, cron).
(Off Topic)
BTW, I have another script that could be of use:
Code: |
#!/bin/bash
PROGRAM=$0
ACTION=$1
TOPIC=$2
case $ACTION in
-s|list)
ACTION=list
;;
view)
;;
-p|path)
ACTION=path
;;
*)
TOPIC=$ACTION
ACTION=view
esac
action() {
zalias=$1
file=$2
case $ACTION in
list)
#list those that match
if [ ! $(echo "$zalias" | grep "$TOPIC") = "" ]; then
echo $zalias '---' $file
fi
;;
view)
#view logfile
if [ "$zalias" = "$TOPIC" ]; then
sudo less /var/log/$file
exit
fi
;;
path)
if [ "$zalias" = "$TOPIC" ]; then
echo /var/log/$file
exit
fi
;;
*)
# print help
echo 'USAGE: '$PROGRAM' ( list | view ) file
'
exit
esac
}
for LOG in $(ls -l /var/log | awk '/^-rw/ { print $9}' | sort )
do
action $(echo $LOG | sed '
s/log//
s/[^ a-zA-Z0-9]//g') $LOG
done
DIR_LOGS=$(ls -l /var/log | awk '/^drw/ { print $9} ' | sort )
for DIR in $DIR_LOGS
do
FILES_IN_DIR=$(sudo /bin/ls /var/log/$DIR | sort -r)
COUNTER=0
for logfile in $FILES_IN_DIR
do
newname=$(echo $logfile | sed 's/\(log_\|log-\|\.log\|log\.\|_log\)//')
if [ ! "$(echo $newname | grep '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]:[0-9][0-9]:[0-9][0-9]$')" = "" ]; then
(( COUNTER++ ))
ALIAS=$DIR$COUNTER
##
elif [ "$newname" = "current" ]; then
ALIAS=$DIR
else
ALIAS=$DIR-$newname
if [ $newname = $DIR ]; then
ALIAS=$DIR
fi
fi
action $ALIAS $DIR/$logfile
# Usually we have current, log-date, log-date etc (system)
# Now, dates are BAD. Give them numbers instead
# Or we have log.xxx (samba)
# Or access_log, error_log (apache)
# Or vsftpd.log
# Generic function will do
done
done
|
if you save it as /usr/bin/readlog (0755), you can read your logs by:
$ readlog svcinit
list possible options:
$ readlog list
list options starting with X:
$ readlog list '^X'
etc. |
|
Back to top |
|
|
dementer Tux's lil' helper
Joined: 25 Jan 2004 Posts: 139 Location: New Zealand
|
Posted: Fri Jun 18, 2004 5:47 am Post subject: |
|
|
If you are using dhcp then check the man file for your client, it may start faster with shorter timeout set in the configuration.
I dont find it taking over long to boot my system, although hotplug, dhcp and xfs take their time which bugs me |
|
Back to top |
|
|
Rav70 l33t
Joined: 11 Feb 2004 Posts: 607 Location: Poland
|
Posted: Fri Jun 18, 2004 7:42 am Post subject: |
|
|
grzewho wrote: | I`ve commented out the modules-update line in /etc/init.d/modules, and run it manually when I upgrade my kernel or change something with my modules config. Don`t know if its a proper fix, but it speeds up my boot.
Code: |
#ebegin "Calculating module dependencies"
#/sbin/modules-update &>/dev/null
#eend $? "Failed to calculate dependencies"
|
|
gee, why didn't I think of that? Anyway, as I tend to forget about such things as running manually an updater script, I've hacked it a bit to run modules-update automagically if a file in /etc/modules.d/ is newer than /etc/modules.conf.
Original code:
Code: |
if [ -z "${CDBOOT}" ]
then
ebegin "Calculating module dependencies"
/sbin/modules-update &>/dev/null
eend $? "Failed to calculate dependencies"
fi
|
My mod:
Code: |
if [ -z "${CDBOOT}" ]
then
# do we have find?
if [ -x /usr/bin/find ]
then
NEWMODULES="`/usr/bin/find /etc/modules.d -type f -newer /etc/modules.conf`"
if [ ! "" = "$NEWMODULES" ]
then
ebegin "Calculating module dependencies"
/sbin/modules-update &>/dev/null
eend $? "Failed to calculate dependencies"
else
einfo "Module dependencies are up-to-date - do not recalculating."
fi
else # no we don't
ebegin "Calculating module dependencies"
/sbin/modules-update &>/dev/null
eend $? "Failed to calculate dependencies"
fi
fi
|
Feel free to use - any comments welcome
Regards
Rav _________________ Q: Why is Microsoft's Product Support a failure?
A: Because Microsoft needs a Support Group instead. |
|
Back to top |
|
|
d3fr4g n00b
Joined: 16 Mar 2004 Posts: 44 Location: Italy
|
Posted: Fri Jun 18, 2004 7:45 am Post subject: |
|
|
Guys if you want speed use Window Maker or Xfce instead of Kde.....Kde is damn' slow and heavy, I have a G3 800 with 128MB ram and it takes me 40 to 50 seconds to boot into X with WindowMaker.....what if I use KDE?? 2 min. ? I think that some GUI like KDE or the Windows'one are too heavy and full of useless things.... |
|
Back to top |
|
|
BlackEdder Advocate
Joined: 26 Apr 2004 Posts: 2588 Location: Dutch enclave in Egham, UK
|
|
Back to top |
|
|
neenee Veteran
Joined: 20 Jul 2003 Posts: 1786
|
Posted: Fri Jun 18, 2004 10:09 am Post subject: |
|
|
well, this is about speeding up linux boot - not speeding up running apps |
|
Back to top |
|
|
sapphirecat Guru
Joined: 15 Jan 2003 Posts: 376
|
Posted: Fri Jun 18, 2004 4:32 pm Post subject: |
|
|
Rav70 wrote: | Code: | if [ ! "" = "$NEWMODULES" ] |
|
For that particular line, I'd go with the more usual...
Code: | if [ -n "$NEWMODULES" ] |
_________________ Former Gentoo user; switched to Kubuntu 7.04 when I got sick of waiting on gcc. Chance of thread necro if you reply now approaching 100%... |
|
Back to top |
|
|
Rav70 l33t
Joined: 11 Feb 2004 Posts: 607 Location: Poland
|
Posted: Fri Jun 18, 2004 7:12 pm Post subject: |
|
|
sapphirecat wrote: | Rav70 wrote: | Code: | if [ ! "" = "$NEWMODULES" ] |
|
For that particular line, I'd go with the more usual...
Code: | if [ -n "$NEWMODULES" ] |
|
thanks for the tip/correction And as a matter of fact one could replace the whole:
Code: |
NEWMODULES="`/usr/bin/find /etc/modules.d -type f -newer /etc/modules.conf`"
if [ ! "" = "$NEWMODULES" ]
|
with:
Code: |
if [ -n "`/usr/bin/find /etc/modules.d -type f -newer /etc/modules.conf`" ]
|
without much harm to the readability of the code
Regards,
Rav _________________ Q: Why is Microsoft's Product Support a failure?
A: Because Microsoft needs a Support Group instead. |
|
Back to top |
|
|
NightSpirit n00b
Joined: 27 Sep 2003 Posts: 71 Location: North London, UK
|
Posted: Sun Jun 27, 2004 5:30 pm Post subject: |
|
|
pranyi wrote: | int2str wrote: |
- Moved xdm to boot runlevel
|
If you read the xdm script, you can see that in general it is dangerous to let X start before the getty is up.
On your particular machine, it may be a good idea, but if some service blocks getty, then you may get into trouble: no keyboard in X.
... |
Well, I have found that the no "keyboard in X" can be fixed by adding to /etc/X11/gdm/gdm.conf (inittab only configures ttys 1-6). I am using this setting to enable me to do away with the nasty xdm/startDM.sh stuff and create a simpler gdm init script which has the added bonus of not dropping to console view for a second or two inbetween bootsplash progress bar and X. It seems far too simple so I'll probably run into other problems eventually
Anyway, starting from selecting gentoo grub option to useable* XFCE desktop (via GDM auto-login) in 32 seconds (gdesklet startbar popping up 3 seconds after). Doesn't sound too bad considering the same machine boots from grub to useable* untweaked XP Professional desktop (auto login) in 29 seconds (anti-virus, mbm and various other XP services taking a further 13 seconds to finish loading**).
Not exactly a particularly fair test but still shows that it doesn't have to take 2/3 times as long to boot into linux over windows
* = defined by the time to show desktop and ability to click menu
** = defined by the time taken for first two items to show in tray and the cursor to stop showing hour glass. _________________ Currently playing with Applescript ... hmmm |
|
Back to top |
|
|
gnuageux Veteran
Joined: 17 Apr 2004 Posts: 1201
|
Posted: Wed Jun 30, 2004 12:12 pm Post subject: |
|
|
There are no official guidelines as to what services should be started based on runlevel. Id take a look at your default runlevels directory and remove the syms there accordingly. (/etc/runlevels/default) If you see sendmail or httpd and dont run a mail or web service your prolly ok to remove those. The syntax to do that is:
rc-update del service default |
|
Back to top |
|
|
teutzz Guru
Joined: 22 Apr 2004 Posts: 333 Location: .ro
|
Posted: Sat Jul 03, 2004 4:44 pm Post subject: |
|
|
@nightspirit:
how would you do that trick with when using kdm?
thanx in advance _________________ Cand nu stii ce sa raspunzi sau ce sa spui un simplu BLA ajunge... lolz |
|
Back to top |
|
|
Kaali Tux's lil' helper
Joined: 12 May 2002 Posts: 80
|
Posted: Tue Jul 13, 2004 9:17 am Post subject: |
|
|
Rav70 wrote: |
Original code:
Code: |
if [ -z "${CDBOOT}" ]
then
ebegin "Calculating module dependencies"
/sbin/modules-update &>/dev/null
eend $? "Failed to calculate dependencies"
fi
|
My mod:
Feel free to use - any comments welcome
Regards
Rav |
My way of doing that is:
Code: |
if [ -z "${CDBOOT}" ]
if [ /etc/modules.d -nt /etc/modules.conf ] then
ebegin "Calculating module dependencies"
/sbin/modules-update &>/dev/null
eend $? "Failed to calculate dependencies"
fi
fi
|
And it works fine and fast. Maybe this should be sent as a patch to rcscript developers?
Other things that i have done to make the bootup process faster on my computer:
- Make mount fork itself for paraller mounts:
Replace in /etc/init.d/localmount:: Code: | mount -at nocoda,nonfs,noproc,noncpfs,nosmbfs,noshm >/dev/null | with: Code: | mount -aFt nocoda,nonfs,noproc,noncpfs,nosmbfs,noshm >/dev/null |
- Make mounting huge ReiserFS3 partition faster.
It seems that on my computer mounting my home directory which is a 160Gb LVM partition using ReiserFS3 filsystem, takes about 9-10 seconds which is not acceptable if i want to have a quick boot. So i put "noauto" on that partition in fstab and mounted it separately in a background process.
Add in /etc/init.d/localmount: Code: | mount /home >/dev/null & | after Code: | eend $? "Some local filesystem failed to mount" |
Warning: Use this patch only if you are sure that your bootup process doesn't need to read/write to /home. And there is no reason to use this if mounting this partition is fast already.
- Do env-update only if necessary.
Replace in /etc/init.d/bootmisc:
Code: |
if [ -x /sbin/env-update.sh ]
then
ebegin "Updating environment"
/sbin/env-update.sh >/dev/null
eend 0
fi
|
with
Code: |
if [ -x /sbin/env-update.sh ]
then
if [ /etc/env.d -nt /etc/profile.env ]
then
ebegin "Updating environment"
/sbin/env-update.sh >/dev/null
eend 0
fi
fi
|
- Forced paraller services.
I made a similiar system as xkjyeah did, but just a tad simpler: I removed hotplug, shorewall and rp-pppoe from runlevels. Then i made my own rc-script:
Code: |
#!/sbin/runscript
depend() {
need net
}
start() {
ebegin "Starting background loading"
/etc/init.d/hotplug start &
# Shorewall before internet connection for safety.
/etc/init.d/shorewall start
/etc/init.d/rp-pppoe start &
}
stop() {
ebegin "Stopping background loader"
}
|
With this i put hotplug to background, load firewall before i connect to the internet and then connect to the internet at the background. Setting this kind of script is highly subjectible depending on your configuration, but this rc-script fastens my bootup a lot. For some reason RC_PARALLEL_STARTUP="yes" didn't help as much as manually forcing backgrounding of these scripts.
- Removing boot filesystem checks.
ReiserFS FAQ told to use 0 as pass value in /etc/fstab on ReiserFS partitions so i did it, and it made it somewhat faster because i have some big ReiserFS partitions.
Conclusion:
With these optimizations my Gentoo/Linux bootup time went from 1m20s to 20-30s which is quite a big leap. Setting up LVM takes the longest time on my bootup process at the moment and i have no idea how to make that faster, propably can't because it only runs tools that is provided by the LVM package.
Maybe we should make a thread about these tweaks in "Documentation. Tips & Tricks" |
|
Back to top |
|
|
Malakai Apprentice
Joined: 24 Dec 2002 Posts: 299
|
Posted: Tue Jul 13, 2004 2:59 pm Post subject: |
|
|
That's rather strange, it takes me about 30 seconds to go from grub to being inside gnome, and prolly 40-45 seconds before windows xp is actually usable (sure the screen comes up, but it needs to finish loading the services before you can even open firefox).
Plus watching the kernel tell you what it's doing is more interesting to watch than that low res winxp loading screen. |
|
Back to top |
|
|
Y n00b
Joined: 01 Jul 2004 Posts: 14 Location: Hanover Park, IL (US)
|
Posted: Tue Jul 13, 2004 6:24 pm Post subject: |
|
|
I removed module support alltogether from my kernel and it seems to boot up uber fast, and the cool thing is firehol still seems to work
I can basically boot up and start fluxbox in under a minute,
which is pretty good considering how old my computer is _________________ "where the telescope ends, the microscope begins; which of the two has the grander view?" Victor Hugo
(O) |
|
Back to top |
|
|
|