39. SYSTEM INIT: SYSTEMD, SYSTEMV AND UPSTART Flashcards

1
Q

Learning Objectives

By the end of this chapter, you should be able to:

A
  • Understand the importance of the init process.
  • Understand how systemd (and Upstart) arose and how they work.
  • Use systemctl to configure and control systemd.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The init Process

What is the first user-level process (or task) run on the system and continues to run until the system is shutdown?

A
  • /sbin/init (usually just called init)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The init Process

Traditionally the init process it has been considered the ___ of all user processes, although technically that is not true, as some processes are started directly by the kernel.

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

The init Process

the init process coordinates the?

A

later stages of the boot process, configures all aspects of the environment, and starts the processes needed for logging into the system. init also works closely with the kernel in cleaning up after processes when they terminate.

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

The init Process

Traditionally, nearly all distributions based the init process on UNIX’s venerable ___ software. However, this scheme was developed decades ago under rather different circumstances:

  • The target was multi-user mainframe systems (and not personal computers, laptops, and other devices)
  • The target was a single processor system
  • Startup (and shutdown) time was not an important matter; it was far less important than getting things right.

Startup was viewed as a serial process, divided into a series of sequential stages (termed run levels). Each stage required completion before the next could proceed. Thus, startup did not easily take advantage of the parallel processing that could be done on multiple processors or cores.

Secondly, shutdown/reboot was seen as a relatively rare event, and exactly how long it took was not considered important; today Linux systems usually boot in a manner of seconds.

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

The init Process

Three most common implementations include? ___, ___ and ___, but all major distributions have now moved to ___.

Modern systems have required newer methods with enhanced capabilities that ___ software provides.

A
  • systemd
  • Upstart
  • SysVinit
  • systemd
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Startup Alternatives

To deal with the intrinsic limitations in ___, new methods of controlling system startup were developed. While there are others, two main schemes were adopted by Enterprise distributors.

What are these two main schemes?

A
  • SysVinit
  • Upstart
  • systemd

Migration to systemd was non-trivial and bugs and missing features could be very disabling, so essential compatibility layers were adopted and still exist for legacy software. Thus, SysVinit utility compatibility wrappers still persist.

The history of systemd development and adoption is rather complicated, and colorful personalities ensured not all the discussion was both friendly and technical. But this holy war is over as far as we are concerned here.

In the following, we will concentrate on systemd, and, for the most part, ignore SysVinit as well as Upstart, which is no longer used in any significant way.

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

Startup Alternatives

Give a little history on startup alternative schema of Upstart from a high level perspective, not how it works.

A

Upstart

  • Developed by Ubuntu and first included in 2006.
  • Adopted in Fedora 9 (in 2008) and in RHEL 6 and its clones.
  • Was also used in various embedded and mobile devices.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Startup Alternatives

Give a little history on startup alternative schema of systemd from a high level perspective, not how it works.

A

systemd

  • Fedora was the first major distribution to adopt it in 2011.
  • RHEL and SUSE followed.
  • Ubuntu 16.04 replaced Upstart with systemd.
  • All important Linux distributions are now based on systemd.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

systemd Features

The systemd system and session manager for Linux is now dominant in all major distributions. Features include the following:

  • Boots faster than previous init systems
  • Provides aggressive parallelization capabilities
  • Uses socket and D-Bus activation for starting services
  • Replaces shell scripts with programs
  • Offers on-demand starting of daemons
  • Keeps track of processes using cgroups
  • Maintains mount and automount points
  • Implements an elaborate transactional dependency-based service control logic
  • Can work as a drop-in replacement for SysVinit and is compatible with SysVinit scripts.

Note that systemd is backward compatible with SysVinit and the concept of runlevels is supported via runlevel targets. The telinit program is emulated to work with runlevels.

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

systemd Features

Instead of bash scripts, systemd uses ___ files. In addition, systemd sorts all daemons into their own Linux cgroups (control groups).

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

systemd Configuration Files

Although systemd prefers to use a set of standardized configuration files, it can also use distribution-dependent legacy configuration files as a fall-back.

An example of a new configuration file would be /etc/hostname, which would replace /etc/sysconfig/network in Red Hat, /etc/HOSTNAME in SUSE, and /etc/hostname (adopted as the standard) in Debian.

Other files might include:

  • /etc/vconsole.conf: default keyboard mapping and console font.
  • /etc/sysctl.d/*.conf: drop-in directory for kernel sysctl parameters.
  • /etc/os-release: distribution ID file.

Exactly which configuration files will depend on how each distribution sets things up; for example, /etc/vconsole.conf, which configures virtual terminal defaults, does not appear on Ubuntu systems.

systemd is backward compatible with SysVinit, so using old commands will generally work. It supports the use of runlevels conceptually, through the mechanism of a runlevel targets. In addition, telinit is emulated to work with runlevels.

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

systemctl

systemctl is the main utility for?

It’s basic syntax is?

A
  • managing services
  • $ systemctl [options] command [name]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

systemctl

What is the command to show the status of everything that systemd controls?

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

systemctl

What is the command to show all available services?

A

$ systemctl list-units -t service –all

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

systemctl

What is the command to show only active services?

A
  • $ systemctl list-units -t service
17
Q

systemctl

What is the command to to start (activate) or stop (deactivate) one or more unit?

where a unit can be a service or a socket.

A
  • $ sudo systemctl start foo
  • $ sudo systemctl start foo.service
  • $ sudo systemctl start /path/to/foo.service
  • $ sudo systemctl stop foo.service
18
Q

systemctl

What is the command to enable/disable a service?

These commands do not actually start or stop a service; they control whether or not it is started up at system boot.

A
  • $ sudo systemctl enable sshd.service
  • $ sudo systemctl disable sshd.service
19
Q

For most systemctl commands, you can omit the ___ attached to the service name.

A
  • .service
20
Q

systemctl

For an excellent summary of how to go from SysVinit to systemd, see the SysVinit to Systemd Cheatsheet.

https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet

A
21
Q

systemctl enable/disable does what compared to systemctl start/stop?

A
  • systemctl enable/disable
    • do not actually start or stop a service; they control whether or not it is started up at system boot.
  • systemctl start/stop
    • starts and stops a service but doesn’t persist after a reboot.
22
Q
A