101.3 CHANGE RUNLEVELS/BOOT TARGETS, SHUTDOWN & REBOOT

  • Set the default runlevel or boot targe
  • Change between runlevels/boot targets including single user mod
  • Shutdown and reboot from the command line
  • Alert users before switching runlevels/boot targets or other major system events
  • The following is a partial list of the used files, terms and utilities:
    • □ /etc/inittab
      □ shutdown
      □ init
      □ /etc/init.d
      □ telinit
      □ system
      □ systemctl
      □ /etc/systemd/
      □ / usr/lib/system /
      □ wall

SET THE DEFAULT RUNLEVEL OR BOOT TARGET

  • The init process is the first program to run at boot time
  • Reads from scripts in /etc/init.d
    • SysVinit  (CentOS/RHEL 6 and earlier)
    • Upstart init daemon (Ubuntu, Fedora 9-14)
    • Systemd init daemon (CentOS/RHEL 7, Fedora 15+)
  • /sbin/telinit command sends signals to init in order to change runlevels
  • Runlevel-releated commands
    • systemctl get-default (Show default)
    • runlevel    (Show current runlevel)

CHANGE BETWEEN RUNLEVELS/BOOT TARGETS INCLUDING SINGLE USER MODE

  • Change runlevels with systemctl, init or telinit
    systemctl isolate graphical.target (Change runlevel w/isolation)
    init [runlevel] or telinit [runlevel]

SysVInit Runlevel | System d Target | Description
0 | poweroff.target | Halts the system
1 | rescue.target | Single-user mode
2 | multi-user.target | Multi-user without networking
3 |multi-user.target | Multi-user with networking
4 |multi-user.target | User configurable
5 |graphical.target | Multi-user with GUI
6 |reboot.target | Reboots the system

SHUTDOWN AND REBOOT FROM THE COMMAND LINE

  • Shutdown system options
    • init 0
    • telinit 0
    • shutdown
    • reboot -p (reboot w/poweroff)
    • poweroff
    • halt
  • Reboot system options
    • init 6
    • telinit 6
    • shutdown -f
    • reboot [-f] (optional force option)

Leave a comment