2-Boot Process Flashcards
What is Sysvinit?
This is a package, containing a group of processes that are responsible for controlling the basic functions of the system
Primarily, it includes the ‘init’ application (located in
/sbin/init), which is the very first application started by the kernel after the boot loader starts the boot process.
The init program then controls the startup , running and shutdown of all other programs (it becomes the ‘parent’ of everything running on the system)
Boot Process
- Power on system
- BIOS Load (modern system includes EFI extended firmware interface)
- BIOS scans for disk boot sector
- Boot sector provides MBR (Master Boot Record) which is the first 512 Bytes of the active drive.
- Boot loader is executed
- LILO/GRUB/GRUB2 begins
- User input (menu has boot options or kernel versions)
- Linux kernel is executed
- Device initialization, module loading, and initial RAM disk (initrd) is loaded
- Root filesystem is mounted
- the init program loads (/sbin/init)
- /etc/inittab is read and appropriate runlevel script is run
- Modules indicated within init script is loaded
- Root filesystem is checked
- Remaning filesystems are mounted
- network devices are started
- Init rescan /etc/inittab file and set the system to indicated default runlevel and complete execution of appropriate scripts.
- Runlevel scripts are run in numeric order
- TTY sessions are loaded (listed in /etc/inittab)
- system login prompt is displayed in console
Sysvinit Runlevels
0-HALT(shutdown)
1-single user
2-Multiuser(no network or remote filesystem)
3-full multi user(including network and remote filesystem)
4-unused
5-x11(full multiuser with Graphical desktop environment)
6-Reboot
/etc/inittab
Defines run levels and default run level of the system, is scanned by init during boot to determine what scripts are executed, according to run level.
systemd
This is an initialization system for bootstrapping the user space and managing all processes subsequent to system start.
It was developed to replace the “sysvinit” init system and address some of the shortcomings of it. Currently,systemd is the default initialization and service management process of almost all modern Linux distributions.
Systemd is generally considered to be more efficient,allows parallel operations,has fewer dependencies,allows for service prioritization and precedence,and reduces start up time.
Systemd boot process
- Power on system
- BIOS Load (modern system includes EFI extended firmware interface)
- BIOS scans for disk boot sector
- Boot sector provides MBR (Master Boot Record) which is the first 512 Bytes of the active drive.
- Boot loader is executed
- LILO/GRUB7GRUB2 begins
- User input (menu has boot options or kernel versions)
- Linux kernel is executed
- Device initialization, module loading, and initial RAM disk (initrd) is loaded
- Root filesystem is mounted
- systemd runs
- default run target is executed (along with dependencies)
- Modules indicated within runlevel target is loaded
- Root filesystem is checked
- Remaning filesystems are mounted
- network devices are started
- remote filesystems are mounted if configured
- systemd sets the runlevel as indicated in the default target
- system login prompt on the console
systemd runlevels
0- poweroff.target or shut down
1- rescue.target (Single User/Rescue Shell)
2-multi-user.target ( Non-graphical, Full Network, Multi-User)
3-multi-user.target ( Non-graphical, Full Network, Multi-User)
4-multi-user.target ( Non-graphical, Full Network, Multi-User)
5- graphical.target (Graphical Desktop, Multi-User)
6-reboot.target (Reboot)
Where are the location of systemd targets?
/usr/lib/systemd/system
upstart
- operates asynchronously, is an event-based replacement for the traditional init daemon. it handles starting of the tasks and services during boot and stopping them during shutdown, and also supervises the tasks and services while the system is running.
- init process was originally only responsible for bringing the computer into a normal running state after power-on, or gracefully shutting down services prior to shutdown. As a result, the design is strictly synchronous, blocking future tasks until the current one has completed.
last time used Ubuntu 12.04
Where is the init scripts in Red hat located?
in the /etc/init.d/rc(RunLevelNumber).d
or
/etc/rc(RunLevelNumber).d
What is the difference between S scripts and K scripts?
The K scripts are kill scripts used to stop any processes that should not be running at given run level.
The S scripts are start up scripts used to start any processes that should be running at given run level.
if you boot into run level3, what directory would scripts be run from? How does system decide which scripts will be run first?
scipts will be run from /etc/rc.d/rc3.d
The scripts are numbered and are executed in that order. Kill scripts are always run before startup scripts.
what is the last script that would be execute at any runlevel?
/rc.local
Given that the scripts in /etc/rc.d/rc#.d are symbolic links to the actual start up scripts, where can these actually be found?
/etc/init.d
how does systemd determine the default run level?
using /usr/lib/systemd/system/default.target