from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites: www.linuxhowtos.org
toolsntoys.linuxhowtos.org



Last additions:
How to make X listen on port 6000

How to make X listen on port 6000

words:

34

views:

84061

userrating:

average rating: 1.2 (52 votes) (1=very good 6=terrible)


May, 25th 2007:
April, 26th 2007:
Apr, 10th. 2007:
Druckversion . pdf icon
You are here: Misc

Speeding up the boot process (next generation)

The idea is to preload the useful files into kernel buffer cache before they are needed. Since I/O can happen parallel to the other CPU intensive tasks during bootup, this leads to faster bootup and faster startup time for your chosen applications. Other projects use static lists to preload the files.

This tutorial uses an automated process of generating the "useful" prefetch database.

This is /etc/init.d/my-readahead.
Code:

#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {
        before syslog-ng
}

start() {
        ebegin "Starting readahead ROYALE"
        cat /etc/conf.d/* > /dev/null 2>&1 &
        cat /usr/lib/gconv/gconv-modules.cache > /dev/null 2>&1 &
        cat /usr/share/icons/gnome/icon-theme.cache > /dev/null 2>&1 &
        cat /usr/share/icons/hicolor/icon-theme.cache > /dev/null 2>&1 &
        cat `cat /etc/conf.d/sofile-list.load` > /dev/null 2>&1 &
        if [ -f /forcesampler ];then
                /usr/sbin/sample-init-process /etc/conf.d/sofile-list.load &
                rm -f /forcesampler
        fi 
        eend 0
}

stop() {
        eend 0
}

The executable shell script /usr/sbin/sample-init-process:
Code:

 #!/bin/bash
final_db="$1"

# total number of lists to keep in /etc/conf.d/
total_to_keep=4

# total number of samples to make in /forcesampler boot.
# It will take twice this amount of seconds to finish sampling.
total_samples_per_boot=200

# touch empty file if not there
[ ! -f "$final_db" ] && touch "$final_db"

let i=0
while [ "$i" -ne "$total_to_keep" ] ; do
        if [ ! -f "$final_db$i" ] ; then
                break;
        else
                j=$((i+1))
                if [ "$j" = "$total_to_keep" ] ;then
                        j=0
                fi
                if [ -f "$final_db$j" -a "$final_db$i" -nt "$final_db$j" ];then
                        i=$((j))
                        break;
                fi
        fi
        i=$((i+1))
done
if [ "$i" = "$total_to_keep" ] ;then
        i=0
fi

slot="$i"
cp "$final_db" "$final_db$i"

function collect_sample()
{
        lsof | awk '{if ($5=="REG") {if (match($9,".so") || match($9,".conf") \
        || match($9,"/bin/") || match($9,"ttf") || match($9,"libexec")) \
        print $9}}' | sort | uniq >> $1
}

collect_sample /tmp/init_sample1

i=0 
while [ "$i" -ne "$total_samples_per_boot" ] ; do
        collect_sample /tmp/init_sample2
        cat /tmp/init_sample1 /tmp/init_sample2 | sort | uniq > /tmp/init_sample3
        mv /tmp/init_sample3 /tmp/init_sample1
        sleep 1
        i=$((i+1))
done

cat /tmp/init_sample1 "$final_db$slot" | sort | uniq > "$final_db"

rm -f /tmp/init_sample[123]
And then do this:
Code:
chmod +x /usr/sbin/sample-init-process
rc-update add my-readahead default
touch /forcesampler

What you have done is asked my-readahead to create a sampler process which samples what files (fonts, binaries, libraries, configs) are in use, every second. It collects 200 samples (will be busy for at least 10 minutes after boot) and keeps updating the database with a list of useful files.

Once you boot after this the first time, you will probably see a slow down because its collecting samples for use on the next and subsequent boots. Use your system as you normally would. Open firefox, gaim, OO or whatever. Once the sampler script has finished ('ps -aef|grep sample-init-process' will tell you if its running), reboot. Now this and all subsequent boots will be much faster.

If it takes too long for the sample-init-process to finish, reduce the total_samples_per_boot variable in the sampler script to 100 and try again by touching /forcesampler.

In future, whenever you feel like updating the prefetch database, just 'touch /forcesampler' and database will be updated on next reboot.

based on http://forums.gentoo.org/viewtopic-t-478491.html, some script modifications done.

back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2026-03-28
dash - 2.18.2
Ebuild name:

sci-visualization/dash-2.18.2

Description

Python framework for building ML & data science web apps

Added to portage

2026-03-28

dash - 3.0.4
Ebuild name:

sci-visualization/dash-3.0.4

Description

Python framework for building ML & data science web apps

Added to portage

2026-03-28

dash - 3.1.1
Ebuild name:

sci-visualization/dash-3.1.1

Description

Python framework for building ML & data science web apps

Added to portage

2026-03-28

dash - 3.2.0
Ebuild name:

sci-visualization/dash-3.2.0

Description

Python framework for building ML & data science web apps

Added to portage

2026-03-28

dash - 3.3.0
Ebuild name:

sci-visualization/dash-3.3.0

Description

Python framework for building ML & data science web apps

Added to portage

2026-03-28

dash - 3.4.0
Ebuild name:

sci-visualization/dash-3.4.0

Description

Python framework for building ML & data science web apps

Added to portage

2026-03-28

deno-bin - 2.7.9
Ebuild name:

dev-lang/deno-bin-2.7.9

Description

Modern runtime for JavaScript and TypeScript

Added to portage

2026-03-28

element - 1.12.13
Ebuild name:

www-apps/element-1.12.13

Description

A glossy Matrix collaboration client for the web

Added to portage

2026-03-28

glibc - 2.42-r6
Ebuild name:

sys-libs/glibc-2.42-r6

Description

GNU libc C library

Added to portage

2026-03-28

glibc - 2.43-r1
Ebuild name:

sys-libs/glibc-2.43-r1

Description

GNU libc C library

Added to portage

2026-03-28

mingw64-runtime - 14.0.0
Ebuild name:

dev-util/mingw64-runtime-14.0.0

Description

Free Win64 runtime and import library definitions

Added to portage

2026-03-28

mingw64-toolchain - 14.0.0
Ebuild name:

dev-util/mingw64-toolchain-14.0.0

Description

All-in-one mingw64 toolchain intended for building Wine without c

Added to portage

2026-03-28

picard - 3.0.0_alpha4-r2
Ebuild name:

media-sound/picard-3.0.0_alpha4-r2

Description

Cross-platform music tagger

Added to portage

2026-03-28

vivaldi - 7.9.3970.45
Ebuild name:

www-client/vivaldi-7.9.3970.45

Description

A browser for our friends

Added to portage

2026-03-28

vivaldi-snapshot - 7.10.3989.3
Ebuild name:

www-client/vivaldi-snapshot-7.10.3989.3

Description

A browser for our friends

Added to portage

2026-03-28

2026-03-27
awscli - 1.44.67
Ebuild name:

app-admin/awscli-1.44.67

Description

Universal Command Line Environment for AWS

Added to portage

2026-03-27

bind - 9.18.47
Ebuild name:

net-dns/bind-9.18.47

Description

Berkeley Internet Name Domain - Name Server

Added to portage

2026-03-27

bind - 9.20.21
Ebuild name:

net-dns/bind-9.20.21

Description

Berkeley Internet Name Domain - Name Server

Added to portage

2026-03-27

boto3 - 1.42.77
Ebuild name:

dev-python/boto3-1.42.77

Description

The AWS SDK for Python

Added to portage

2026-03-27

botocore - 1.42.77
Ebuild name:

dev-python/botocore-1.42.77

Description

Low-level, data-driven core of boto 3

Added to portage

2026-03-27

caffe2 - 2.11.0-r1
Ebuild name:

sci-ml/caffe2-2.11.0-r1

Description

A deep learning framework

Added to portage

2026-03-27

check-jsonschema - 0.37.1
Ebuild name:

app-misc/check-jsonschema-0.37.1

Description

A CLI and set of pre-commit hooks for jsonschema validation

Added to portage

2026-03-27

chrome-binary-plugins - 147.0.7727.24_beta
Ebuild name:

www-plugins/chrome-binary-plugins-147.0.7727.24_beta

Description

Binary plugins from Google Chrome for use in C

Added to portage

2026-03-27

chromium - 147.0.7727.24
Ebuild name:

www-client/chromium-147.0.7727.24

Description

Open-source version of Google Chrome web browser

Added to portage

2026-03-27

claude-code - 2.1.85
Ebuild name:

dev-util/claude-code-2.1.85

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-03-27

cookiecutter - 2.7.1
Ebuild name:

dev-util/cookiecutter-2.7.1

Description

Command-line utility to create projects from cookiecutters (project tem

Added to portage

2026-03-27

deadbeef - 1.10.2
Ebuild name:

media-sound/deadbeef-1.10.2

Description

DeaDBeeF is a modular audio player similar to foobar2000

Added to portage

2026-03-27

dovecot - 2.4.3
Ebuild name:

net-mail/dovecot-2.4.3

Description

An IMAP and POP3 server written with security primarily in mind

Added to portage

2026-03-27

dracut - 110-r4
Ebuild name:

sys-kernel/dracut-110-r4

Description

Generic initramfs generation tool

Added to portage

2026-03-27

ecdsa - 0.19.2
Ebuild name:

dev-python/ecdsa-0.19.2

Description

ECDSA cryptographic signature library in pure Python

Added to portage

2026-03-27

ecl - 26.3.27
Ebuild name:

dev-lisp/ecl-26.3.27

Description

ECL is an embeddable Common Lisp implementation

Added to portage

2026-03-27

epson-inkjet-printer-escpr - 1.8.8
Ebuild name:

net-print/epson-inkjet-printer-escpr-1.8.8

Description

Epson Inkjet Printer Driver (ESC/P-R)

Added to portage

2026-03-27

fotocx - 26.2-r1
Ebuild name:

media-gfx/fotocx-26.2-r1

Description

Program for improving image files made with a digital camera

Added to portage

2026-03-27

fotocx - 26.3-r1
Ebuild name:

media-gfx/fotocx-26.3-r1

Description

Program for improving image files made with a digital camera

Added to portage

2026-03-27

gitui - 0.28.1
Ebuild name:

dev-vcs/gitui-0.28.1

Description

blazing fast terminal-ui for git

Added to portage

2026-03-27

google-chrome-beta - 147.0.7727.24
Ebuild name:

www-client/google-chrome-beta-147.0.7727.24

Description

The web browser from Google

Added to portage

2026-03-27

googleapis-common-protos - 1.73.1
Ebuild name:

dev-python/googleapis-common-protos-1.73.1

Description

Python classes generated from the common protos in the g

Added to portage

2026-03-27

gunicorn - 25.3.0
Ebuild name:

www-servers/gunicorn-25.3.0

Description

A WSGI HTTP Server for UNIX

Added to portage

2026-03-27

intellij-idea - 2026.1
Ebuild name:

dev-util/intellij-idea-2026.1

Description

A complete toolset for web, mobile and enterprise development

Added to portage

2026-03-27

jaq - 3.0.0
Ebuild name:

app-misc/jaq-3.0.0

Description

Just another JSON query tool

Added to portage

2026-03-27

libwebsockets - 4.5.8
Ebuild name:

net-libs/libwebsockets-4.5.8

Description

A flexible pure-C library for implementing network protocols

Added to portage

2026-03-27

mattermost-desktop-bin - 5.13.5
Ebuild name:

net-im/mattermost-desktop-bin-5.13.5

Description

Mattermost Desktop application

Added to portage

2026-03-27

microsoft-edge-beta - 147.0.3912.26
Ebuild name:

www-client/microsoft-edge-beta-147.0.3912.26

Description

The web browser from Microsoft

Added to portage

2026-03-27

nextcloud - 32.0.7
Ebuild name:

www-apps/nextcloud-32.0.7

Description

Personal cloud that runs on your own server

Added to portage

2026-03-27

nextcloud - 33.0.1
Ebuild name:

www-apps/nextcloud-33.0.1

Description

Personal cloud that runs on your own server

Added to portage

2026-03-27

nextcloud-client - 33.0.0-r1
Ebuild name:

net-misc/nextcloud-client-33.0.0-r1

Description

Desktop Syncing Client for Nextcloud

Added to portage

2026-03-27

nginx - 1.28.3
Ebuild name:

www-servers/nginx-1.28.3

Description

Added to portage

2026-03-27

nginx - 1.29.7-r1
Ebuild name:

www-servers/nginx-1.29.7-r1

Description

Added to portage

2026-03-27

oct2py - 6.0.1
Ebuild name:

dev-python/oct2py-6.0.1

Description

Python to GNU Octave bridge

Added to portage

2026-03-27

openpgp-keys-gentoo-developers - 20260323
Ebuild name:

sec-keys/openpgp-keys-gentoo-developers-20260323

Description

Gentoo Authority Keys (GLEP 79)

Added to portage

2026-03-27

opensmtpd - 7.8.0_p1
Ebuild name:

mail-mta/opensmtpd-7.8.0_p1

Description

Lightweight but featured SMTP daemon from OpenBSD

Added to portage

2026-03-27

opera - 129.0.5823.28
Ebuild name:

www-client/opera-129.0.5823.28

Description

A fast and secure web browser

Added to portage

2026-03-27

orage - 4.20.3
Ebuild name:

app-office/orage-4.20.3

Description

A calendar application for Xfce

Added to portage

2026-03-27

peewee - 4.0.3
Ebuild name:

dev-python/peewee-4.0.3

Description

Small Python ORM

Added to portage

2026-03-27

proto-plus - 1.27.2
Ebuild name:

dev-python/proto-plus-1.27.2

Description

Beautiful, Pythonic protocol buffers

Added to portage

2026-03-27

python-discovery - 1.2.1
Ebuild name:

dev-python/python-discovery-1.2.1

Description

Python interpreter discovery

Added to portage

2026-03-27

radarr-bin - 6.1.2.10359
Ebuild name:

www-apps/radarr-bin-6.1.2.10359

Description

A fork of Sonarr to work with movies a la Couchpotato

Added to portage

2026-03-27

ruff - 0.15.8
Ebuild name:

dev-util/ruff-0.15.8

Description

An extremely fast Python linter, written in Rust

Added to portage

2026-03-27

setuptools-rust - 1.12.1
Ebuild name:

dev-python/setuptools-rust-1.12.1

Description

A plugin for setuptools to build Rust Python extensions

Added to portage

2026-03-27

setuptools-scm - 10.0.3
Ebuild name:

dev-python/setuptools-scm-10.0.3

Description

Manage versions by scm tags via setuptools

Added to portage

2026-03-27

sybil - 10.0.1
Ebuild name:

dev-python/sybil-10.0.1

Description

Automated testing for the examples in your documentation

Added to portage

2026-03-27

tigervnc - 1.16.2
Ebuild name:

net-misc/tigervnc-1.16.2

Description

Remote desktop viewer display system

Added to portage

2026-03-27

tigervnc-xorg-module - 1.16.2
Ebuild name:

net-misc/tigervnc-xorg-module-1.16.2

Description

Metapackage for the xorg module provided by tigervnc

Added to portage

2026-03-27

transformers - 5.0.0
Ebuild name:

sci-ml/transformers-5.0.0

Description

State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow

Added to portage

2026-03-27

uv - 0.11.2
Ebuild name:

dev-python/uv-0.11.2

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-03-27

uv-build - 0.11.2
Ebuild name:

dev-python/uv-build-0.11.2

Description

PEP517 uv build backend

Added to portage

2026-03-27

vanilla-sources - 6.12.79
Ebuild name:

sys-kernel/vanilla-sources-6.12.79

Description

Full sources for the Linux kernel

Added to portage

2026-03-27

xdoctest - 1.3.2
Ebuild name:

dev-python/xdoctest-1.3.2

Description

A rewrite of Python's builtin doctest module but without all the weirdnes

Added to portage

2026-03-27

xfdesktop - 4.20.2
Ebuild name:

xfce-base/xfdesktop-4.20.2

Description

Desktop manager for the Xfce desktop environment

Added to portage

2026-03-27

rdf newsfeed | rss newsfeed | Atom newsfeed
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
- Copyright and legal notices -
Time to create this page: 52.2 ms