You are not logged in.

#26 2009-01-08 20:22:51

Duologic
Member
From: Belgium
Registered: 2007-11-11
Posts: 249

Re: 2 days of tweaking for a faster boot time

I'll do it somewhere tommorow I gues.

Offline

#27 2009-01-08 20:53:04

wavenator
Member
Registered: 2007-12-03
Posts: 62

Re: 2 days of tweaking for a faster boot time

i made my arch boot much faster than before by:
1. recompile kernel, lots of modules removed, fast boot option turned on(zen sources)
2. setting network manually
3. edit xinitab
4. remove some daemons and some modules loading uneeded

the process was not hard
anyway
the result:
before: boot up took about 35-40 secs
now: boot up takes 10-13 secs
unbelievable
arch powa!!

Offline

#28 2009-01-09 00:50:48

R00KIE
Forum Moderator
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 3,382

Re: 2 days of tweaking for a faster boot time

iBertus wrote:

All of this doesn't help me any since my board takes ~45-60 seconds in BIOS before passing on to GRUB. This board (Intel D5400XS) is the slowest booting board that I've ever had.

Still, keep up the good work.

yikes I'm sure you have checked but .... is your board doing a full test on ram before boot? You can safely change it to a fast test .... I have never seen the full test catch anything the fast test couldn't.
If that is the fastest that board can boot it really sucks big time.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#29 2009-01-09 02:01:45

kaola_linux
Member
From: Bacolod City/Philippines
Registered: 2008-09-23
Posts: 513

Re: 2 days of tweaking for a faster boot time

Duologic wrote:
#!/bin/bash
# /etc/rc.shutdown

. /etc/rc.conf
. /etc/rc.d/functions

# avoid staircase effect
/bin/stty onlcr

echo " "
printhl "Initiating Shutdown..."
echo " "

# avoid NIS hanging syslog-ng on shutdown by unsetting the domainname
if [ -x /bin/domainname ]; then
    /bin/domainname ""
fi

if [ -x /etc/rc.local.shutdown ]; then
    /etc/rc.local.shutdown
fi

if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then
    # Shutdown daemons
    let i=${#DAEMONS[@]}
    while [ $i -ge 0 ]; do
        if [ "${DAEMONS[$i]:0:1}" != '!' ]; then
            ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
        fi
        let i=i-1
    done
    # find any leftover daemons and shut them down in reverse order
    if [ -d /var/run/daemons ]; then
        for daemon in $(/bin/ls -1t /var/run/daemons); do
            stop_daemon $daemon
        done
    fi
fi

# Terminate all processes
stat_busy "Sending SIGTERM To Processes"
/sbin/killall5 -15 &> /dev/null
/bin/sleep 5
stat_done

stat_busy "Sending SIGKILL To Processes"
/sbin/killall5 -9 &> /dev/null
/bin/sleep 1
stat_done

stat_busy "Saving Random Seed"
/bin/dd if=/dev/urandom of=/var/run/random-seed count=1 bs=512 2> /dev/null
stat_done

stat_busy "Saving System Clock"
/bin/rm -f /etc/localtime
/bin/cp "/usr/share/zoneinfo/Europe/Brussels" /etc/localtime
/sbin/hwclock --systohc --localtime --directisa
stat_done

# removing psmouse module to fix some reboot issues on newer laptops
/sbin/modprobe -r psmouse >/dev/null 2>&1

# Write to wtmp file before unmounting
/sbin/halt -w

stat_busy "Deactivating Swap"
/sbin/swapoff -a
stat_done

stat_busy "Unmounting Filesystems"
/bin/umount -a -r -t noramfs,notmpfs,nosysfs,noproc
stat_done

stat_busy "Remounting Root Filesystem Read-only"
/bin/mount -n -o remount,ro /
stat_done

# Power off or reboot
if [ "$RUNLEVEL" = "0" ]; then
    printsep
    printhl "${C_H2}POWER OFF"
    /sbin/poweroff -d -f -h -i
else
    printsep
    printhl "${C_H2}REBOOTING"
    # if kexec is installed and a kernel is loaded, use it
    [ -x /sbin/kexec ] && /sbin/kexec -e > /dev/null 2>&1
    /sbin/reboot -d -f -i
fi

# End of file

Will this speed up my shutdown time? I'm having slow shutdown and also restart on my subnotebook which is an acer aspire one...Btw, nice job..:)


Netbook (Acer Aspire One 110 || 160gb SATA HD || 1.5gb ram): archlinux i686 / KDEmod 4.3
Registered Linux User # 481212 / Machine Registration # 390468
"In a world without walls and fences, who needs windows and gates?"

Offline

#30 2009-01-09 08:08:07

Duologic
Member
From: Belgium
Registered: 2007-11-11
Posts: 249

Re: 2 days of tweaking for a faster boot time

the rc.shutdown is mostly for completelyness, I've changed things in other files what broke stuff in rc.shutdown.

Offline

#31 2009-01-09 10:33:06

glad
Member
From: Norway
Registered: 2005-11-01
Posts: 103
Website

Re: 2 days of tweaking for a faster boot time

What about changing the initscripts from Bash to Dash? I've heard that you can increase boot time by doing so by a few secounds;-)
Ofc I might be wrong :-P

Offline

#32 2009-01-09 15:00:52

Duologic
Member
From: Belgium
Registered: 2007-11-11
Posts: 249

Re: 2 days of tweaking for a faster boot time

Sounds great,  never heard of it but read the wikipedia article just now. Didn't had any experience with other shell than bash to be honest.

Offline

#33 2009-01-09 15:08:42

alecmg
Member
Registered: 2008-12-21
Posts: 84

Re: 2 days of tweaking for a faster boot time

Thanks, will definitely try some of these


Xyne wrote:
"We've got Pacman. Wacka wacka, bitches!"

Offline

#34 2009-01-09 15:58:15

EVRAMP
Member
From: Czech Republic
Registered: 2008-10-03
Posts: 173
Website

Re: 2 days of tweaking for a faster boot time

Nice post!
You can also speed up boot (3-5 seconds) by compiling kernel (with PKGBUILD + xconfig it is very easy) - removing modules you dont need and modules you need compile into kernel. Than you will need no modules (and no scanning for autoloading modules) at all, while everything will work. You may also specify your CPU when compiling kernel. This also speeds boot and whole system a bit.

Offline

#35 2009-01-17 23:45:00

Duologic
Member
From: Belgium
Registered: 2007-11-11
Posts: 249

Re: 2 days of tweaking for a faster boot time

I finally contributed this the the wiki: http://wiki.archlinux.org/index.php/Twe … _boot_time
I've also added some additional comments.

Offline

#36 2009-01-18 17:12:52

FaN_OnLy1
Member
From: Montpellier, France
Registered: 2008-09-22
Posts: 126

Re: 2 days of tweaking for a faster boot time

Maybe if someone could help me about this http://bbs.archlinux.org/viewtopic.php?id=63143

we could maybe go below 10 seconds D:

Offline

#37 2009-01-19 02:26:00

hit
Member
From: Estonia
Registered: 2009-01-14
Posts: 79

Re: 2 days of tweaking for a faster boot time

Managed mine to get to 14s (http://www.postimage.org/image.php?v=aV3743mJ).

/sbin/udevadm settle &

This didn't work for me (filesystem didn't mount at all), so I had to remove the ampersand.

Offline

#38 2009-01-19 06:53:41

Duologic
Member
From: Belgium
Registered: 2007-11-11
Posts: 249

Re: 2 days of tweaking for a faster boot time

I found that out pretty soon too, check http://bbs.archlinux.org/viewtopic.php? … 25#p476625
The new version is on the wiki http://wiki.archlinux.org/index.php/Twe … _boot_time

Offline

#39 2009-01-19 08:58:03

hit
Member
From: Estonia
Registered: 2009-01-14
Posts: 79

Re: 2 days of tweaking for a faster boot time

My final result from grub to gnome is 12s (~12-15s).

http://www.postimage.org/image.php?v=Pq327HKJ

Last edited by hit (2009-01-20 01:39:39)

Offline

#40 2009-01-24 06:09:52

mcmillan
Member
Registered: 2006-04-06
Posts: 698

Re: 2 days of tweaking for a faster boot time

In case anybody else wasn't paying attention like me: there's a new version of initscripts in the repository and rc.sysinit and rc.shutdown aren't in the array to be backed up as .pacsave files, so these got overwritten in my upgrade. Figured some other might appreciate a warning to be sure they back up before this upgrade.

Offline

#41 2009-01-24 12:56:46

Duologic
Member
From: Belgium
Registered: 2007-11-11
Posts: 249

Re: 2 days of tweaking for a faster boot time

That's the reason I'd put all these scripts here together. I'm also thinking of rewriting these scripts to make them useable on most systems.

Offline

#42 2009-01-24 17:27:05

joephantom
Member
From: Latinoamérica
Registered: 2008-01-09
Posts: 94
Website

Re: 2 days of tweaking for a faster boot time

Great job. There is plenty info on the web and this forum about tewaking for a faster boot time. It would be great to have all the info in the wiki.

Whenever I have time, and a good mood to screw things up, I will try this smile.

Thanks!


By striving to do the impossible, man has always achieved what is possible. Those who have cautiously done no more than they believed possible have never taken a single step forward - Mikhail Bakunin

Offline

#43 2009-01-24 17:30:59

Kilz
Member
Registered: 2008-03-01
Posts: 140

Re: 2 days of tweaking for a faster boot time

Thank you Duologic

One of the things I like most about Arch is the speed. The instructions were clear enough that this arch newbie was able to cut his boot time in half.


I trust Microsoft about as far as I can comfortably spit a dead rat.
Cinnamon is a wonderful desktop
"Faith is the substance of things hoped for, the evidence of things not seen."

Offline

#44 2009-01-24 17:33:41

Duologic
Member
From: Belgium
Registered: 2007-11-11
Posts: 249

Re: 2 days of tweaking for a faster boot time

Very nice Kilz, thank you for the compliments.

joephantom: maybe make a index of all tweak articles on the wiki, that should inspire other people too to post there articles.

Offline

#45 2009-01-25 09:59:06

tinhtruong
Member
From: Việt Nam
Registered: 2008-12-18
Posts: 109

Re: 2 days of tweaking for a faster boot time

Hello Duologic,
I've got a small problem with my customed rc.sysinit script (based on yours)
I've got a filesystem check failed at boot time, although everything is fine. Here is the rc.sysinit script

#!/bin/bash
#
# /etc/rc.sysinit
#

. /etc/rc.conf
. /etc/rc.d/functions

echo " "
printhl "Arch Linux\n"
printhl "${C_H2}http://www.archlinux.org"
printhl "Copyright 2002-2007 Judd Vinet"
printhl "Copyright 2007-2009 Aaron Griffin"
printhl "Distributed under the GNU General Public License (GPL)"
printsep

# mount /proc, /sys and our RAM /dev
/bin/mount -n -t ramfs none /dev
/bin/mount -n -t proc none /proc
/bin/mount -n -t sysfs none /sys

# Create our default nodes that minilogd may need
/bin/mknod /dev/null c 1 3
/bin/mknod /dev/zero c 1 5
/bin/mknod /dev/console c 5 1

# More initial /dev setup that udev doesn't do
/bin/ln -snf /proc/self/fd /dev/fd
/bin/ln -snf /proc/self/fd/0 /dev/stdin
/bin/ln -snf /proc/self/fd/1 /dev/stdout
/bin/ln -snf /proc/self/fd/2 /dev/stderr
/bin/ln -snf /proc/kcore /dev/core
/bin/mkdir /dev/pts
/bin/mkdir /dev/shm

# start up our mini logger until syslog takes over
/sbin/minilogd

# anything more serious than KERN_WARNING goes to the console
# 'verbose' cmdline parameter enables more messages
if /bin/grep -q " verbose" /proc/cmdline; then
    /bin/dmesg -n 8
else
    /bin/dmesg -n 3
fi

# enable rtc access
/sbin/modprobe rtc-cmos >/dev/null 2>&1
RTC_MAJOR=$(/bin/grep -w rtc /proc/devices 2>/dev/null); RTC_MAJOR="${RTC_MAJOR%% *}"
if [ -n "$RTC_MAJOR" ]; then
    /bin/mkdir /dev/misc/
    /bin/mknod /dev/misc/rtc0 c $RTC_MAJOR 0
    /bin/ln -s /dev/misc/rtc0 /dev/rtc
fi

# Set clock early to fix some bugs with filesystem checks
# Clock is set again later to match rc.conf
if [ -f /etc/localtime ]; then
    /sbin/hwclock --hctosys --localtime --directisa --noadjfile
fi

echo > /proc/sys/kernel/hotplug

if [ -x /sbin/udevadm -a -d /sys/block ]; then
    # We have udev and /sys appears to be mounted, use UDev
    stat_busy "Starting UDev Daemon"
    /sbin/udevd --daemon
    /sbin/udevadm trigger &
    udevstart="$(/bin/date +%s%0N)"
    stat_done
else
    # Static /dev, our last resort
    status "Using static /dev filesystem" true
fi

# run udev uevents
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
    stat_busy "Loading UDev uevents"
    udevstart="$(/bin/date +%s%0N)"    
    /sbin/udevadm settle &
    stat_done
    udevend="$(/bin/date +%s%0N)"
    printhl "   UDev uevent processing time: $((($udevend-$udevstart)/1000000))ms"
fi

# bring up the loopback interface
if [ -d /sys/class/net/lo ]; then
    stat_busy "Bringing up loopback interface"
    /sbin/ifconfig lo 127.0.0.1 up
    if [ $? -ne 0 ]; then
        stat_fail
    else
        stat_done
    fi
fi

status "Mounting Root Read-only" /bin/mount -n -o remount,ro /

FORCEFSCK=
[ -f /forcefsck ] && FORCEFSCK="-- -f"
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk"

if [ -x /sbin/fsck ]; then
    stat_busy "Checking Filesystems"
    if /bin/grep -qw quiet /proc/cmdline; then
        /sbin/fsck -A -T -C -a -t $NETFS $FORCEFSCK >/dev/null 2>&1
    else
        /sbin/fsck -A -T -C -a -t $NETFS $FORCEFSCK 2>/dev/null
    fi
    fsckret=$?
    if [ ${fsckret} -gt 1 ]; then
        stat_fail
        if [ $((${fsckret}&2)) -eq 2 ]; then
            echo
            echo "********************** REBOOT REQUIRED *********************"
            echo "*                                                          *"
            echo "* The system will be rebooted automatically in 15 seconds. *"
            echo "*                                                          *"
            echo "************************************************************"
            echo
            /bin/sleep 15
        else
            echo
            echo "*****************  FILESYSTEM CHECK FAILED  ****************"
            echo "*                                                          *"
            echo "*  Please repair manually and reboot. Note that the root   *"
            echo "*  file system is currently mounted read-only. To remount  *"
            echo "*  it read-write type: mount -n -o remount,rw /            *"
            echo "*  When you exit the maintenance shell the system will     *"
            echo "*  reboot automatically.                                   *"
            echo "*                                                          *"
            echo "************************************************************"
            echo
            /sbin/sulogin -p
        fi
        echo "Automatic reboot in progress..."
        /bin/umount -a
        /bin/mount -n -o remount,ro /
        /sbin/reboot -f
        exit 0
    fi
    stat_done
fi

stat_busy "Mounting Local Filesystems"
/bin/mount -n -o remount,rw /
/bin/rm -f /etc/mtab*
# make sure / gets written to /etc/mtab
/bin/mount -o remount,rw /
# Write /proc, /sys and /dev to /etc/mtab
if [ -e /proc/mounts ]; then
    /bin/grep -e "/proc " -e "/sys " -e "/dev " /proc/mounts >> /etc/mtab
fi
# now mount all the local filesystems
/bin/mount -a -t $NETFS
stat_done

status "Activating Swap" /sbin/swapon -a

/bin/rm -f /etc/localtime
/bin/cp "/usr/share/zoneinfo/Asia/Ho_Chi_Minh" /etc/localtime &
/sbin/hwclock --hctosys --localtime --directisa &
stat_done


if [ -f /var/run/random-seed ]; then
    stat_busy "Initializing Random Seed"
    /bin/cat /var/run/random-seed >/dev/urandom
    stat_done
fi

stat_busy "Removing Leftover Files"
/bin/rm -f /etc/nologin &>/dev/null
/bin/rm -f /etc/shutdownpid &>/dev/null
/bin/rm -f /var/lock/* &>/dev/null
/bin/rm -rf /tmp/* /tmp/.* &>/dev/null
/bin/rm -f /forcefsck &>/dev/null
(cd /var/run && /usr/bin/find . ! -type d -exec /bin/rm -f -- {} \; )
: > /var/run/utmp
/bin/chmod 0664 /var/run/utmp
# Keep {x,k,g}dm happy with xorg
/bin/mkdir /tmp/.ICE-unix && /bin/chmod 1777 /tmp/.ICE-unix
/bin/mkdir /tmp/.X11-unix && /bin/chmod 1777 /tmp/.X11-unix
stat_done

#status "Updating Shared Library Links" /sbin/ldconfig

if [ "$HOSTNAME" != "" ]; then
    status "Setting Hostname: tinh-desktop" /bin/hostname "tinh-desktop" &
fi

status "Updating Module Dependencies" /sbin/depmod -A &

# Flush old locale settings
: >/etc/profile.d/locale.sh
/bin/chmod 755 /etc/profile.d/locale.sh
# Set user defined locale
[ -z "$LOCALE" ] && LOCALE="en_US"
stat_busy "Setting Locale: en_US"
echo "export LANG=$LOCALE" >>/etc/profile.d/locale.sh
stat_done

stat_busy "Setting Consoles to UTF-8 mode"
# UTF-8 consoles are default since 2.6.24 kernel
# this code is needed not only for older kernels,
# but also when user has set vt.default_utf8=0 but LOCALE is *.UTF-8.
for i in $(/usr/bin/seq 0 63); do
    /usr/bin/kbd_mode -u < /dev/vc/${i}
    printf "\e%%G" > /dev/vc/${i}
done
# the $CONSOLE check helps us avoid this when running scripts from cron
echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\e%%G"; fi' >>/etc/profile.d/locale.sh
stat_done
[ -n "$KEYMAP" ] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q -u $KEYMAP

if [ -n "$CONSOLEFONT" ]; then
    stat_busy "Loading Console Font: $CONSOLEFONT"
    #CONSOLEMAP in UTF-8 shouldn't be used
    if [ -n "$CONSOLEMAP" ] && echo "$LOCALE" | /bin/grep -qi utf ; then
        CONSOLEMAP=""
    fi
    for i in $(/usr/bin/seq 0 63); do
        if [ -n "$CONSOLEMAP" ]; then
            /usr/bin/setfont -m $CONSOLEMAP $CONSOLEFONT -C /dev/vc/${i} >/dev/null 2>&1
        else
            /usr/bin/setfont $CONSOLEFONT -C /dev/vc/${i} >/dev/null 2>&1
        fi
    done
    if [ $? -ne 0 ]; then
        stat_fail
    else
        for i in $(/usr/bin/seq 0 63); do
            printf "\e(K" > /dev/vc/${i}
        done
        # the $CONSOLE check helps us avoid this when running scripts from cron
        echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\e(K"; fi' >>/etc/profile.d/locale.sh
        stat_done
    fi
fi

# Save our dmesg output from this boot
if [ -f /var/log/dmesg.log ]; then
    /bin/rm /var/log/dmesg.log
fi
/bin/dmesg > /var/log/dmesg.log

# End of file
# vim: set ts=2 noet:

I don't know why the Filesystem check fail for my case. Any helps are appreciated.
Tinh

Offline

#46 2009-01-25 10:43:10

Duologic
Member
From: Belgium
Registered: 2007-11-11
Posts: 249

Re: 2 days of tweaking for a faster boot time

I never touched the part for filesystem checks, I find that too important to rumble with it.
If something goes on mounting, do a e2fsck on those filesystems from the root command line. Maybe it came with the new kernel, some exotic bug? Just mindstorming...

Offline

#47 2009-01-25 11:05:04

cinan
Member
From: Slovakia
Registered: 2008-07-04
Posts: 251
Website

Re: 2 days of tweaking for a faster boot time

I had same problem as tinhtruong. Delete lines where FS is being checked. I know my FS is without errors, so why I must check it?

Offline

#48 2009-01-25 12:05:49

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: 2 days of tweaking for a faster boot time

I had that problem too, but only after upgrading to kernel 2.6.28. After restoring the original sysinit.rc everything was back to normal.


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#49 2009-01-25 12:08:52

Kilz
Member
Registered: 2008-03-01
Posts: 140

Re: 2 days of tweaking for a faster boot time

cinan wrote:

I had same problem as tinhtruong. Delete lines where FS is being checked. I know my FS is without errors, so why I must check it?

I think its because errors can happen. Its best to check every so often and repair small issues that you may not be aware of before they cause even bigger ones.


I trust Microsoft about as far as I can comfortably spit a dead rat.
Cinnamon is a wonderful desktop
"Faith is the substance of things hoped for, the evidence of things not seen."

Offline

#50 2009-01-25 12:19:37

jelly
Trusted User (TU)
From: /dev/null
Registered: 2008-06-10
Posts: 711

Re: 2 days of tweaking for a faster boot time

I have got a funny result, not autoloading modules and inserting them in rc.conf  in modules=() . Gave me a slowdown of 2 sec. My default boot time with no tweaking gives me a boottime of 18 sec. Would be nice if it where 10 sec. I use gnome and gdm, can i not use gdm to start gnome because i dont need the login manager, but would it be faster?

Offline

Board footer

Powered by FluxBB