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:

82739

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-08
age - 1.3.1
Ebuild name:

app-crypt/age-1.3.1

Description

A simple, modern and secure encryption tool (and Go library)

Added to portage

2026-01-08

celestia - 1.7.0_pre20241231-r1
Ebuild name:

sci-astronomy/celestia-1.7.0_pre20241231-r1

Description

OpenGL 3D space simulator

Added to portage

2026-01-08

closure-compiler-bin - 20260104
Ebuild name:

dev-lang/closure-compiler-bin-20260104

Description

JavaScript optimizing compiler

Added to portage

2026-01-08

curtail - 1.14.0
Ebuild name:

media-gfx/curtail-1.14.0

Description

Image compressor, supporting PNG, JPEG and WebP

Added to portage

2026-01-08

fennel - 1.6.1
Ebuild name:

dev-lang/fennel-1.6.1

Description

Lisp-like language that compiles to Lua

Added to portage

2026-01-08

kirigami-addons - 1.11.0
Ebuild name:

dev-libs/kirigami-addons-1.11.0

Description

Visual end user components for Kirigami-based applications

Added to portage

2026-01-08

lfe - 2.2.0-r1
Ebuild name:

dev-lang/lfe-2.2.0-r1

Description

Lisp-flavoured Erlang, a lisp syntax front-end to the Erlang compiler

Added to portage

2026-01-08

limesuite - 23.11.0_p20250714
Ebuild name:

net-wireless/limesuite-23.11.0_p20250714

Description

Driver and GUI for LMS7002M-based SDR platforms

Added to portage

2026-01-08

picard - 3.0_pre20260107
Ebuild name:

media-sound/picard-3.0_pre20260107

Description

Cross-platform music tagger

Added to portage

2026-01-08

poppler - 26.01.0
Ebuild name:

app-text/poppler-26.01.0

Description

PDF rendering library based on the xpdf-3.0 code base

Added to portage

2026-01-08

sbctl - 0.18
Ebuild name:

app-crypt/sbctl-0.18

Description

Secure Boot key manager

Added to portage

2026-01-08

sbsigntools - 0.9.5
Ebuild name:

app-crypt/sbsigntools-0.9.5

Description

Utilities for signing and verifying files for UEFI Secure Boot

Added to portage

2026-01-08

2026-01-07
anyio - 4.12.1
Ebuild name:

dev-python/anyio-4.12.1

Description

Compatibility layer for multiple asynchronous event loop implementations

Added to portage

2026-01-07

avidemux - 2.8.1_p20251019-r1
Ebuild name:

media-video/avidemux-2.8.1_p20251019-r1

Description

Video editor designed for simple cutting, filtering and enc

Added to portage

2026-01-07

awscli - 1.44.13
Ebuild name:

app-admin/awscli-1.44.13

Description

Universal Command Line Environment for AWS

Added to portage

2026-01-07

boto3 - 1.42.23
Ebuild name:

dev-python/boto3-1.42.23

Description

The AWS SDK for Python

Added to portage

2026-01-07

botocore - 1.42.23
Ebuild name:

dev-python/botocore-1.42.23

Description

Low-level, data-driven core of boto 3

Added to portage

2026-01-07

claude-code - 2.0.77
Ebuild name:

dev-util/claude-code-2.0.77

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-01-07

conan - 2.24.0
Ebuild name:

dev-util/conan-2.24.0

Description

Distributed C/C++ package manager

Added to portage

2026-01-07

cryfs - 1.0.3
Ebuild name:

sys-fs/cryfs-1.0.3

Description

Encrypted FUSE filesystem that conceals metadata

Added to portage

2026-01-07

derper - 1.92.4
Ebuild name:

net-vpn/derper-1.92.4

Description

DERP server for tailscale network

Added to portage

2026-01-07

django - 5.2.10
Ebuild name:

dev-python/django-5.2.10

Description

High-level Python web framework

Added to portage

2026-01-07

django - 6.0.1
Ebuild name:

dev-python/django-6.0.1

Description

High-level Python web framework

Added to portage

2026-01-07

fish - 4.3.3
Ebuild name:

app-shells/fish-4.3.3

Description

Friendly Interactive SHell

Added to portage

2026-01-07

flog - 4.9.4
Ebuild name:

dev-ruby/flog-4.9.4

Description

Flog reports the most tortured code in an easy to read pain report

Added to portage

2026-01-07

genkernel - 4.3.17-r3
Ebuild name:

sys-kernel/genkernel-4.3.17-r3

Description

Gentoo automatic kernel building scripts

Added to portage

2026-01-07

google-auth - 2.47.0
Ebuild name:

dev-python/google-auth-2.47.0

Description

Google Authentication Library

Added to portage

2026-01-07

hackrf-tools - 2026.01.1
Ebuild name:

net-wireless/hackrf-tools-2026.01.1

Description

tools for communicating with HackRF SDR platform

Added to portage

2026-01-07

hcloud - 1.59.0
Ebuild name:

app-admin/hcloud-1.59.0

Description

A command-line interface for Hetzner Cloud

Added to portage

2026-01-07

hypothesis - 6.150.0
Ebuild name:

dev-python/hypothesis-6.150.0

Description

A library for property based testing

Added to portage

2026-01-07

icu - 78.1
Ebuild name:

dev-libs/icu-78.1

Description

International Components for Unicode

Added to portage

2026-01-07

jdk - 27
Ebuild name:

virtual/jdk-27

Description

Virtual for Java Development Kit (JDK)

Added to portage

2026-01-07

jre - 27
Ebuild name:

virtual/jre-27

Description

Virtual for Java Runtime Environment (JRE)

Added to portage

2026-01-07

kraft - 2.0.0
Ebuild name:

app-office/kraft-2.0.0

Description

Quotes and invoices manager for small enterprises

Added to portage

2026-01-07

kube-apiserver - 1.33.7
Ebuild name:

sys-cluster/kube-apiserver-1.33.7

Description

Kubernetes API server

Added to portage

2026-01-07

kube-controller-manager - 1.33.7
Ebuild name:

sys-cluster/kube-controller-manager-1.33.7

Description

Kubernetes Controller Manager

Added to portage

2026-01-07

kube-proxy - 1.33.7
Ebuild name:

sys-cluster/kube-proxy-1.33.7

Description

Kubernetes Proxy service

Added to portage

2026-01-07

kube-scheduler - 1.33.7
Ebuild name:

sys-cluster/kube-scheduler-1.33.7

Description

Kubernetes Scheduler

Added to portage

2026-01-07

kubeadm - 1.33.7
Ebuild name:

sys-cluster/kubeadm-1.33.7

Description

CLI to Easily bootstrap a secure Kubernetes cluster

Added to portage

2026-01-07

kubectl - 1.33.7
Ebuild name:

sys-cluster/kubectl-1.33.7

Description

CLI to run commands against Kubernetes clusters

Added to portage

2026-01-07

kubelet - 1.33.7
Ebuild name:

sys-cluster/kubelet-1.33.7

Description

Kubernetes Node Agent

Added to portage

2026-01-07

ldoc - 1.5.0
Ebuild name:

dev-lua/ldoc-1.5.0

Description

LuaDoc-compatible documentation generation system

Added to portage

2026-01-07

libhackrf - 2026.01.1
Ebuild name:

net-libs/libhackrf-2026.01.1

Description

library for communicating with HackRF SDR platform

Added to portage

2026-01-07

libofx - 0.10.9-r1
Ebuild name:

dev-libs/libofx-0.10.9-r1

Description

Library to support the Open Financial eXchange XML format

Added to portage

2026-01-07

libxdg-basedir - 1.2.3-r1
Ebuild name:

dev-libs/libxdg-basedir-1.2.3-r1

Description

Small library to access XDG Base Directories Specification paths

Added to portage

2026-01-07

lidarr-bin - 3.1.2.4902
Ebuild name:

www-apps/lidarr-bin-3.1.2.4902

Description

Looks and smells like Sonarr but made for music

Added to portage

2026-01-07

micawber - 0.6.2
Ebuild name:

dev-python/micawber-0.6.2

Description

A small library for extracting rich content from urls

Added to portage

2026-01-07

narwhals - 2.15.0
Ebuild name:

dev-python/narwhals-2.15.0

Description

Extremely lightweight compatibility layer between dataframe libraries

Added to portage

2026-01-07

openjdk - 27_alpha3
Ebuild name:

dev-java/openjdk-27_alpha3

Description

Open source implementation of the Java programming language

Added to portage

2026-01-07

openjdk-bin - 26_beta29
Ebuild name:

dev-java/openjdk-bin-26_beta29

Description

Prebuilt Java JDK binaries provided by Eclipse Temurin

Added to portage

2026-01-07

openjdk-bin - 27_alpha3
Ebuild name:

dev-java/openjdk-bin-27_alpha3

Description

Prebuilt Java JDK binaries provided by Eclipse Temurin

Added to portage

2026-01-07

pathspec - 1.0.1
Ebuild name:

dev-python/pathspec-1.0.1

Description

Utility library for gitignore style pattern matching of file paths

Added to portage

2026-01-07

portage - 3.0.75
Ebuild name:

sys-apps/portage-3.0.75

Description

The package management and distribution system for Gentoo

Added to portage

2026-01-07

prowlarr-bin - 2.3.2.5245
Ebuild name:

www-apps/prowlarr-bin-2.3.2.5245

Description

An indexer manager/proxy to integrate with your various PVR apps

Added to portage

2026-01-07

py-spy - 0.4.1
Ebuild name:

dev-util/py-spy-0.4.1

Description

Sampling profiler for Python programs

Added to portage

2026-01-07

pyfuse3 - 3.4.2
Ebuild name:

dev-python/pyfuse3-3.4.2

Description

Python 3 bindings for libfuse 3 with asynchronous API

Added to portage

2026-01-07

pytest-golden - 1.0.1
Ebuild name:

dev-python/pytest-golden-1.0.1

Description

Plugin for pytest that offloads expected outputs to data files

Added to portage

2026-01-07

radarr-bin - 6.1.1.10317
Ebuild name:

www-apps/radarr-bin-6.1.1.10317

Description

A fork of Sonarr to work with movies a la Couchpotato

Added to portage

2026-01-07

rpm - 6.0.1
Ebuild name:

app-arch/rpm-6.0.1

Description

The RPM Package Manager

Added to portage

2026-01-07

sbctl - 0.16
Ebuild name:

app-crypt/sbctl-0.16

Description

Secure Boot key manager

Added to portage

2026-01-07

strscan - 3.1.7
Ebuild name:

dev-ruby/strscan-3.1.7

Description

Provides lexical scanning operations on a String

Added to portage

2026-01-07

tarlz - 0.29
Ebuild name:

app-arch/tarlz-0.29

Description

A parallel archiver combining tar and lzip

Added to portage

2026-01-07

tayga - 0.9.6
Ebuild name:

net-proxy/tayga-0.9.6

Description

Out-of-kernel stateless NAT64 implementation based on TUN

Added to portage

2026-01-07

thor - 1.5.0
Ebuild name:

dev-ruby/thor-1.5.0

Description

Simple and efficient tool for building self-documenting command line utilities

Added to portage

2026-01-07

uv - 0.9.22
Ebuild name:

dev-python/uv-0.9.22

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-01-07

uv-build - 0.9.22
Ebuild name:

dev-python/uv-build-0.9.22

Description

PEP517 uv build backend

Added to portage

2026-01-07

wget2 - 2.2.1
Ebuild name:

net-misc/wget2-2.2.1

Description

GNU Wget2 is a file and recursive website downloader

Added to portage

2026-01-07

xmlschema - 4.3.0
Ebuild name:

dev-python/xmlschema-4.3.0

Description

An XML Schema validator and decoder

Added to portage

2026-01-07

xvfbwrapper - 0.2.17
Ebuild name:

dev-python/xvfbwrapper-0.2.17

Description

Python wrapper for running a display inside X virtual framebuffer

Added to portage

2026-01-07

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