GRUB Components and Configuration
1st Stage
Small, added to MBR or boot sector during installation
Use /sbin/grub-install to repair
2nd Stage
Loaded from filesystem containing /boot
Configured in /boot/grub/grub.conf
To boot Linux: title, kernel, root filesystem, and initial ramdisk

Kernel Initialization
Kernel boot time functions
Device detection
Device driver initialization (modules loaded from initrd-.img)
Mounts root filesystem read only
Loads initial process (init, PID 1)
Logged to /var/log/dmesg

init Initialization
init reads its config: /etc/inittab
Initial runlevel
System initialization scripts
Runlevel specific script directories
Trap certain key sequences
Define UPS power fail / restore scripts
Spawn gettys on virtual consoles
Initialize X in runlevel 5

System Initialization
/etc/rc.d/rc.sysinit
Activate udev and selinux
Sets kernel parameters in /etc/sysctl.conf
Sets the system clock
Loads keymaps
Enables swap partitions
Sets hostname
Root filesystem check and remount read-write
Activate RAID and LVM devices
Enable disk quotas
Check and mount other local filesystems
Cleans up stale locks and PID files

Standalone Service Initialization
/etc/rc.d/rc defines which standalone services to start
l5:5:wait:/etc/rc.d/rc 5
Each runlevel has a corresponding directory:
/etc/rc.d/rc5.d/
K* symbolic links called with a stop argument
S* symbolic links called with a start argument
The System V init scripts reside in:
/etc/rc.d/init.d/
Behavior configured with files under /etc/sysconfig/

Non-Service Startup
/etc/rc.d/rc.local
Runs near the end of the runlevel specific scripts (S99local)
Common place for custom modification
Better practice:
Create a System V init script
Existing /etc/rc.d/init.d/ scripts can be used as a starting point
List all current settings: sysctl -a
Reprocess settings from sysctl.conf: sysctl -p
Set a /proc value dynamically: sysctl -w net.ipv4.ip_forward=1

Leave a Reply

You must be logged in to post a comment.