Guide to linux boot sequence
Talk0this wiki
Contents |
Boot Sequence
Edit
- 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
Bootloader
Edit
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
Kernel
Edit
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.
inittab
Edit
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:
rc script (sysinit)
Edit
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:
init scripts
Edit
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
Text Mode
Edit
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.
Bash
Edit
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
csh
Edit
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
tcsh
Edit
Same as csh.
sh
Edit
login shells
- /etc/profile
- ~/.profile
logout: command or script specified using the *trap "command" 0
ksh
Edit
same as sh
zsh
Edit
Login shells
- ~/.zshenv
- ~/.zprofile
- ~/.zlogin
Logout
- ~/.zlogout
Interactive shell
- ~/.zshenv
- ~/.zshrc
rc
Edit
Login shells
- ~/.rcrc
sash
Edit
Seems not to have any.
Graphical Login Mode
Edit
...