Purpose

LPIC-1 guide to Determine and configure hardware settings. The Exam weight of this info is 2.


Reference


Key Knowledge areas

  1. Set the default runlevel or boot target.
  2. Change between runlevels / boot targets including single user mode.
  3. Shutdown and reboot from the command line.
  4. Alert users before switching runlevels / boot targets or other major system events.
  5. Properly terminate processes.
  6. Awareness of acpid.

1: Set the default runlevel or boot target.

Systemctl

Check the current boot target

Input:
$ sudo systemctl get-default
Output:
graphical.target

Set a new boot target

Input:
$ sudo systemctl set default multi-user.target
Output:
Created symlink /etc/systemd/system/default.target → /lib/systemd/system/graphical.target

2: Change between runlevels / boot targets including single user mode.

Telinit/init

Note:

Since the concept of SysV runlevels is obsolete the runlevel requests will be transparently translated into systemd unit activation requests.

Runlevels:
2Multi-User ModeDoes not configure network interfaces or start daemons.
3Multi-User Mode with NetworkingStarts the system normally.
4UndefinedNot used/User-definable
5X11As runlevel 3 + display manager(X)

Show the available run-levels:

Input:
$ telinit --help
Output:
Commands:
0 Power-off the machine
6 Reboot the machine
2, 3, 4, 5 Start runlevelX.target unit
1, s, S Enter rescue mode
q, Q Reload init daemon configuration
u, U Reexecute init daemon

Set a new boot target:

Input:
$ telinit 2
Note:
This command will im

3: Shutdown and reboot from the command line.

Shutdown:

Systemctl

Input:
$ systemctl poweroff
Note:
Is exactly like halt, but it also turns off the unit itself (lights and everything on a PC). It sends an ACPI command to the board, then to the PSU, to cut the power.
Input:
$ systemctl halt
Note:
terminates all processes and shuts down the cpu

Shutdown

Input:
$ shutdown now
Note:
The system shutdown process begins immediately upon pressing the return key

Telinit/init

Input:
$ telinit 0

Input:
$ init 0

Reboot:

Systemctl

Input:
$ systemctl reboot

Shutdown

Input:
$ shutdown -r now

Telinit/init

Input:
$ telinit 6

Input:
$ init 6

4: Alert users before switching runlevels / boot targets or other major system events.

Alert users before major system events:

wall

Input:
$ wall --group accounting "The new accounting group"
Note:
The example above

Systemctl

Input:
$ systemctl poweroff

$ systemctl halt

$ systemctl reboot
Note:
A command string above will also send a message to all users currently logged in.

Shutdown

Input:
$ shutdown -r 13:30 "The system will restart at today 1:30pm."
Note:
This command string will reboot the system at a specific time during the current day in the case at 1:30pm and the above message will be displayed to the logged in users.

Input:
$ shutdown -H +5 "The system will restart in 5 mins."
Note:
The above command string will hault the system at 5 mins from the current time. Then, the above message will be displayed to all logged in users.

Input:
$ shutdown -P

Alert users before switching runlevel

$ systemctl isolate multi-user.target 

5: Properly terminate processes.

Systemctl

Input:
$ systemctl kill -s TERM whatever.service

6: Awareness of acpid.

acpid is designed to notify user-space programs of ACPI events. acpid should be started during the system boot, and will run as a background process, by default. It will open an events file (/proc/acpi/event by default) and at‐tempt to read whole lines which represent ACPI events. If the events file does not exist, acpid will attempt to connect to the Linux kernel via the in‐put layer and netlink. When an ACPI event is received from one of these
sources, acpid will examine a list of rules, and execute the rules that match
the event. acpid will ignore all incoming ACPI events if a lock file exists
(/var/lock/acpid by default).Open document settingsOpen publish panel

  • Document