LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   slackware 13.1 speeding up boot time (https://www.linuxquestions.org/questions/slackware-14/slackware-13-1-speeding-up-boot-time-820654/)

H_TeXMeX_H 07-19-2010 05:18 AM

slackware 13.1 speeding up boot time
 
Just some things I changed to speed up the boot time.

In '/etc/rc.d/'

rc.acpid
Code:

    echo "Starting ACPI daemon:  /usr/sbin/acpid &"
    /usr/sbin/acpid &

rc.hald
Code:

    echo "Starting HAL daemon:  /usr/sbin/hald --daemon=yes &"
    /usr/sbin/hald --daemon=yes &

rc.M

Note that commenting out some of these may mess things up, but you can run these commands manually. However, I don't see why this has to be done EVERY BOOT.

Code:

# Update the X font indexes:
#if [ -x /usr/bin/fc-cache ]; then
#  echo "Updating X font indexes:  /usr/bin/fc-cache -f &"
#  /usr/bin/fc-cache -f &
#fi

# Update any existing icon cache files:
#if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then
#  for theme_dir in /usr/share/icons/* ; do
#    if [ -r ${theme_dir}/icon-theme.cache ]; then
#      echo "Updating icon-theme.cache in ${theme_dir}..."
#      /usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1> /dev/null 2> /dev/null &
#    fi
#  done
  # This would be a large file and probably shouldn't be there.
#  if [ -r /usr/share/icons/icon-theme.cache ]; then
#    echo "Deleting icon-theme.cache in /usr/share/icons..."
    #/usr/bin/gtk-update-icon-cache -t -f /usr/share/icons 1> /dev/null 2> /dev/null &
#    rm -f /usr/share/icons/icon-theme.cache
#  fi
#fi

# These GTK+/pango files need to be kept up to date for
# proper input method, pixbuf loaders, and font support.
#if [ -x /usr/bin/update-gtk-immodules ]; then
#  /usr/bin/update-gtk-immodules --verbose
#fi
#if [ -x /usr/bin/update-gdk-pixbuf-loaders ]; then
#  /usr/bin/update-gdk-pixbuf-loaders --verbose
#fi
#if [ -x /usr/bin/update-pango-querymodules ]; then
#  /usr/bin/update-pango-querymodules --verbose
#fi

rc.S

Code:

# Mount non-root file systems in fstab, but not NFS or SMB
# because TCP/IP is not yet configured, and not proc or sysfs
# because those have already been mounted.  Also check that
# devpts is not already mounted before attempting to mount
# it.  With a 2.6.x or newer kernel udev mounts devpts.
# We also need to wait a little bit to let USB and other
# hotplugged devices settle (sorry to slow down the boot):
echo "Mounting non-root local filesystems:"
#sleep 3

Of course you can also use the lilo 'compact' option, and compile a new kernel ... but I bet many will not do that.

Anyway, I'll be away on vacation for a while, so I'll see you later :)

business_kid 07-19-2010 09:05 AM

Have you tried initng?

dimm0k 07-19-2010 10:14 AM

This may come in handy... wanted to cut down on some of the "extra" stuff, but did not have time to look for them.

dugan 07-19-2010 10:48 AM

Woodsman's advice on this:

http://humanreadable.nfshost.com/sdeg/boot_time.htm

vdemuth 07-19-2010 10:52 AM

I moved the GTK immodules updating into a new file and named it rc.update-gtk, and added a call to it from rc.M. This means I just need to chmod it every now and then to run it.

What I would like to do, and it's a pound to a pinch of salt someone here will tell me how, is to run that script automatically, then to somehow have it tagged as having been run, and avoid running it fot the next X number of boots, where X=some arbitrary number I can assign, maybe via a .conf file of some sort.
Anyone any suggestions?

TIA

rmjohnso 07-19-2010 11:35 AM

Quote:

Originally Posted by vdemuth (Post 4038211)
I moved the GTK immodules updating into a new file and named it rc.update-gtk, and added a call to it from rc.M. This means I just need to chmod it every now and then to run it.

What I would like to do, and it's a pound to a pinch of salt someone here will tell me how, is to run that script automatically, then to somehow have it tagged as having been run, and avoid running it fot the next X number of boots, where X=some arbitrary number I can assign, maybe via a .conf file of some sort.
Anyone any suggestions?

TIA

You could always move the script to one of the cron directories and have cron take care of it for you. That's typically what I do.

bgeddy 07-19-2010 06:06 PM

Quote:

What I would like to do, and it's a pound to a pinch of salt someone here will tell me how, is to run that script automatically, then to somehow have it tagged as having been run, and avoid running it fot the next X number of boots, where X=some arbitrary number I can assign, maybe via a .conf file of some sort.
You could try this I've just knocked up :
Code:

#!/bin/bash
SCRIPT=${1:-""}
NUMBOOTS=${2:-10}
CONFFLE=${3:- "/etc/boots.count"}
if [ ! -e $CONFFLE ]
        then
        echo "boots=0" > $CONFFLE
fi
TEST=$(cat $CONFFLE  | sed 's/boots=//' )
let TEST+=1
if [ $TEST -gt $NUMBOOTS ]
        then
        let TEST=$NUMBOOTS
fi
if [ $TEST -eq $NUMBOOTS ]
        then 
        let TEST=0
        sh $SCRIPT

fi
echo "boots=$TEST" > $CONFFLE

It's a simple little bash script that takes another script name, number of boots to cycle (optional - defaults to 10), boot count file (optional - defaults to /etc/boots.count) as parameters. You need to save it somewhere (say /etc/rc.d/rc.boots" and make it executable. Then just substitute your call in /etc/rc.d/rc.M with this and the script name to run. So - to run your rc.update.gtk every 20 boot just put this in /etc/rc.d/rc.M
Code:

/etc/rc.d/rc.boots /etc/rc.d/rc.update-gtk 20"
Note that I have just cobbled this together and done very, very little testing and the script itself does no error checking so beware. It just keeps a count in /etc/boots.count but you could supply differing count files for different boot scripts so they maintain their own count files. This is neccesary as each call of the script treates the associated count file as it's own. If you just have the script to run in that command with a cycle number it defaults to ten boot cycles.

theCapitain 09-21-2010 12:13 PM

Hi,
I've followed the suggestions pointed out in this thread, beside putting in background the start of some daemon I've put part of rc.M into an executable saved in cron.daily like explained by Woodsman obtaining a considerable reduction in boot time. Now I wander if there is a way of knowing if and when this cron's commands are executed … just to be sure that I've done everything properly. Can someone give me instructions?

rob.rice 09-21-2010 12:26 PM

I cut down my boot time on slackware-13.0 by building a monolithic kernel with just the
built-in hardware that's part of my laptop so much so that lsmod returns a blank screen
until I plug something in to a usb port

Richard Cranium 09-21-2010 12:34 PM

I just buy a faster machine.

dimm0k 09-21-2010 12:38 PM

Quote:

Originally Posted by Richard Cranium (Post 4104726)
I just buy a faster machine.

Sounds more like a Windows-specific solution to me...

Richard Cranium 09-21-2010 12:45 PM

Works for slack too.

GazL 09-21-2010 12:49 PM

I just go make coffee while it boots.

easuter 09-21-2010 01:08 PM

Quote:

Originally Posted by GazL (Post 4104741)
I just go make coffee while it boots.

+1.

astrogeek 09-21-2010 01:46 PM

Quote:

Originally Posted by Richard Cranium (Post 4104726)
I just buy a faster machine.

I accept donations of used hardware from rich people :-)

harryhaller 09-21-2010 03:12 PM

man crontab
 
Quote:

Originally Posted by vdemuth (Post 4038211)
What I would like to do, and it's a pound to a pinch of salt someone here will tell me how, is to run that script automatically, then to somehow have it tagged as having been run, and avoid running it fot the next X number of boots, where X=some arbitrary number I can assign, maybe via a .conf file of some sort.
Anyone any suggestions?

Read the crontab man pages and I think you'll find what you are looking for, e.g.:
Quote:

# run every day at 11 am, appending all output to a file
0 11 * * * date >> /var/log/date-output 2>&1
Crontab gives an incredibly fine-grained control over running jobs, including being able to check the last time that a job was run, whether it was run successfully or not, etc.

Code:

man crontab ;)

H_TeXMeX_H 09-21-2010 03:15 PM

Quote:

Originally Posted by theCapitain (Post 4104714)
Hi,
I've followed the suggestions pointed out in this thread, beside putting in background the start of some daemon I've put part of rc.M into an executable saved in cron.daily like explained by Woodsman obtaining a considerable reduction in boot time. Now I wander if there is a way of knowing if and when this cron's commands are executed … just to be sure that I've done everything properly. Can someone give me instructions?

As root, run 'crontab -l'.

I guess I could do that as well and put all of this in cron daily or weekly, but I can also just run it when it is needed.

grissiom 09-22-2010 06:41 PM

Does anyone have ever tried upstart or some thing like that?

GazL 09-22-2010 08:09 PM

No I don't like the Upstart concept. Event driven with rules based on dependencies! I'll pass.

I don't care for the possibility of manually shutting some service down and then finding that it triggers Upstart in to ending something else I didn't necessarily want to stop. The risk and complexity it introduces are simply not worth the 20-40 seconds or so it might save on a boot.


Interestingly, I was just reading about systemd on lwn.net

It seems very clever, but again, perhaps a little too clever. I'll take slow and reliable.

grissiom 09-23-2010 01:11 AM

It seems most slack people don't like dependencies. However, there is dependency in our init system. For example, you cannot run rc.M before rc.S. The root cause we have sequence is dependencies between each component.

But I totally agree that introduce a complex core component in order to save 20~30 sec boot time may not be a good trade. Especially for the one who once boot system up would keep it going for days untill *have* to shut it down. ;) But I think for the people who really seeking for extreme boot up time, you can give upstart a try. (BTW, the boot time of Ubuntu *really* impressed me a lot. It feels only seconds to be into a ready desktop)

For systemd, I heard it has been put off untill FC15. Even Fedora people does not accept it, what else can we do? ;)

mlpa 09-23-2010 02:13 AM

If the tips from here are correct, why don't Pat use it in Slackware by default?

dc_eros 09-23-2010 04:00 AM

I have used that house-cleaning stuff. However, there are times when new libs are newly installed but still the system cannot load that shared lib because the updating takes place once a day - if you set the house cleaning daily.

I have rebooted several times but then I discovered that all I need to do is run ldconfig.

It may be annoying to others when it is included in Slackware by default.

kurtwall 12-11-2010 12:04 PM

All of this work just to shave 30 seconds off the boot time? Unless you're rebooting a couple of dozen times a day at the minimum, is it really worth it? Seriously? Bragging rights for the fastest boot time hardly seems to justify the effort.

H_TeXMeX_H 12-11-2010 02:17 PM

I don't know what my boot time is, but it's fast enough for me :) It was excessively long tho, before I tweaked it.

rg3 12-11-2010 02:54 PM

I almost never boot. I suspend to RAM whenever I leave the computer for more than 3 minutes, and the wake-up time is about 5 seconds. For me, there's no need to change the init sequence when there are other more useful facilities in modern computers.

chrisretusn 12-12-2010 12:14 AM

I've done a couple of those modifications to shorten boot time but decided it's just not worth it. It is usually an after the fact issue that I remember I have to manually update things that should have been accomplish at boot time.

Besides I like watching the boot messages as they go by. :)

brianL 12-12-2010 08:20 AM

I haven't timed my boot-up, but it's fast enough for me. I'm not working against the clock, I had enough of that crap when I was working in machine shops on piece-work.

gnashley 12-12-2010 11:51 AM

Why brianL, nice to hear you were a machinist -as I once was myself.

brianL 12-13-2010 03:40 AM

Quote:

Originally Posted by gnashley (Post 4188854)
Why brianL, nice to hear you were a machinist -as I once was myself.

Yeah, mostly on milling machines.

piratesmack 12-13-2010 08:50 AM

The TuxOnIce kernel patch has sped up hibernate quite a bit for me.
http://tuxonice.net/

It only takes about 10 seconds to resume on my netbook with 1 GB ram (it takes about 30 seconds when using the default 'swsusp')

folkenfanel 12-14-2010 08:11 PM

I move all the stuff I don't need, like updating the icon cache, out...
 
My standard boot time is about 20-25 seconds. I have achieved booting in 14 seconds but then I needed to reload rc.inet1 manually.

retrodanny 02-12-2011 08:35 PM

I was just taking a look at the rc.M script and I noticed this

Quote:

if [ -x /etc/rc.d/rc.pcmcia ]; then
. /etc/rc.d/rc.pcmcia start
# The cards might need a little extra time here to initialize.
sleep 5
fi
is that sleep necessary there? or could I just comment that out without harming the system? It would cut 5 seconds right off

smoooth103 02-12-2011 08:43 PM

How much time does this actually save? like maybe 2-3 seconds? versus the time to actually "make the changes" and make a post about it ;) .. Also, how many times do you reboot?! Typically my uptime is ATLEAST weeks or months...

retrodanny 02-12-2011 09:38 PM

I turn my computer off at night everyday, and I like to see it boot up fast ;) (it's a desktop running on old hardware.. I wouldn't bother if it was brand new.. or if it was a server)

Here's another tip:

The DHCP client daemon takes a little while to get an IP lease from your gateway.. so if you're running a desktop computer I would suggest setting up a static IP address instead. If you don't know what to enter for IPADDR, NETMASK, or GATEWAY in your /etc/rc.d/rc.inet1.conf you can just enter the same that you got from dhcp.. view your IP and subnet mask with
$ ifconfig
you'll see something like this:
Code:

eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx 
          inet addr:192.168.2.100  Bcast:192.168.2.255  Mask:255.255.255.0

my current ip is 192.168.2.100 (inet addr: ) and my subnet mask is default (255.255.255.0)
view your default gateway by doing a traceroute to any site you want (the default gateway will be your first hop, example:
Code:

$ traceroute linuxquestions.org
traceroute to linuxquestions.org (75.126.162.205), 30 hops max, 60 byte packets
 1  DD-WRT (192.168.2.1)  0.601 ms  1.343 ms  1.601 ms

mine is 192.168.2.1

GazL 02-13-2011 05:45 AM

If it's a desktop then you probably won't need rc.pcmcia anyway. chmod -x it and you'll not hit that sleep.

retrodanny 02-13-2011 12:16 PM

Thanks GazL, that worked out nicely. I have a way faster boot time after all these tweaks... I don't see it lag on any process on while booting anymore

H_TeXMeX_H 02-13-2011 12:27 PM

Quote:

Originally Posted by retrodanny (Post 4256614)
I was just taking a look at the rc.M script and I noticed this



is that sleep necessary there? or could I just comment that out without harming the system? It would cut 5 seconds right off

It may be necessary, but you can try it with less and see if it still works. This is assuming, of course that you have PCMCIA devices and rc.pcmcia is executable.

retrodanny 02-13-2011 12:38 PM

Quote:

Originally Posted by H_TeXMeX_H (Post 4257047)
It may be necessary, but you can try it with less and see if it still works. This is assuming, of course that you have PCMCIA devices and rc.pcmcia is executable.

I ran chmod -x on rc.pcmcia like GazL suggested and I rebooted.. It does still work for me.
Thanks for your reply

splintercdo 02-15-2011 09:41 AM

hmm...
1. why putting proccesses in background with &,
is faster, I tried to do that and I don't see any difference in boot speed


2. yeah second advice about commenting out cache update
and advice from http://humanreadable.nfshost.com/sdeg/boot_time.htm about commenting
mime database seems to be logical to increase loading speed, but the funny thing was that after commenting these blocks out my slackware started to boot a bit slower :S I thought about using these advices and if use house cleaning script from link above, it would be cool solution, except the fact that it doesn't work.

May be that is because I did these things in Virtual Box on absolutely newly installed system :S


All times are GMT -5. The time now is 02:34 PM.