11-01-2020 |
|||||||||||||||||||||
Runlevels |
|||||||||||||||||||||
Runlevel is a operating state of a system |
|||||||||||||||||||||
[root@zmpt01 ~]# who -r
run-level 3 2020-11-01 15:22 [root@zmpt01 ~]# runlevel N 3 [root@zmpt01 ~]# systemctl get-default multi-user.target |
|||||||||||||||||||||
Linux has 7 runlevels |
|||||||||||||||||||||
Unless you the default runlevel, the system will
boot into whatever default runlevel is |
|||||||||||||||||||||
Set the default run level |
|||||||||||||||||||||
systemctl set-default -
This command is
used for changing default run level -
Whenever you
use this command -
The symbolic
link for the file /etc/systemd/system/default.target -
Is changed to
the the file associated with the desired runlevel file -
Runlevel files
are sitting in this location -
Most of the
time you are only setting default either Multi-User or Graphical -
Runlevel 3 or
Runlevel 5 |
|||||||||||||||||||||
During the system boot process /etc/systemd/system/default.target This file is actually a symlink of the targeted runlevel
file Most common is either 3 or 5
|
|||||||||||||||||||||
Set the default to graphical |
|||||||||||||||||||||
[root@zmpt01 ~]# systemctl set-default
graphical.target Removed symlink /etc/systemd/system/default.target. Created symlink from
/etc/systemd/system/default.target to
/usr/lib/systemd/system/graphical.target. |
|||||||||||||||||||||
[root@zmpt01 ~]# systemctl get-default graphical.target |
|||||||||||||||||||||
[root@zmpt01 ~]# stat
/etc/systemd/system/default.target File:
‘/etc/systemd/system/default.target’ -> ‘/usr/lib/systemd/system/graphical.target’ Size:
40 Blocks: 0 IO Block: 4096 symbolic link Device: fd00h/64768d Inode: 2965052 Links: 1 Access: (0777/lrwxrwxrwx) Uid: (
0/ root) Gid: (
0/ root) Context: system_u:object_r:systemd_unit_file_t:s0 Access: 2020-11-01 16:05:23.881107580 -0600 Modify: 2020-11-01 16:05:23.702105238 -0600 Change: 2020-11-01 16:05:23.702105238 -0600 Birth: - |
|||||||||||||||||||||
Set the default to multi-user |
|||||||||||||||||||||
[root@zmpt01 ~]# systemctl set-default
multi-user.target Removed symlink /etc/systemd/system/default.target. Created symlink from
/etc/systemd/system/default.target to
/usr/lib/systemd/system/multi-user.target. |
|||||||||||||||||||||
[root@zmpt01 ~]# systemctl get-default multi-user.target |
|||||||||||||||||||||
[root@zmpt01 ~]# stat
/etc/systemd/system/default.target File:
‘/etc/systemd/system/default.target’ -> ‘/usr/lib/systemd/system/multi-user.target’ Size:
41 Blocks: 0 IO Block: 4096 symbolic link Device: fd00h/64768d Inode: 2965067 Links: 1 Access: (0777/lrwxrwxrwx) Uid: (
0/ root) Gid: (
0/ root) Context: system_u:object_r:systemd_unit_file_t:s0 Access: 2020-11-01 16:10:03.827399630 -0600 Modify: 2020-11-01 16:10:03.645397251 -0600 Change: 2020-11-01 16:10:03.645397251 -0600 Birth: - |