Optimize slack boot process / init scripts ?
I've heard it can be very beneficial to change and optimize the init / boot scripts to make Slackware boot faster.
1) Where can I look to get some specific guidance on how to do this ? Or is this a bad idea ? It's just that Slackware seems to take kinda long to boot up. While I'm here, I'd like to also ask this (still about Slackware boot process): 2) I installed Slackware on an old VAIO computer, specs are approximately: Pentium III M - 1.3 Ghz 128 MB RAM 16 MB ATI Radeon - M :( 40 GB HDD The problem is it takes forever to boot. It gets really slow in the early booting process, when it is "Checking BIOS integrity" and then the dots '.............................................' appear really really really slow. Why ? What is it doing that is taking this long ? I've always though it's loading the kernel into RAM ... is this so ? How can I make it boot faster, if at all possible ? Of course, changing the init scripts will also be helpful, cuz that takes a while too. Thanks. |
Have you recompiled your kernel selecting specific options to reflect your hardware?
I had the same thing when I would recompile and select options that my system didnt support, as for specifics I couldnt tell you. What kernel are you using? Or which one did you select when you installed? |
Kernel on both my current machine and the older one is huge26.s.
I was thinking of recompiling, but I usually don't like to unless I really have to. They are both laptops. I was thinking of trying a 2.4.x kernel to see if it would speed things up, but it has a usb mouse, and I've had problems with the 2.4.x kernel and usb mice. Maybe I'll try. I don't have access to the older computer right now, so I can't do much there. But I can optimize things here on my newer laptop. (I'm not going to recompile a 2.4.x kernel, I would like to use a 2.6.x kernel for many many reasons ... maybe I'll recompile that, but not right now) |
To clarify, the slowest part is when it says:
Code:
Loading Linux...................................................... Each dot takes 5 seconds to appear ... which is insane if you ask me. So any ideas on why it would boot so slow ? Is this when it is loading the kernel into RAM ? If so, maybe the HDD is really slow at being read, or the RAM isn't working properly ? (I'll check that RAM with memtest when I next have access to that computer, and I'll check the HDD to make sure DMA is enabled if that matters) |
Do you maybe have the "nodma" or "noacpi" boot options?
|
Let us know how the memory and the HD are but I tend to think that if you don't have any problems except loading the kernel then it might be something with the kernel. This is where the kernel is loaded into RAM, yes. You might have to check around your kernel config to see if there's anything funky in there.
In my honest opinion you might have to recompile the kernel if for any reason to have a slimmer kernel so that it's not loading as much information into RAM. It's not completely impossible that there's some driver in there that might be "confusing" things when drivers get loaded for the disk or the processor. You may also want to Code:
lilo -t -v EDIT: jschiwal brings up a good point. What's being passed to the kernel at boot? |
Quote:
I'll do the following when I get there and post back results (note that it will take ~ 1 mo. to get back to the other computer ... it's at my other house) 1) Check RAM with memtest 2) Check HDD for DMA enabled 3) Dry run lilo and see if it reports errors 4) Recompile kernel :( (I'll probably try 2.4.x and see if usb mouse works, if so then I'll use that) |
The fact that it is hangin on boot.......... shows there is something wrong on your kernel compilation. Seriously, stay away from huge26.s!!! I use it only when I want to find out what modules I need for specific hardware. Just recompile kernel (it hardly takes 15-20 mins) and it will save you many many hours if you configure it correctly.
If you don't want to recompile the kernel, use 2.6.18 kernel packages from the DVD/testing. Changing the boot scripts won't make any difference in above. But anyways , see my thread http://www.linuxquestions.org/questi...d.php?t=499631 . There is a pretty long discussion there , I got my boot-up time right now to 25 secs which is pretty okay (and I have included all of what I need). Prefer 2.6 for kernel recompilation, no need to make dependencies etc. (much much easier). to check for dma : hdparm /dev/hda | gerp dma And btw, you used the word "optimize", that can only be done with kernel recompile. Other methods may just reduce no. of services etc.(like sendmail/httpd/mysqld) |
Quote:
Ok, I'll recompile the kernel. Only one question ... this is a laptop, and I don't know much about the hardware inside, I only have what standard hardware probing commands can provide. How would I go about compiling a kernel with only exactly what I need compiled in ? Is there any way to get specific info, or as much info as I need on the hardware of this computer and which parts of the kernel go with which hardware ? (I had problems doing this the last time I wanted to compile a minimal kernel like this ... I must have left some things out or put other things in) |
Update: thanks again for that link and info ... that literally cut my boot time in half ... about 20 sec now :D (ok, more like 38 sec (because it must load hplip and nvidia kernel module otherwise it would be less than 30 sec), but it's a lot faster than before ... it took about 1 min + before)
What I did was move '/sbin/ldconfig' and '/usr/X11R6/bin/fc-cache' calls from 'rc.M' to 'rc.local_shutdown' ... does the same thing really, only at shutdown not startup. Also commented out 'atd' and 'gpm' as they take long to startup and I rarely use them, if I need them I start them manually. Made hotplug un-executable as it is not really needed by anything. And I put an '&' after dhcpcd call, which was also a slow starter ... seems to work just fine (and I see no reason why it shouldn't ... I don't care when it sorts out my dynamic IP, it's probably gonna be before I use the internet anyway). Now for the kernel ... |
Quote:
Second: For options not related to drivers it's basicly googleing, and trial and error. Read the help available during menuconfig. Those "if unsure say Y/N" messages are really helpful for newbs. |
ok, thanks ... seems like it's gonna take a while to get down exactly what I need ... well, I'll work on it when I have time and tweak it until I get it ... seems that's the only way.
Thank you all for your responses :D |
Also, look up the exact motherboard model number by Google, check out the hardware it comes with.
Use the 'compact' option in LILO if your system will allow it. and third, append 'idebus=66' into your LILO as well, if you see in dmesg "assuming idebus is 33Mhz" and you know that your IDE bus can go faster than that. When I changed my IDE bus to boot at 66Mhz, it lopped better than 60% off by boot time. |
Quote:
Quote:
But good news, I recomplied my kernel and now it's 1/3 the size it was before ... 1MB as opposed to 3MB. This greatly increases boot up time. Now the entire boot process takes 45 sec from the time I hit the on button. I feel that maybe I can get it even lower, but that maybe the time invested it such an action may be too much right now. Maybe during spring break or the summer I'll mess around with it. |
for compiling your kernel and about how to check your hardware etc. etc. see :
http://www.kroah.com/lkn/ And also look at Shilo's guide - Making it scream. |
Thanks, I've been to that site before, but forgot about it. It must have been on my other computer.
|
[quote]Not sure about compact, but I feel the 'idebus=xxx" might be a tad unsafe. Especially without detailed info on my system.{/quote]
Compact can conflict with 'LBA=32' depending on your drive. Not sure if I'd call it unsafe or not. It's a commonly used option. But as far as the IDE setting, (I've tried this) setting it to a value that is too high just returns a message in dmesg saying "Bad IDE value - too high" and it resorts to 33Mhz, the default. I have mine at 66, but when I tried upping it to 100 (and I have a UDMA 133Mhz capable bus) it just told me it was a bad setting and booted at 33 Mhz. I think it's safe to assume (yeah I know the adage) that virtually any modern computer is capable of 66Mhz on the IDE. Again, if it doesn't work or is invalid, it will just tell you so and default to normal. :) I'm not too familiar with laptops in general, but surely by starting with the manufacturer you could narrow down the model number and motherboard possibilities/options. |
Well, I found this:
http://www.ale.org/archive/ale/ale-2.../msg00188.html Which says: Quote:
http://www.ale.org/archive/ale/ale-2.../msg00198.html Quote:
EDIT: Quote:
|
Indeed interesting and confusing.
I arrived at the idebus=66 setting because dmesg informed me that the kernel was 'assuming' a 33Mhz bus speed, and to use the setting 66 to change it. Which I did. On a related note, while my IDE bus is capable of UDMA (Ultra DMA 133Mhz) I cannot infact apply this setting during boot, it just wont work. I get the impression that the machine must be fully booted before UDMA can be activated. It also told me that valid settings (LILO said this) were between 20 and 66 Mhz for the idebus= function.. For the record, it seems they are referring to older and slower computers too, with the references to P100 and P133 etc.. My PCI/AGP bus is set at AUTO (usually a 66/33 ratio) and an FSB speed of 122 MHz (I am overclocking but not drastically so--- My puter is a 1.8Ghz Intel P4 currently running at 2.2Ghz. In the end, I'm just offering suggestions :) but not suggesting you risk your hardware; do what is safest for your machine until you learn what it can handle! But I do love the wicked boot speed allowed by the increased bus speed ;) Sasha |
Quote:
Take careful notes of what you're removing. Keep backups of previous successfully-bootable kernels. Shave off just a few bits of cruft at a time. On a P-III, it could cost you a few hours of compile time, but it will save you memory and it will save you precious minutes of boot time! :D |
Compiling your own kernel is a Fine Thing To Do.
I just want to point out that huge26 is not the only 2.6 possibility in Slackware for those who are wary of compiling your own kernel. The extra/ directory has a reasonably sized 2.6.17 kernel with modules and testing/ provides a 2.6.18 kernel. Brian |
Quote:
Next I plan on doing "make allmodconfig" and then adding JFS built-in (static) support. Then see which modules I really need, make (recompile) those static, get rid of the rest, and it hopefully will result in a very small kernel capable of everything I need it for. (really I could just leave the modules there in case I install or change out hardware) |
Quote:
Brian |
Quote:
|
Hmmm. Frankly, I can't remember the last time my kernel panicked and I compile everything as a module that I can, except the fs support.
Brian |
Quote:
|
Quote:
|
There are also some really nice aspects of modules vs. static. For example, my wifi card doesn't always like to change from one encrypted network to another. So I simply rmmod the module and then modprobe it again and I'm set to go. If it was compiled statically I couldn't do that. Also, modules can help you troubleshoot hardware issues because you can use lsmod to see what modules loaded when you plug something in. Also, when seeking help on, eg. this board, someone might ask "Do you have module Z loaded?", and if you have everything statically compiled you will not be able to respond. Also...
Brian |
Quote:
@ BCarey Sounds great ... I'll try it now. EDIT: Update: Compiling using mostly modules only saves ~100 KB from kernel size. I'll have to look up my exact hardware ... that will take too long and will have to wait until I have time and am bored enough to do it. |
huge26.s is huge everything compiled in, did you made initrd for non ext2/3 filesystems?
i hope for your configuration bare.i will work, just copy the kernel bzimage, edit lilo run lilo, very easy and feel the difference |
Hi,
After reading the entire post, I find that the problem initially was the use of the huge26.s. You should read the release notes. This would help the 'OP' a lot. Trimming the kernel would give you an increase of boot performance on the loading of the kernel to ram, especially using the huge26.s kernel on older hardware. Your hardware is not that old. What is the hard disk specifications other than '40GB'. This could be a lot of the load bottle neck. Also the amount of ram could be increased to better the load. |
Quote:
P.S. As I said above I trimmed the kernel to 1/3 the size of huge26.s ... more can be done ... but not enough time right now. |
Quote:
Who's talking about Windows? No need to insult! From a console do; Code:
#hdparm -I /dev/hda #replace /dev/hda with your device As for your ram statement, then why ask for help. Yes, increasing the ram would be better. The amount really depends on how you use your system. If you want to increase performance then look at using ramdisks via media such as ide, sata or scsi. Of course you would then have to increase the ram for a ramdisk, be it virtual or static. Glad to help but won't do the work for you! |
Quote:
Well, I can't post info from my older laptop (it is ~300 miles away from me ... maybe in 2-4 weeks), but maybe you can help speed up my newer one ... it's pretty fast, but still takes ~47 sec to boot (I say 30 sec is attainable with enough tweaking ... and lots of time to spend). I'll look into tweaking the kernel later today ... Code:
/dev/hda: |
Why are we stuck over here??
WE already discussed this! Recompile your kernel. By removing unnecassary rc.<somethings> you at most bring it down to 30 secs. I recompiled my kernel and on 2.6.20 I am on 20secs boot-up time,WITH MOST of my requirements built in (not modules). It hardly takes anytime to recompile. Read the LKN book I told ya earlier abt. |
Hi,
The 60GB drive is functioning at 'udma5'. The drive is a 4200 rpm drive with only 2mb buffer. The drive multisector is not set, try the 'hdparm -m 16 /dev/hda', you might have to start at a lower setting (2,4,8,16) for the drive. Code:
Capabilities: You could speed up the process for this laptop with new HD hardware. As for the 40GB on the other laptop, just issue the 'hdparm -I /dev/hda' to find if you can tweak it. |
Quote:
I'll post again when I got a hold of my older laptop. Thanks all :) |
onebuck,
Very interesting, thank you. H_TeXMeX_H, Why did you put it in rc.M instead of rc.S? Brian |
Quote:
|
Quote:
Personally I have separate partitions for a number of directories, eg. /home. This takes time during the boot process as it checks each partition, replays journals as necessary, etc. All this activity precedes rc.M, so I was thinking it would be best, if possible, to issue this command before all that checking and mounting activity. Brian |
Quote:
|
Ok, I now have access to the machine and have done the following:
1) memtest86+, newest version, it ran several times and reported no errors. 2) more info on the HDD Code:
hdparm -i /dev/hda Is that just the best this machine can do ? It might be I guess. But, if anyone has any ideas, please tell me. |
Another thing to check for folks looking to speed up boot and other IDE related stuff, is to look into your BIOS. I have an AMIBIOS, which offers selections for 16 bit and 32 bit datalength on the IDE IO bus. 16 is the default setting, but, you guessed it, setting the speed to 32 really made a difference!
|
H_TeXMeX_H, I have this same problem with my laptop. From what i have been able to find out the reason it is so slow is because when lilo loads the computer is still in a "failsafe" mode and not running the cpu at full speed. The only workaround i have found was to run grub instead of lilo.
|
Quote:
So, let's see, switching to grub actually shaved off more like 18 sec., and then I decided to compile and optimize the kernel even more, which shaved off another 3 sec. :) So, now boot time is 45-48 sec (it was 1 min to 1 min 10 sec before using grub) ... kinda varies, but it's a lot better than when I started. I didn't time it well (I should have), but it was about 1 min 30 sec before any optimizations. @ GrapefruiTgirl I looked through the BIOS options, but unfortunately there is nothing performance related in there, not on this computer. On my desktop there is, but not on this old laptop. Oh, well. Thanks anyway. @ onebuck I was wrong, the computer actually has 256 MB RAM :) So, it should be good for anything but Window$. In fact, XP used up an amazing 200 MB RAM, or there was 40-56 MB free :eek: Really, I checked ... should have taken a screenshot of it. Thanks again all :) |
Fantastic, I am glad we got this solved all thought I wish I could get it to work with lilo but thats just me I hate loose ends.
|
Maybe you can try the 'compact' option in lilo.conf ? Technically it doesn't always work. Either way, I installed grub on my desktop too and it boots in 29 sec (saved 2 sec off lilo boot time of 31 sec). (now, my desktop is much more powerful than the old laptop)
|
I don't wanna go off topic, but...
I have to :D Quote:
I btw second duryodhans suggestions concerncing rc-scripts. These fellers can save you some more boot time if you tweak them a little. You for example don't need fontconfig on boot time unless you just installed fonts, you could disable cron and atd and so forth... |
Well my RAM usage varies with what I'm doing. With fluxbox running, it's usually between 22-50 MB (usually just watching movies, viewing images) unless I run firefox ... like now ... and then it's 90 MB (at this very moment) or up to 100 MB or so if I visit many pages and use it for hours. If I open lots of stuff, it might go above 100 MB, but usually no. Now I restarted FF and it's down to 59 MB used. Games also use more memory. Scanned images can take all my RAM (1 GB).
Either way, 90 % of the time, when I check RAM usage it is under 100, or slightly above. |
Looks like you've been quite successful in tweaking your machine... Would you mind posting your ps aux and/or sum up a little bit what you did? This might be a nice howto I suppose some people would be interested in (including me as you already noticed :D)
|
All times are GMT -5. The time now is 07:54 PM. |