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:

82838

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-01-16
alsa-lib - 1.2.15.3
Ebuild name:

media-libs/alsa-lib-1.2.15.3

Description

Advanced Linux Sound Architecture Library

Added to portage

2026-01-16

alsa-topology-conf - 1.2.5.1-r1
Ebuild name:

media-libs/alsa-topology-conf-1.2.5.1-r1

Description

ALSA topology configuration files

Added to portage

2026-01-16

alsa-ucm-conf - 1.2.15.3
Ebuild name:

media-libs/alsa-ucm-conf-1.2.15.3

Description

ALSA ucm configuration files

Added to portage

2026-01-16

aseprite - 1.3.16.1
Ebuild name:

dev-games/aseprite-1.3.16.1

Description

Animated sprite editor & pixel art tool

Added to portage

2026-01-16

babl - 0.1.120
Ebuild name:

media-libs/babl-0.1.120

Description

A dynamic, any to any, pixel format conversion library

Added to portage

2026-01-16

blake3 - 1.8.3
Ebuild name:

dev-libs/blake3-1.8.3

Description

a fast cryptographic hash function

Added to portage

2026-01-16

capstone - 6.0.0_alpha6
Ebuild name:

dev-libs/capstone-6.0.0_alpha6

Description

disassembly/disassembler framework + bindings

Added to portage

2026-01-16

gajim - 2.4.2
Ebuild name:

net-im/gajim-2.4.2

Description

GTK XMPP Client

Added to portage

2026-01-16

icecast - 2.5.0
Ebuild name:

net-misc/icecast-2.5.0

Description

Opensource alternative to shoutcast that supports mp3, ogg and aac streaming

Added to portage

2026-01-16

ktls-utils - 1.3.0
Ebuild name:

net-misc/ktls-utils-1.3.0

Description

Kernel TLS helper utilities

Added to portage

2026-01-16

libigloo - 0.9.5
Ebuild name:

dev-libs/libigloo-0.9.5

Description

Generic framework for C development - used by the Icecast project

Added to portage

2026-01-16

libnice - 0.1.23
Ebuild name:

net-libs/libnice-0.1.23

Description

Implementation of the Interactice Connectivity Establishment standard (ICE)

Added to portage

2026-01-16

libnvidia-container - 1.18.1
Ebuild name:

sys-libs/libnvidia-container-1.18.1

Description

NVIDIA container runtime library

Added to portage

2026-01-16

ltrace - 0.8.1
Ebuild name:

dev-debug/ltrace-0.8.1

Description

trace library calls made at runtime

Added to portage

2026-01-16

mysql-connector-c - 8.0.36-r1
Ebuild name:

dev-db/mysql-connector-c-8.0.36-r1

Description

C client library for MariaDB/MySQL

Added to portage

2026-01-16

mysql-connector-c - 8.0.41-r1
Ebuild name:

dev-db/mysql-connector-c-8.0.41-r1

Description

C client library for MariaDB/MySQL

Added to portage

2026-01-16

nvidia-container-toolkit - 1.18.1
Ebuild name:

app-containers/nvidia-container-toolkit-1.18.1

Description

NVIDIA container runtime toolkit

Added to portage

2026-01-16

openpgp-keys-alsa - 20260116
Ebuild name:

sec-keys/openpgp-keys-alsa-20260116

Description

OpenPGP keys used by the Alsa Project

Added to portage

2026-01-16

openpgp-keys-dwz - 20260115
Ebuild name:

sec-keys/openpgp-keys-dwz-20260115

Description

OpenPGP key used to sign dwz releases

Added to portage

2026-01-16

openpgp-keys-less - 20260115
Ebuild name:

sec-keys/openpgp-keys-less-20260115

Description

OpenPGP keys used by less

Added to portage

2026-01-16

openpgp-keys-smartmontools - 20260116
Ebuild name:

sec-keys/openpgp-keys-smartmontools-20260116

Description

OpenPGP key used to sign smartmontools releases

Added to portage

2026-01-16

openpgp-keys-tytso - 20260115
Ebuild name:

sec-keys/openpgp-keys-tytso-20260115

Description

OpenPGP keys used by Theodore Ts'o

Added to portage

2026-01-16

pdns-recursor - 5.3.4
Ebuild name:

net-dns/pdns-recursor-5.3.4

Description

The PowerDNS Recursor

Added to portage

2026-01-16

pipewire - 1.4.9-r3
Ebuild name:

media-video/pipewire-1.4.9-r3

Description

Multimedia processing graphs

Added to portage

2026-01-16

sccache - 0.13.0
Ebuild name:

dev-util/sccache-0.13.0

Description

ccache/distcc like tool with support for rust and cloud storage

Added to portage

2026-01-16

sssd - 2.12.0
Ebuild name:

sys-auth/sssd-2.12.0

Description

System Security Services Daemon provides access to identity and authentication

Added to portage

2026-01-16

systemd-utils - 259
Ebuild name:

sys-apps/systemd-utils-259

Description

Utilities split out from systemd for OpenRC users

Added to portage

2026-01-16

termsyn - 1.8.7-r1
Ebuild name:

media-fonts/termsyn-1.8.7-r1

Description

Monospaced font based on terminus and tamsyn

Added to portage

2026-01-16

trojan - 1.16.0-r4
Ebuild name:

net-proxy/trojan-1.16.0-r4

Description

An unidentifiable mechanism that helps you bypass GFW

Added to portage

2026-01-16

yara-x - 1.11.0
Ebuild name:

app-forensics/yara-x-1.11.0

Description

A malware identification and classification tool

Added to portage

2026-01-16

zen-sources - 6.18.4
Ebuild name:

sys-kernel/zen-sources-6.18.4

Description

The Zen Kernel Live Sources

Added to portage

2026-01-16

zen-sources - 6.18.5
Ebuild name:

sys-kernel/zen-sources-6.18.5

Description

The Zen Kernel Live Sources

Added to portage

2026-01-16

2026-01-15
alembic - 1.18.1
Ebuild name:

dev-python/alembic-1.18.1

Description

Database migrations tool, written by the author of SQLAlchemy

Added to portage

2026-01-15

atuin - 18.11.0
Ebuild name:

app-shells/atuin-18.11.0

Description

Shell history manager supporting encrypted synchronisation

Added to portage

2026-01-15

awscli - 1.44.18
Ebuild name:

app-admin/awscli-1.44.18

Description

Universal Command Line Environment for AWS

Added to portage

2026-01-15

boto3 - 1.42.28
Ebuild name:

dev-python/boto3-1.42.28

Description

The AWS SDK for Python

Added to portage

2026-01-15

botocore - 1.42.28
Ebuild name:

dev-python/botocore-1.42.28

Description

Low-level, data-driven core of boto 3

Added to portage

2026-01-15

chef-utils - 18.9.4
Ebuild name:

dev-ruby/chef-utils-18.9.4

Description

Basic utility functions for Core Chef Infra development

Added to portage

2026-01-15

claude-code - 2.1.8
Ebuild name:

dev-util/claude-code-2.1.8

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-01-15

deno-bin - 2.6.5
Ebuild name:

dev-lang/deno-bin-2.6.5

Description

Modern runtime for JavaScript and TypeScript

Added to portage

2026-01-15

dict2xml - 1.7.8
Ebuild name:

dev-python/dict2xml-1.7.8

Description

Small utility to convert a python dictionary into an XML string

Added to portage

2026-01-15

django-polymorphic - 4.10.2
Ebuild name:

dev-python/django-polymorphic-4.10.2

Description

Seamless Polymorphic Inheritance for Django Models

Added to portage

2026-01-15

egl-gbm - 1.1.3
Ebuild name:

gui-libs/egl-gbm-1.1.3

Description

NVIDIA GBM EGL external platform library

Added to portage

2026-01-15

fastfetch - 2.57.1
Ebuild name:

app-misc/fastfetch-2.57.1

Description

Fast neofetch-like system information tool

Added to portage

2026-01-15

fido2 - 2.1.0
Ebuild name:

dev-python/fido2-2.1.0

Description

Python based FIDO 2.0 library

Added to portage

2026-01-15

jupyter-server-terminals - 0.5.4
Ebuild name:

dev-python/jupyter-server-terminals-0.5.4

Description

A Jupyter Server Extension Providing Terminals

Added to portage

2026-01-15

librt - 0.7.8
Ebuild name:

dev-python/librt-0.7.8

Description

Mypyc runtime library

Added to portage

2026-01-15

mattermost-desktop-bin - 6.0.3_rc1
Ebuild name:

net-im/mattermost-desktop-bin-6.0.3_rc1

Description

Mattermost Desktop application

Added to portage

2026-01-15

mothur - 1.48.2
Ebuild name:

sci-biology/mothur-1.48.2

Description

Suite of algorithms for ecological bioinformatics

Added to portage

2026-01-15

oidc-agent - 5.3.4
Ebuild name:

net-misc/oidc-agent-5.3.4

Description

Agent and tools for managing OpenID Connect tokens on the command line

Added to portage

2026-01-15

osm - 1.9
Ebuild name:

app-emacs/osm-1.9

Description

OpenStreetMap tile-based viewer for GNU Emacs

Added to portage

2026-01-15

pandas - 3.0.0_rc2
Ebuild name:

dev-python/pandas-3.0.0_rc2

Description

Powerful data structures for data analysis and statistics

Added to portage

2026-01-15

parser - 3.3.10.1
Ebuild name:

dev-ruby/parser-3.3.10.1

Description

A production-ready Ruby parser written in pure Ruby

Added to portage

2026-01-15

pixi - 0.63.0
Ebuild name:

dev-util/pixi-0.63.0

Description

A package management and workflow tool

Added to portage

2026-01-15

plotly - 6.5.2
Ebuild name:

dev-python/plotly-6.5.2

Description

Browser-based graphing library for Python

Added to portage

2026-01-15

prometheus-client - 0.24.1
Ebuild name:

dev-python/prometheus-client-0.24.1

Description

Python client for the Prometheus monitoring system

Added to portage

2026-01-15

regex - 2026.1.15
Ebuild name:

dev-python/regex-2026.1.15

Description

Alternative regular expression module to replace re

Added to portage

2026-01-15

resolv-replace - 0.2.0
Ebuild name:

dev-ruby/resolv-replace-0.2.0

Description

Replace Socket DNS with Resolv

Added to portage

2026-01-15

ruby - 3.2.10
Ebuild name:

dev-lang/ruby-3.2.10

Description

An object-oriented scripting language

Added to portage

2026-01-15

send2trash - 2.1.0
Ebuild name:

dev-python/send2trash-2.1.0

Description

Sends files to the Trash (or Recycle Bin)

Added to portage

2026-01-15

sphinx-pytest - 0.3.0
Ebuild name:

dev-python/sphinx-pytest-0.3.0

Description

Helpful pytest fixtures for Sphinx extensions

Added to portage

2026-01-15

synapse - 1.145.0
Ebuild name:

net-im/synapse-1.145.0

Description

Reference implementation of Matrix homeserver

Added to portage

2026-01-15

tifffile - 2026.1.14
Ebuild name:

dev-python/tifffile-2026.1.14

Description

Read and write TIFF files

Added to portage

2026-01-15

translate-toolkit - 3.18.1
Ebuild name:

dev-python/translate-toolkit-3.18.1

Description

Toolkit to convert between many translation formats

Added to portage

2026-01-15

trove-classifiers - 2026.1.14.14
Ebuild name:

dev-python/trove-classifiers-2026.1.14.14

Description

Canonical source for classifiers on PyPI (pypi.org)

Added to portage

2026-01-15

xcp - 0.24.2
Ebuild name:

sys-fs/xcp-0.24.2

Description

A 'cp' alternative with user-friendly feedback and performance optimisations

Added to portage

2026-01-15

yamllint - 1.38.0
Ebuild name:

dev-util/yamllint-1.38.0

Description

A linter for YAML files

Added to portage

2026-01-15

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