2-Boot Process Flashcards Preview

LPIC 1 - Self Study - Linux Academy > 2-Boot Process > Flashcards

Flashcards in 2-Boot Process Deck (30)
Loading flashcards...
1

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)

2

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

3

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

4

/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.

5

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.

6

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

7

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)

8

Where are the location of systemd targets?

/usr/lib/systemd/system

9

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

10

Where is the init scripts in Red hat located?

in the /etc/init.d/rc(RunLevelNumber).d
or
/etc/rc(RunLevelNumber).d

11

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.

12

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.

13

what is the last script that would be execute at any runlevel?

/rc.local

14

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

15

how does systemd determine the default run level?

using /usr/lib/systemd/system/default.target

16

what is key-value pair?

It is a description often seen in the systemd target files, where it is equalled to other targets. Ex. Requires=multi-user.target

The keys are fairly easy to understand:
- The “Description” is a basic description of the
target,
- “Documentation” provides information on how to receive more information,
- “Requires” defines which targets or units must run before using this target, while
- “Wants” lists which targets or services to run after the required services,
- “Conflicts” notes what services cannot be running for the target to work,
- “After” shows which targets and services can run after the runlevel 5 services have started,
- and “AllowIsolate” denotes whether or not a system can be used with the systemctl isolate command.

17

Target units

units replace the concept of initv scripts for services. service files are configured to execute scripts that are responsible to starting ssh as example.

18

command to display current runlevel

runlevel

A terminal command that gives the current and previous run levels of a sysvinit system and a systemd system. The letter N in the previous run level section means the previous run level information is not available or there was no previous run level.

19

To change runlevel

init [#]
or
telinit [#]

changing to 5 or 6 or 0
5 will kill the GUI (xwindows)

20

shutdown

A terminal command used to shutdown, restart,set a time to shutdown or restart, cancel a shutdown or restart and/or send admin messages on the state of a shutdown command.

Flags:
shutdown -r : Reboots the system imminently
shutdown -h: Powers down the system to the last process, then ask the user to power off.
shutdown -P: Will power a system all the way down as log as ACPI (Advanced Power Management) is available.

21

shutdown -r 30 &

This command will shutdown the system in 30 minutes and will broadcast a message to all attached users using wall. Since we used the "&" flag the command was issued as a backrounb job and the console will return for use after the command is issued.

22

To fake a shutdown message and send it to all users using wall (The system does not actually shut down)

shutdown -k "message"

23

To cancel a planned shutdown process

shutdown -c

24

halt command

halt -f: it force to halt the system to the last process, then ask the user to power off.
halt -p: Will power a system all the way down

25

Using systemd: how to check the default target

systemctl get-default

26

Using systemd: how to change the default target

systemctl set-default graphical.target

27

how to get a list of all target types?

systemctl list-units --type=target

28

Using systemd: ho to change the run level target without changing the default

systemctl isolate [runlevel.target]

29

#runlevel
#systemctl get-default
#systemctl set-default [new.target]
#systemctl list-units --type=target
#systemctl isolate [runlevel.target]
#upstart

display current runlevel
display current runlevel target
will set default runlevel target
list all active system target
allows you to set runlevel of the system without changing the default
extensible version of sysinit

30

1.systemd
2.systemctl
3.systemd-analyze

1.manager for services and systems
2.primary command for controlling the services start/stop/restart/status (example: systemctl reboot, systemctl poweroff, systemctl halt), systemctl shutdown -k "message")
3.display performance information for system bootup, allows for trace/debugging information