Selecting a systemd target
A systemd target is a set of systemd units that should be started to reach
a desired state. The most important of these targets are listed in the
following table.
Target Purpose
graphical.target System supports multiple users, graphical and text based logins
multi-user.target System supports multiple users, text based logins only
rescue.target sulogin prompt, basic system initialization completed.
emergency.target sulogin prompt, initramfs pivot and system root mounted on / read-only
It is possible for a target to be a part of another target; for-example, the graphical.target includes multi-user.target, which in turn depends on
basic.target and others. These dependencies can be viewed from the command line
with the following command.
#systemctl list-dependencies graphical.target | grep target
An overview of all available targets can be viewed with:
#systemctl list-units --type=target --all
An overview of all targets installed on disk can be viewed with:
#systemctl list-unit-files --type=target --all
Selecting a target at runtime
On a running system,
administrators can choose to switch to a different target using the systemctl
isolate command;
#systemctl isolate multi-user.target
Isolating a target will
stop all services not required by that target and start any required services that
have not yet been started.
Selecting a target at runtime
When the system starts, and
control is passed over to system from the initramfs, systemd
will try to activate the default.target target. Normally the default.target
target will be a symbolic link to either graphical.target or multi-user.target.
The Red Hat Enterprise Linux 7 Boot Process Step by Step
Instead of editing this
symbolic link by hand, the systemctl tool comes with two commands to
manage this link: get-default and set-default.
#systemctl get-default
multi-user.target This is the default target.
#systemctl set-default graphical.target
This command is used to set default target to graphical.target
Selecting a different target at boot time
To select a different
target at boot time, a special option can be appended to the kernel command
line from the boot loader: system.unit=.
To boot the system into a
rescue shell where configuration changes can be made without any service
running, the following can be appended from the interactive boot loader menu
before starting:
This configuration change
will only affect a single boot, making it a useful tool for troubleshooting the
boot process.
Linux System Administrator Interview Questions and Answers for Freshers
To use this method of
selecting target, use the following procedure for Red Hat Enterprise Linux 7
systems:
1.
Reboot the system
2.
Interrupt the boot loader menu countdown by pressing any key.
3.
Move the cursor to the entry to be started.
4.
Press e to edit the current entry.
5.
Move the cursor to the line that starts with linux16.
This is the kernel command line.
6.
Append systemd.unit=desired.target
7.
Press Ctrl+x to boot with these changes.