CompTIA Linux+ Certification Guide
上QQ阅读APP看书,第一时间看更新

Introduction to boot targets

The concept of boot targets is a whole new ball game. Boot targets are used when working with systemd. We can see increased performance, because only requests for a particular socket are started as needed. Also, systemd emulates init for compatibility, while in the background systemd is doing the work. When we use boot targets, we work with units. For a given boot target, a number of daemons reside. Let's see the available boot targets in an Ubuntu distribution:

root@ubuntu:/home/philip# systemctl list-units --type target
UNIT LOAD ACTIVE SUB DESCRIPTION
basic.target loaded active active Basic System
cryptsetup.target loaded active active Encrypted Volumes
getty.target loaded active active Login Prompts
graphical.target loaded active active Graphical Interface
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
multi-user.target loaded active active Multi-User System
network.target loaded active active Network
nss-user-lookup.target loaded active active User and Group Name Lookups
paths.target loaded active active Paths
remote-fs-pre.target loaded active active Remote File Systems (Pre)
remote-fs.target loaded active active Remote File Systems
slices.target loaded active active Slices
sockets.target loaded active active Sockets
sound.target loaded active active Sound Card
swap.target loaded active active Swap
sysinit.target loaded active active System Initialization
time-sync.target loaded active active System Time Synchronized
timers.target loaded active active Timers
LOAD = Reflects whether the unit definition was properly loaded.

ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
19 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
root@ubuntu:/home/philip#

From the preceding output, only the targets that are currently loaded will be displayed. The graphical.target is similar to runlevel 5 in init. To see all of the boot targets, we would do this:

root@ubuntu:/home/philip# systemctl list-units --type target --all
UNIT LOAD ACTIVE SUB DESCRIPTION
basic.target loaded active active Basic System
cryptsetup.target loaded active active Encrypted Volumes
emergency.target loaded inactive dead Emergency Mode
failsafe-graphical.target loaded inactive dead Graphical failsafe fallback
final.target loaded inactive dead Final Step
getty.target loaded active active Login Prompts
graphical.target loaded active active Graphical Interface
halt.target loaded inactive dead Halt
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
multi-user.target loaded active active Multi-User System
network-online.target loaded inactive dead Network is Online
network-pre.target loaded inactive dead Network (Pre)
network.target loaded active active Network
nss-user-lookup.target loaded active active User and Group Name Lookups
paths.target loaded active active Paths
reboot.target loaded inactive dead Reboot
remote-fs-pre.target loaded active active

From the preceding output, we can see the boot targets that are active and also those that are inactive.

Now, let's say we want to see the actual daemons associated with a given target. We would run the following command:

root@ubuntu:/home/philip# systemctl list-dependencies graphical.target

From the preceding output, we can see a number of daemons in graphical.target. One such daemon is the NetworkManager.service, which is used for networking within our system. The way to read this would be:

  • Green circle: Indicates that the service is currently running
  • Red circle: Indicates that the service is not presently running