2-Boot Process Flashcards

1
Q

What is Sysvinit?

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Boot Process

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Sysvinit Runlevels

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

/etc/inittab

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

systemd

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Systemd boot process

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

systemd runlevels

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Where are the location of systemd targets?

A

/usr/lib/systemd/system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

upstart

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Where is the init scripts in Red hat located?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the difference between S scripts and K scripts?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

if you boot into run level3, what directory would scripts be run from? How does system decide which scripts will be run first?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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

A

/rc.local

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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?

A

/etc/init.d

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

how does systemd determine the default run level?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what is key-value pair?

A

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
Q

Target units

A

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
Q

command to display current runlevel

A

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
Q

To change runlevel

A

init [#]
or
telinit [#]

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

20
Q

shutdown

A

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
Q

shutdown -r 30 &

A

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
Q

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

A

shutdown -k “message”

23
Q

To cancel a planned shutdown process

A

shutdown -c

24
Q

halt command

A

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
Q

Using systemd: how to check the default target

A

systemctl get-default

26
Q

Using systemd: how to change the default target

A

systemctl set-default graphical.target

27
Q

how to get a list of all target types?

A

systemctl list-units –type=target

28
Q

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

A

systemctl isolate [runlevel.target]

29
Q
#runlevel
#systemctl get-default
#systemctl set-default [new.target]
#systemctl list-units --type=target
#systemctl isolate [runlevel.target]
#upstart
A
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
Q
  1. systemd
  2. systemctl
  3. systemd-analyze
A
  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