Guide to linux boot sequence
From Wikihowto
Contents |
[edit] Boot Sequence
- bootloader
- linux kernel
- inittab
- /etc/inittab
- rc script (differs depending on which linux distribution
- init
- Background processes (network, system logging, cron, ...)
- init
- login
- For graphical: See Graphical
- For text mode: See Text Mode
[edit] Bootloader
Grub and lilo are the most popular bootloaders. They can load any OS any bootable drive or partition. They also pass kernel parameters to the Linux kernel.
Configuration Files:
- /boot/grub/grub.conf
Configuration:
- See: Howto configure Grub
- See: Howto configure lilo
[edit] Kernel
The linux kernel boots up using the kernel parameters sent by the bootloader. The only other configuration to the kernel is done when compiling the kernel.
[edit] inittab
After the kernel is loaded the first script to be run is inittab. This sets the runlevel, how to shutdown and use Ctrl-Alt-Del. It also sets the login program and executes the rc script.
Configuration File:
- /etc/inittab
Configuration:
[edit] rc script (sysinit)
The rc scripts differ from distribution to distribution, but they all do the same basic thing. They load the desired kernel modules and run the init scripts for the runlevel. The init scripts load the desired background processes, and are added or removed to each runlevel. The main rc script is generally not changed and init scripts and kernel modules are set by a program or setting file.
Main rc script:
- for Redhat Linux: /etc/rc.d/rc.sysinit
- for Gentoo Linux: /sbin/rc sysinit
Configuration:
[edit] init scripts
The init script run basic background processes, or programs. They are started by sysinit at boot up, however they can be started, stopped and restarted at any time.
Examples of init scripts: anacron, crond, famd, vsftpd, httpd, sendmail
Init scripts location:
- /etc/rc.d/init.d/ or /etc/init.d/
Init scripts enabled/disable for each runtime (not recommended).
- /etc/rc.d/rc[0-6].d/
- Add/remove programs (recommended)
- for Redhat Linux: chkconfig
- for Gentoo Linux: rc-update
[edit] Text Mode
For Graphical Login See Graphical Login Mode Below
After login the start up scripts depend on what's the default shell. Theses scripts are standard shell scripts.
[edit] Bash
Shell scripts automatically loaded for a login terminal. Listed in the order they are executed.
- /etc/profile
- Gentoo: /etc/profile.d/*.sh
- /etc/bash/bashrc or /etc/bashrc
- ~/.bash_profile
- if( ~/.bash_profile doesn't exists )
- ~/.bash_login
- if( ~/.bash_login doesn't exists )
- ~/.profile
- if( ~/.bash_profile doesn't exists )
- ~/.bashrc
~/.bash_logout is executed when a login terminal is logging out
For a non-login terminal(ie xterm, aterm) Listed in the order they are executed.
- /etc/bash/bashrc
- ~/.bashrc
[edit] csh
Shell scripts automatically loaded for a login terminal. Listed in the order they are executed.
- /etc/csh.cshrc
- /etc/csh.login
- ~/.tcshrc
- if ~/.tcshrc is not found
- ~/.cshrc,
- ~/.history
- ~/.login
- ~/.cshdirs
For a non-login terminal(ie xterm, aterm) Listed in the order they are executed.
- /etc/csh.cshrc
- ~/.tcshrc
- ~/.cshrc
[edit] tcsh
Same as csh.
[edit] sh
login shells
- /etc/profile
- ~/.profile
logout: command or script specified using the *trap "command" 0
[edit] ksh
same as sh
[edit] zsh
Login shells
- ~/.zshenv
- ~/.zprofile
- ~/.zlogin
Logout
- ~/.zlogout
Interactive shell
- ~/.zshenv
- ~/.zshrc
[edit] rc
Login shells
- ~/.rcrc
[edit] sash
Seems not to have any.
[edit] Graphical Login Mode
...
