# Linux Administration/System Architecture/Boot Configuration

This lesson covers boot configuration.

## Objectives and Skills

Objectives and skills for the boot sequence portion of Linux+ certification include:
* Change runlevels/boot targets and shutdown or reboot system.
** Set the default runlevel or boot target
** Change between runlevels/boot targets including single user mode
** Shut down and reboot from the command line
** Alert users before switching runlevels/ boot targets or other major system events
** Properly terminate processes
** 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

## Readings

* Wikipedia: Runlevel
* Wikipedia: Shutdown (computing)
* Wikipedia: init
* systemd
* Wikipedia: Upstart (software)
* Wikipedia: wall (Unix)

## Multimedia

* YouTube: Working with Linux Runlevels
* YouTube: Properly Terminating Linux Processes
* YouTube: Init, Systemd, and Upstart

## Activities

* Complete the tutorial IBM: Learn Linux, 101: Runlevels, boot targets, shutdown, and reboot
* Shutdown
** Use shutdown to shutdown the system.
** Use telinit 0 to shutdown the system.
** Use systemctl isolate poweroff.target to shutdown the system.
* Reboot
** Use reboot to reboot the system.
** Use telinit 6 to reboot the system.
** Use systemctl isolate reboot.target to reboot the system.
** Use telinit 1 to reboot the system in single-user mode.
** Use systemctl isolate rescue.target to reboot the system in single-user mode.
* Test the difference between halt and halt -p.
* Set default runlevels.
** Use systemctl set-default multi-user.target to configure multi-user mode. Reboot.
** Use systemctl set-default graphical.target to configure graphical user mode. Reboot.
* Review HowToForge: Linux wall Command Tutorial. Use wall to alert users of an impending reboot.
* Use kill to stop processes.
** Review Benjamin Cane: Understanding the kill command, and how to terminate processes in Linux.
** Run a user program, such as the calculator or an editor. Use ps -A to find the program's process ID. Use kill and the process ID to ask the program to terminate itself.
** Run the program. Use ps -A to find the program's process ID. Use kill -15 and the process ID to ask the program to terminate itself.
** Run the program. Use ps -A to find the program's process ID. Use kill -SIGTERM and the process ID to ask the program to terminate itself.
** Run the program. Use ps -A to find the program's process ID. Use kill -9 and the process ID to kill the process.
** Run the program. Use ps -A to find the program's process ID. Use kill -SIGKILL and the process ID to kill the process.
* Stop and restart services.
* Review CyberCiti.biz: Service command.
** Use service --status-all to list service status.
** Use service cups stop to stop the printing service.
** Use service cups start to start the printing service.
** Use service cups restart to restart the printing service.

## Lesson Summary

* The halt command will halt, poweroff, or reboot the system:
** halt command stops CPU processing
** halt -p stops CPU processing and powers off a system
** halt --reboot reboots a system
* The kill command is used to terminate processes without having to log out or reboot the computer.
** kill <pid> (SIGTERM, option 15) and signals the process to terminate itself
** kill -9 <pid> or kill -SIGKILL <pid> kills the process
* The service command is used to start, stop, and restart services.
* The shutdown command turns off or reboots a computer.
** shutdown -h now shuts down a system immediately
** shutdown -r now reboots a system
* The systemctl command is used to examine and control the state of "systemd".
** systemctl isolate <target> changes the runlevel
** systemctl set-default <target> sets the default runlevel
* systemctl runlevels include:
** 0 - poweroff.target
** 1 - rescue.target
** 3 - multi-user.target
** 5 - graphical.target
** 6 - reboot.target
* The telinit command signals init to change runlevels. Runlevels include:
** 0 - halt
** 1 - single-user mode
** 6 - reboot
* The wall command (write to all) displays the contents of a file or standard input to all logged-in users.
* /etc/init.d contains start/stop scripts for system services.
* /etc/inittab is the top-level configuration file for init.
* /etc/systemd/ contains local systemd configuration files.

## See Also

* Linux.com: Understanding and Using Systemd