Chapter 6 Flashcards

(24 cards)

1
Q

Maintaining System

Startup and Services

A

A service, or daemon, is a program that

performs a particular duty.

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

Looking at init

A

This program can be located in the /etc/, the /bin/, or the /sbin/ directory.
Also, it typically has a process ID (PID) of 1.

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

Finding the init program file location

A
# which init
/sbin/init
#
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Checking the init program for links

A
# readlink -f /sbin/init
/usr/lib/systemd/systemd
#
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Checking PID 1

A

ps -p 1
PID TTY TIME CMD
1 ? 00:00:06 systemd
#

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

Managing systemd Systems

A

Services can now be started when the system boots, when a particular hardware
component is attached to the system, when certain other services are started, and so on.

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

Exploring Unit Files

A
There are currently 12 different systemd unit types, as follows:
■ automount
■ device
■ mount
■ path
■ scope
■ service
■ slice
■ snapshot
■ socket
■ swap
■ target
■ timer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

systemctl utility is the main gateway to managing systemd and system services

A

systemctl [OPTIONS…] COMMAND [NAME…]

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

Looking at systemd units

A

$ systemctl list-units
UNIT LOAD ACTIVE SUB DESCRIPTION
[…]
smartd.service loaded active running Self Monitor[…]
sshd.service loaded active running OpenSSH serv[…]
sysstat.service loaded active exited Resets Syste[…]
[…]
graphical.target loaded active active Graphical I[…]
[…]
$

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

Groups of services are started via target unit fi les. At system startup, the default
.target unit is responsible for ensuring that all required and desired services are launched
at system initialization.

A
Looking at the default.target link
$ find / -name default.target 2>/dev/null
/etc/systemd/system/default.target
[...]
$
$ readlink -f /etc/systemd/system/default.target
/usr/lib/systemd/system/graphical.target
$
$ systemctl get-default
graphical.target
$
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Commonly used system boot target unit files

A

Name Description
graphical.target Provides multiple users access to the
system via local terminals and/or
through the network. Graphical user
interface (GUI) access is offered.
multi-user.target Provides multiple users access to the
system via local terminals and/or
through the network. No GUI access
is offered.
runlevel n .target Provides backward compatibility to
SysV init systems, where n is set to 1–
5 for the desired SysV runlevel
equivalence.

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

Focusing on Service Unit Files

A

The following list shows the directory locations in ascending priority order:

  1. /etc/systemd/system/
  2. /run/systemd/system/
  3. /usr/lib/systemd/system/
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Looking at systemd unit files

A
$ systemctl list-unit-files
UNIT FILE STATE
[...]
dev-hugepages.mount static
dev-mqueue.mount static
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

There are at least

12 different enablement states, but you’ll commonly see these three:

A

■ enabled: Service starts at system boot.
■ disabled: Service does not start at system boot.
■ static: Service starts if another unit depends on it.
Can also be manually started.

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

To see what directory or directories store a particular systemd unit file(s), use the systemctl utility

A
Finding and displaying a systemd unit file
$ systemctl cat ntpd.service
# /usr/lib/systemd/system/ntpd.service
[Unit]
Description=Network Time Service
After=syslog.target ntpdate.service sntp.service
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/ntpd
ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS
PrivateTmp=true
[Install]
WantedBy=multi-user.target
$
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

For service unit fi les, there are three primary confi guration sections. They are as follows:

A

■ [Unit]
■ [Service]
■ [Install]

17
Q

A directive is a setting that modifi es a confi guration,

Commonly used service unit file [Unit] section directives

A
After 
Before 
Description 
Documentation 
Conflicts 
Requires 
Wants
18
Q

The [Service] directives within a unit file set configuration items, which are specific to that service.

Commonly used service unit file [Service] section directives

A
ExecReload
ExecStart 
ExecStop 
Environment 
Environment File 
RemainAfterExit 
Restart
Type
19
Q

The [Service] Type directive needs a little more explanation

A

forking
simple
oneshot
idle

20
Q

Environment directive

A

Linux systems use a feature called environment variables to store information about the shell session and working environment

21
Q

Viewing a service unit file’s Environment directive

A

$ echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:[…]
$
$ systemctl ––no-pager cat anaconda.service
# /usr/lib/systemd/system/anaconda.service
[Unit]
Description=Anaconda
[…]
[Service]
Type=forking
Environment=HOME=/root MALLOC_CHECK_=2 MALLOC_PERTURB_=204 PATH=/usr/bin:
/bin:/sbin:/usr/sbin:/mnt/sysimage/bin: […]
LANG=en_US.UTF-8 […]
[…]
$

22
Q

The [Install] directives within a unit file determine what happens to a particular service if it is enabled or disabled.

A

Alias
Also
RequiredBy
WantedBy

23
Q

Focusing on Target Unit Files

A

The primary purpose of target unit files is to group together various services to start at system boot time

24
Q

Finding and displaying the systemd target unit file

A
$ systemctl get-default
graphical.target
$
$ systemctl cat graphical.target
# /usr/lib/systemd/system/graphical.target
[...]
[Unit]
Description=Graphical Interface
Documentation=man:systemd.special(7)
Requires=multi-user.target
Wants=display-manager.service
Conflicts=rescue.service rescue.target
After=multi-user.target rescue.service rescue.target display-manager.service
AllowIsolate=yes
$