Booting into a target system state: Target Setting
As a system administrator, you can control the boot process of your system, and define the state you want your system to boot into. This is called a systemd target, and it is a set of systemd units that your system starts to reach a certain level of functionality. While working with systemd targets, you can view the default target, select a target at runtime, change the default boot target, boot into emergency or rescue target.
Target unit files
Targets in systemd are groups of related units that act as synchronization points during the start of your system. Target unit files, which end with the .target file extension, represent the systemd targets. The purpose of target units is to group together various systemd units through a chain of dependencies.
The graphical.target unit for starting a graphical session, starts system services such as the GNOME Display Manager (gdm.service) or Accounts Service (accounts-daemon.service), and also activates the multi-user.target unit.its runlevel is 5
Similarly, the multi-user.target unit starts other essential system services such as NetworkManager (NetworkManager.service) or D-Bus (dbus.service) and activates another target unit named basic.target. its runlevel 3
rescue target mode
emergency target mode
Changing the default target to boot into
When a system starts, systemd activates the default.target symbolic link, which points to the true target unit. You can find the currently selected default target unit in the /etc/systemd/system/default.target file.
Target can be Changed in two Mode-
1. Permanent- Default target # systemctl set-defaults mu
2. Temporary only for current session # systemctl isolate multi-user.target/graphical.target
Prerequisites
Root access
Procedure
Determine the current default target unit systemd uses to start the system:
systemctl get-default
List the currently loaded targets:
systemctl list-units --type target
Configure the system to use a different target unit by default:
systemctl set-default name.target
Replace name with the name of the target unit you want to use by default.
Example:
systemctl set-default multi-user.target
Verify the default target unit:
systemctl get-default
multi-user.target
Apply the changes by rebooting:
reboot