View previous topic :: View next topic |
Author |
Message |
zieloo Veteran
Joined: 28 Mar 2004 Posts: 1337
|
Posted: Wed Jul 14, 2004 1:39 pm Post subject: |
|
|
On a 466MHz old celeron with 128 megs of ram it takes up to 20 secs. for a login screen to show up + a few more to start X + a light windowmanager. So i don't understand you guys... You've got ~ 2 Mhz & ~512 Mb machines a cry because you have to wait 1-2 minutes to load kde? Maybe you should use an old computer, instead.
Speeding up your computer is all about choices... You must decide what services (and how many) to start and resign
Also very inportant is kernel version and applied configuration. Now i'm using 2.6.7-ck5 sources with loadable modules support turned off. This enlarged my kernel up to about 1.2Mb (could be smaller...), but since i don't need to load any extra modules i feel more comfortable...
So - to sum up - starting Linux in less than 30 secs. is not a problem... Comparing to Windows - you save time even if it takes 2 mins. to boot... |
|
Back to top |
|
|
fourwood Apprentice
Joined: 17 May 2003 Posts: 197
|
Posted: Wed Jul 14, 2004 5:29 pm Post subject: |
|
|
Sure a one minute bootup time isn't horrible. But, if it can be shorter, why not make it that way? I don't see the point in telling people to be happy with what they have if they can make it better. |
|
Back to top |
|
|
F.Ultra Apprentice
Joined: 17 Mar 2004 Posts: 169 Location: Sweden
|
Posted: Wed Jul 14, 2004 7:05 pm Post subject: |
|
|
It might be ridicolous to whine about slow boot, but for many people this is a big problem, some of us tends to do many reboots (I for one dual boots with XP so there can be quite some switching on busy days on my development machine). Also never underestimate the nice feeling that you Linux box boots faster than that windows machine!
I see the problem as Linux beeing very targeted for server use and hence loads everthing in order to be 100% sure that everything works ok. Compare this with a desktop system as XP and they have no need to start all services beforehand (as compared with w2k3 that is XP for servers and that has quite a bit longer boot-time).
What I would like to see is a way to get local up really fast and after that begin to start other services. For example I have a very slow DHCP server (a cisco router that has gone mad for some strange reason) that most of the time waits nearly 2 minutes before handing out addresses so I have to wait roughly 2 minutes every boot for net.eth0 to start so ntp-client and ntpd also can start. As in XP these should really have been started after I got a login prompt (or at the exact same time). Putting net.eth0 into background won't help either since that would make ntp-client and ntpd to fail.
So is there a way to hack the Linux boot process to bring up local right after kernel so that we could have almost subsecond booting, and then start all services in silent background while the user enters username and password ? I bet there is, but it might be quite hard to do (?) |
|
Back to top |
|
|
Kaali Tux's lil' helper
Joined: 12 May 2002 Posts: 80
|
Posted: Wed Jul 14, 2004 8:17 pm Post subject: |
|
|
Well, some of us are geeks, hackers even. It is fun to play with your toys. I don't boot that often, but i had a boring night so it thought that if i would take booting faster as a problem for me to solve i wouldn't be that bored. Well, i managed to shave a minute of my bootup time so the end result is pleasing and it was fun to do. Why would you ever want to walk with your hands, your legs are better at it, because it's fun! Why would you want to run a system on an emulator that you already own, because it's interesting and that is what us geeks do |
|
Back to top |
|
|
asph l33t
Joined: 25 Aug 2003 Posts: 741 Location: Barcelona, Spain
|
Posted: Wed Jul 14, 2004 8:37 pm Post subject: |
|
|
thank you for the post Kaali, great tweaks to speed up boot process
also this thread is very educational to learn and understand boot process _________________ gentoo sex is updatedb; locate; talk; date; cd; strip; look; touch; finger; unzip; uptime; gawk; head; emerge --oneshot condom; mount; fsck; gasp; more; yes; yes; yes; more; umount; emerge -C condom; make clean; sleep |
|
Back to top |
|
|
NightSpirit n00b
Joined: 27 Sep 2003 Posts: 71 Location: North London, UK
|
Posted: Thu Jul 22, 2004 9:37 pm Post subject: |
|
|
teutzz wrote: | @nightspirit:
how would you do that trick with when using kdm?
thanx in advance |
Sorry teutzz, but I havn't been checking this thread much. I don't use kdm myself, but since no-one else has had a stab at answering you I'll make a guess. If you look in the file /usr/kde/3.2/share/config/kdm/Xservers there should be a single non commented out line, in mine it is this:
Code: | :0 local@tty1 /usr/X11R6/bin/X -nolisten tcp vt7 |
Hopefully, changing vt7 to vt9 for example and then saving it and restarting kdm should fix it.
Hope that helps _________________ Currently playing with Applescript ... hmmm |
|
Back to top |
|
|
floam Veteran
Joined: 27 Oct 2002 Posts: 1067 Location: Vancouver, WA USA
|
Posted: Thu Jul 22, 2004 11:37 pm Post subject: |
|
|
NightSpirit wrote: | 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. | Can you post your simpler init script? _________________ Think about your breathing.
http://floam.sh.nu |
|
Back to top |
|
|
NightSpirit n00b
Joined: 27 Sep 2003 Posts: 71 Location: North London, UK
|
Posted: Mon Jul 26, 2004 10:35 pm Post subject: |
|
|
Sorry floam, clearly don't check my email anough either
The init script I use for gdm (as apposed to using existing xdm script) is as follows:
Code: |
depend() {
need localmount ypbind netmount
use xfs hotplug
}
start() {
ebegin "Starting GDM"
start-stop-daemon --start --quiet --exec /usr/bin/gdm &
eend ${?}
}
stop() {
ebegin "Stopping GDM"
start-stop-daemon --stop --quiet --pidfile /var/run/gdm.pid
eend ${?}
}
|
Nothing special there at all really, you can take out the ypbind and netmount dependancies if not applicable to your system.
This requires you use the previously specified fix to get gdm started on vt9 which does not conflict with any getty cauing a fight over keyboard which I believe was the whole point of the startdm.sh thing in the first place. I've booted up with this setup many times (games machine is far too noisy to sleep with if it's on) and never had a keyboard lock out.
Hopefully that helps, a little intoxicated this evening so might have missed the point of why you were asking for the above _________________ Currently playing with Applescript ... hmmm |
|
Back to top |
|
|
nsahoo l33t
Joined: 17 Jul 2003 Posts: 618
|
Posted: Sat Aug 07, 2004 7:01 am Post subject: |
|
|
Although faster boot time can be really useful, I'd hate to compare with XP, because, showing the desktop while it's not ready seems like a lie to me. |
|
Back to top |
|
|
Nightscape n00b
Joined: 18 Aug 2004 Posts: 12
|
|
Back to top |
|
|
Phlogiston Veteran
Joined: 27 Jan 2004 Posts: 1925 Location: Europe, Swizerland
|
Posted: Sun Aug 29, 2004 5:50 pm Post subject: |
|
|
Kaali wrote: | 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?
|
This does not work here
I get this:
Code: | * ERROR: "/etc/init.d/modules" has syntax errors in it; not executing... |
|
|
Back to top |
|
|
Phlogiston Veteran
Joined: 27 Jan 2004 Posts: 1925 Location: Europe, Swizerland
|
Posted: Sun Aug 29, 2004 6:03 pm Post subject: |
|
|
I managed that xdm is started before other services, but it seems like it waits until the last service is started... I don't know why? Could anybody help me? |
|
Back to top |
|
|
Titeuf l33t
Joined: 19 Jun 2004 Posts: 759 Location: Middelkerke, Belgium
|
Posted: Sun Aug 29, 2004 7:40 pm Post subject: |
|
|
If you use dhcp for your network, the following greatly increased the speed of it:
Edit /etc/init.d/net.eth0
and command the whole if-block under "Stop DHCP..."
Example:
Code: |
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
# if /sbin/dhcpcd -z ${i} &>${devnull}; then
# ebegin " Releasing DHCP lease for ${IFACE}"
# for ((count = 0; count < 9; count = count + 1)); do
# /sbin/dhcpcd -z ${i} &>${devnull} || break
# sleep 1
# done
# [[ ${count} -lt 9 ]]
# eend $? "Timed out"
# fi
|
When I commented out this I got an IP from the dhcp server much faster.
The only drawback is that you can't restart your eth0 with /etc/init.d/eth0 restart (it will complain about a file, if you delete it you can still restart it )
Also, this works for me, maybe it will not work for you. |
|
Back to top |
|
|
seppe Guru
Joined: 01 Sep 2003 Posts: 431 Location: Hove, Antwerp, Belgium
|
Posted: Sun Aug 29, 2004 9:03 pm Post subject: |
|
|
I load everything from the default runlevel in the background.
First I removed xdm from the default level, and moved it too boot level
Code: |
rc-update del xdm
rc-update add xdm boot
|
Then I took a look at /etc/runlevels/default/ to see what is loaded at the default runlevel
Code: |
ls /etc/runlevels/default/
|
Then I added each service from the default runlevel to a new file called /etc/init.d/rc-boot
Code: |
#!/sbin/runscript
depend() {
need net
}
start() {
ebegin "Starting default runlevel"
/etc/init.d/acpid start > /dev/null &
/etc/init.d/bluetooth start > /dev/null &
/etc/init.d/famd start > /dev/null &
/etc/init.d/hotplug start > /dev/null &
/etc/init.d/iwinit start > /dev/null &
/etc/init.d/local start > /dev/null &
/etc/init.d/metalog start > /dev/null &
/etc/init.d/netmount start > /dev/null &
/etc/init.d/vixie-cron start > /dev/null &
}
stop() {
ebegin "Stopping default runlevel"
/etc/init.d/acpid stop > /dev/null &
/etc/init.d/bluetooth stop > /dev/null &
/etc/init.d/famd stop > /dev/null &
/etc/init.d/hotplug stop > /dev/null &
/etc/init.d/iwinit stop > /dev/null &
/etc/init.d/local stop > /dev/null &
/etc/init.d/metalog stop > /dev/null &
/etc/init.d/netmount stop > /dev/null &
/etc/init.d/vixie-cron stop > /dev/null &
}
|
And I removed each service from the default runlevel:
Code: |
rc-update del acpid
rc-update del bluetooth
...
|
Then I added the script to the default level
Code: |
rc-update add rc-boot boot
|
total startup time is now around the 25 seconds _________________ nitro-sources, because between stable and experimental there exists only speed
Latest release I made: 2.6.13.2-nitro1 |
|
Back to top |
|
|
syadnom Guru
Joined: 09 May 2002 Posts: 531
|
Posted: Mon Aug 30, 2004 9:11 am Post subject: another way |
|
|
here is another idea..
how about finding a way to compress all files used for booting the machine.
lets make a highly compressed initrd, so your hd does not need to read as much data(compressed ) and your CPU can do the work
in most circumstances, the CPU is not loaded fery much during boot, the HD is what the slow point is. so if you can get data from the drive faster, the CPU will compensate for the compression and boot times should be improved.
im not sure what compression methods can be used with initrd, but assuming bz2 were ok.
dd if=/dev/null of=/boot/initrd-compressed bs=1k count=4
for a 4k initrd
make an ext2 filesystem using loopback
losetup /dev/loopx /boot/initrd-compressed
mkfs.ext2 /dev/loopx
mount /dev/loopx /mnt/initrdbuild
build your initrd with every file accessed during boot that will fit into initrd, including modules if used/needed.
unmount image and bz2 it up, set that as initrd and try it out.
the more the compression, the faster the initrd will load from disk, the less time the HD will need to be accessed.
this should shave a few seconds off
any thoughts?? |
|
Back to top |
|
|
syadnom Guru
Joined: 09 May 2002 Posts: 531
|
Posted: Mon Aug 30, 2004 9:23 am Post subject: |
|
|
bs=1k should have been bs=1M
also, you can make your initrd larger via a kernel config, any size you wish. i would recommend moving up to 8096 for some room to maneuver.
here is a link to an initrd guide
https://forums.gentoo.org/viewtopic.php?t=193273&highlight=build+initrd
also, gzip is normally used to compress initrds. this may not be optimal and im not sure if this can be changed. you COULD use the --nocompress option on mkinitrd and then compress the initrd file with bz2 afterwards just to check it out. will work on this tomarrow. |
|
Back to top |
|
|
syadnom Guru
Joined: 09 May 2002 Posts: 531
|
Posted: Mon Aug 30, 2004 11:55 pm Post subject: ok |
|
|
just read through the gentoo init guide.
i think the the dependancy resolution causes some slowdown. for scripts that you know need to be run in a certain order, you COULD
rc-update remove foo default
where foo is any and all packages that you know have no dependacies.
then,
cat foo1 foo2 foo3 foo4 foo5 > foo1_2_3_4_5_group
then
rc-update add foo1_2_3_4_5_group default.
go in and edit foo1_2_3_4_5_group, and remove ALL dependancies.(all need= or use=) and add those to the very first entry, so all dependancies are resolved in the first part and the dependacy checks are not repeated.
i would suggest building like scripts. as in put smbd, nfsd, ftpd, sshd in a script with the only dependancy being need="net"
this may help shave seconds off by skiping a lot of the dep checking, |
|
Back to top |
|
|
syadnom Guru
Joined: 09 May 2002 Posts: 531
|
Posted: Mon Aug 30, 2004 11:56 pm Post subject: oh |
|
|
just a thought, above idea is untested!!! |
|
Back to top |
|
|
syadnom Guru
Joined: 09 May 2002 Posts: 531
|
Posted: Mon Aug 30, 2004 11:59 pm Post subject: fyi |
|
|
one could use "softlevels" to test these ideas without risking a nuked system. just create a second 'default' run level called 'testing' and put all your runscripts into theim, full edited and ready to blow, then add a new grub/lilo line of softlevel=testing
this will skip 'default' and use 'testing' instead. |
|
Back to top |
|
|
alligator421 Apprentice
Joined: 30 Jul 2003 Posts: 191
|
Posted: Tue Aug 31, 2004 7:44 am Post subject: |
|
|
Phlogiston. wrote: |
This does not work here
I get this:
Code: | * ERROR: "/etc/init.d/modules" has syntax errors in it; not executing... |
|
Aye. Syntax problem.
It should be read :
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
|
or
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
|
btw I boot 9 s faster with that small modification (45 s instead of 54 s from grub to kdm) with duron 800.
nice tip |
|
Back to top |
|
|
sapphirecat Guru
Joined: 15 Jan 2003 Posts: 376
|
Posted: Tue Aug 31, 2004 4:40 pm Post subject: |
|
|
Phlogiston. wrote: | I managed that xdm is started before other services, but it seems like it waits until the last service is started... I don't know why? Could anybody help me? |
I don't know how to change it, but I can explain what's going on. The xdm script only sets up some things to happen once init gets around to it. See toward the end of /etc/inittab for instance:
Code: | # Used by /etc/init.d/xdm to control DM startup.
# Read the comments in /etc/init.d/xdm for more
# info. Do NOT remove, as this will start nothing
# extra at boot if /etc/init.d/xdm is not added
# to the "default" runlevel.
x:a:once:/etc/X11/startDM.sh |
When the xdm script runs, after init is finished with the rest of the normal stuff, it runs /etc/X11/startDM.sh and leaves a message in the system log to that effect (something about demand-activated services, IIRC.)
Do read the comments in /etc/init.d/xdm; they explain more fully how this works and why it is such a mess. _________________ 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 |
|
|
syadnom Guru
Joined: 09 May 2002 Posts: 531
|
Posted: Thu Sep 02, 2004 5:49 am Post subject: ok |
|
|
all of the login managers use the settings of XDM for when to init. no matter what you do the DM will start AFTER init in most circumstances.
instead of hacking up init, we need SLIGHT modifications
such ass.
move all non-critical services to another runlevel.
move net, netmount, hotplug, etc into a 'postinit' runlevel
in default, add a init script that does a 'init postinit &'
this way, XDM/GDM/KDM will start up just after all of the really important stuff like localmount, but still not destroy the dependancy system gentoo has. this new runlevel will only be run when the system is passed the command 'init postinit &, and it will background it, allowing XDM to start up right after 'default'
then rc-update still works. you just 'rc-update add foo postinit'
i'll try now
--
by the way, make a custom init script that ONLY ran gdm, placed it in the default runlevel with a 'depend() { before *}' and it still waits until init is done. again, this is the DMs looking at XDM config script. |
|
Back to top |
|
|
syadnom Guru
Joined: 09 May 2002 Posts: 531
|
Posted: Thu Sep 02, 2004 6:18 am Post subject: ok |
|
|
so i dont know how to start up another runlevel without dropping the old one.
so here is the plan.
the postinit runlevel needs to have EVERY init script that default does or else when you switch to it all inits that are not in postinit will die.
also, you have to edit /etc/inittab and change the runlevel 4(3,4,5 are all set to default) to postinit.
then make a small init script(i will post one) that initializes the next runlevel by running init 4.
this way, the little remaining in default will start first, and then postinit will start afterwards, but since the default runlevel is complete, XDM should start. ill try now
by the way, im actually not using default as the runlevel to mess up, but have a 'x' runlevel and am using softlevel=x as a kernel param at boot. |
|
Back to top |
|
|
syadnom Guru
Joined: 09 May 2002 Posts: 531
|
Posted: Thu Sep 02, 2004 7:03 am Post subject: ok |
|
|
ok, so here it is
#you must, create a new runlevel in /etc/runlevels
su
mkdir /etc/runlevels/fastboot
#now, copy ALL inits from boot and default into fastboot
cp /etc/runlevels/boot/* /etc/runlevels/fastboot
cp /etc/runlevels/default/* /etc/runlevels/fastboot
#now make a nice safe copy of boot and default
cp -r /etc/runlevels/boot /etc/runlevels/boot.safe
cp -r /etc/runlevels/default /etc/runlevels/default.safe
#now, delete everything from boot runlevel, except localmount and checkfs and checkroot
cd /etc/runlevels/boot
rm foo1 foo2 foo3 foo4
#now edit the localmount, make the ONLY deps
depend() {
need checkroot checkfs
}
# change deps of checkfs to "checkroot"
# change deps of checkrootto "before *"
now edit /etc/inittab and change runlevel 4 to fastboot, you will notice 3 lines that end with default.
now you need to add the line
init 4 &
into your Xsession file at the very end.
---
ok, now your machine will startup with NOTHING, then xdm will start and in the background the rest of init will come up
hopefully
this works on my machine, though it may NOT work on yours
remember, you backed up your original boot and defaults so you can restore your system
all you need to do is copy boot and default back to their original places, then delete the added line to Xsessions and reboot
USE AT YOUR OWN RISK
--
my actual boot time DID NOT IMPROVE, BUT i am at a login prompt in nearly half the time. this make the whole system feel like it booted faster.
--
also, this may not work if you have to load video modules as the modules init is not run until after X is started, BUT you can remove the deps on modules and put it back into the boot runlevel if needed.
--
also, you will now need to use fastboot as your only runlevel when adding things via rc-update
rc-update add foo fastboot
unless you need it in boot, then you can use boot, BUT if it has any deps, they will be loaded, and if the deps have deps, they get loaded and so on, pretty soon everything is starting before XDM again. |
|
Back to top |
|
|
fallingcow n00b
Joined: 11 Apr 2004 Posts: 31
|
Posted: Thu Sep 02, 2004 3:15 pm Post subject: |
|
|
Anyone else have problems with the kernel loading uber slow?
I'm talking about the part right after the bootloader where it's like:
loading linux.................................
I've looked all over and not been able to find anyone else with this problem, and it only happens on my laptop. My other machines all load the kernel in less than 2 seconds, no matter how much crap I compile into it, but my laptop can take 10 seconds or more for a medium-large kernel, with little pauses between each ".". What gives? Even if I move as much functionality to modules as I can, it still takes longer than some of my other boxen with kernels twice as large. I've installed Linux (not necessarily Gentoo, all the time) on some very low-end desktop machines and never seen this happen, and my laptop is only a year old, so I don't think it's a slowdown due to the hardware.
Help? If this has been discussed before, please direct me to the thread, as I've been unable to find it. _________________ Did you exchange a walk on part in the war for the lead role in a cage?
-Pink Floyd |
|
Back to top |
|
|
|