SUSE Linux Enterprise Desktop Administration Chapter 11 Manage

  • Slides: 44
Download presentation
SUSE Linux Enterprise Desktop Administration Chapter 11 Manage System Initialization

SUSE Linux Enterprise Desktop Administration Chapter 11 Manage System Initialization

Objectives • Objective 1—Describe the Linux Load Procedure • Objective 2—GRUB (Grand Unified Bootloader)

Objectives • Objective 1—Describe the Linux Load Procedure • Objective 2—GRUB (Grand Unified Bootloader) • Objective 3—Manage Runlevels SUSE Linux Enterprise Desktop Administration 2

Objective 1—Describe the Linux Load Procedure • The basic steps of booting a computer

Objective 1—Describe the Linux Load Procedure • The basic steps of booting a computer with a Linux system installed • BIOS and Boot Manager • Kernel • initramfs (Initial RAM File System) • init SUSE Linux Enterprise Desktop Administration 3

Figure 11 -1 The basic steps of booting a computer with Linux SUSE Linux

Figure 11 -1 The basic steps of booting a computer with Linux SUSE Linux Enterprise Desktop Administration 4

BIOS and Boot Manager • BIOS (Basic Input Output System) – Performs a power-on

BIOS and Boot Manager • BIOS (Basic Input Output System) – Performs a power-on self test, conducts the initial detection and setup of hardware, and accesses bootable devices • If the bootable device is a hard drive, BIOS also reads the MBR (Master Boot Record) • Using the code in the MBR, the BIOS starts the boot manager • The boot manager (such as GRUB) loads the kernel and the initrd to memory and starts the kernel SUSE Linux Enterprise Desktop Administration 5

Kernel • Kernel – Uncompresses itself and then organizes and takes control of the

Kernel • Kernel – Uncompresses itself and then organizes and takes control of the continued booting of the system – Checks and sets the console, reads BIOS settings, and initializes basic hardware interfaces • Next, the drivers probe existing hardware and initialize it accordingly • The kernel controls the entire system – Managing hardware access and allocating CPU time and memory to programs SUSE Linux Enterprise Desktop Administration 6

initramfs (Initial RAM File System) • Initial RAM File System (initramfs) – A cpio

initramfs (Initial RAM File System) • Initial RAM File System (initramfs) – A cpio archive that the kernel can load to a RAM disk – Provides a minimal Linux environment that enables the execution of programs before the actual root file system is mounted – Provides an executable named init • Should execute the actual init program on the root file system for the boot process to proceed • Former SUSE Linux versions used an initial RAM disk, initrd, instead • The kernel starts the program init SUSE Linux Enterprise Desktop Administration 7

init • The program init is located in initramfs starts /sbin/init – Boots the

init • The program init is located in initramfs starts /sbin/init – Boots the system with all its programs and configurations • The init process is always assigned a process ID number of 1 – Relies on the /etc/inittab file for configuration information • After the init process starts, it begins by accessing the /etc/init. d/boot script – Controls the start of services SUSE Linux Enterprise Desktop Administration 8

init (continued) • After the boot script has been completed, init starts the /etc/init.

init (continued) • After the boot script has been completed, init starts the /etc/init. d/rc script – Uses configured runlevels to start services and daemons • Each runlevel has its own set of services that are initiated SUSE Linux Enterprise Desktop Administration 9

Objective 2—GRUB (Grand Unified Bootloader) • To manage GRUB, the Grand Unified Bootloader, you

Objective 2—GRUB (Grand Unified Bootloader) • To manage GRUB, the Grand Unified Bootloader, you need to know the following: – – – What a Boot Manager Is Boot Managers in SUSE Linux Start the GRUB Shell Modify the GRUB Configuration File Configure GRUB with Ya. ST Boot a System Directly into a Shell SUSE Linux Enterprise Desktop Administration 10

What a Boot Manager Is • Boot loader – A program that loads the

What a Boot Manager Is • Boot loader – A program that loads the operating system into memory – Loads the operating system kernel, which then loads the system • After running the power-on self test (POST), the PC BIOS searches for a boot loader – If it finds one, it turns control of the boot process over to the boot loader • The boot loader then locates the operating system files and starts the operating system SUSE Linux Enterprise Desktop Administration 11

What a Boot Manager Is (continued) • Boot manager – More than a boot

What a Boot Manager Is (continued) • Boot manager – More than a boot loader – Can also handle several operating systems • Linux boot managers can be used to load Linux or other operating systems • GRUB is designed with the following two-stage architecture: – Stage 1—Usually installed in the Master Boot Record (MBR) of the hard disk – Stage 2—Usually contains the actual boot loader SUSE Linux Enterprise Desktop Administration 12

Boot Managers in SUSE Linux • GRUB boot manager – The standard boot manager

Boot Managers in SUSE Linux • GRUB boot manager – The standard boot manager in SUSE Linux Enterprise Desktop – Some special features of GRUB: • File system support • Interactive control • LILO boot manager – LILO configuration file is /etc/lilo. conf – Structure is similar to that of the GRUB configuration file SUSE Linux Enterprise Desktop Administration 13

Boot Managers in SUSE Linux (continued) • Map files, GRUB, and LILO – The

Boot Managers in SUSE Linux (continued) • Map files, GRUB, and LILO – The kernel is usually a file within a file system on a partition on a disk • These concepts are unknown to the BIOS – Maps simply note the physical block numbers on the disk that comprise the logical files – When a map is processed, the BIOS loads all the physical blocks in sequence as noted in the map • Building the logical file in memory – GRUB tries to become independent from the fixed maps at an early stage SUSE Linux Enterprise Desktop Administration 14

Start the GRUB Shell • Start the GRUB shell in the running system –

Start the GRUB Shell • Start the GRUB shell in the running system – Enter the grub command as root – As in a bash shell, you can complete GRUB shell commands with the Tab key • Start the GRUB shell at the boot prompt – From the graphical boot selection menu, press Esc • A text-based menu appears – Start the GRUB shell by typing c (U. S. keyboard layout) SUSE Linux Enterprise Desktop Administration 15

Modify the GRUB Configuration File • Configure GRUB by editing the /boot/grub/menu. lst file

Modify the GRUB Configuration File • Configure GRUB by editing the /boot/grub/menu. lst file • General structure of the file: – General options – Options for the various operating systems that can be booted with GRUB – kernel /boot/vmlinuz – initrd /boot/initrd SUSE Linux Enterprise Desktop Administration 16

Configure GRUB with Ya. ST • To start the Ya. ST Boot Loader module

Configure GRUB with Ya. ST • To start the Ya. ST Boot Loader module – Start Ya. ST, enter the root password, and then select System > Boot Loader or – Start it directly from a terminal window by logging in as root and entering yast 2 bootloader • Select the Section Management tab to see the current GRUB settings for your system SUSE Linux Enterprise Desktop Administration 17

Figure 11 -2 Ya. ST Boot Loader module SUSE Linux Enterprise Desktop Administration 18

Figure 11 -2 Ya. ST Boot Loader module SUSE Linux Enterprise Desktop Administration 18

Figure 11 -3 Section Management SUSE Linux Enterprise Desktop Administration 19

Figure 11 -3 Section Management SUSE Linux Enterprise Desktop Administration 19

Figure 11 -4 Clone Selected Section SUSE Linux Enterprise Desktop Administration 20

Figure 11 -4 Clone Selected Section SUSE Linux Enterprise Desktop Administration 20

Figure 11 -4 Clone Selected Section SUSE Linux Enterprise Desktop Administration 21

Figure 11 -4 Clone Selected Section SUSE Linux Enterprise Desktop Administration 21

Figure 11 -5 Boot Loader Installation tab SUSE Linux Enterprise Desktop Administration 22

Figure 11 -5 Boot Loader Installation tab SUSE Linux Enterprise Desktop Administration 22

Boot a System Directly into a Shell • Boot screen of the GRUB boot

Boot a System Directly into a Shell • Boot screen of the GRUB boot loader: – Lets you enter parameters that modify the behavior of the Linux kernel • At the bottom of the GRUB boot screen is the Boot Options field – To add a boot option, select an operating system and type the additional boot option in the Boot Options field • With the boot parameter init=new_init_program, you can change the first program loaded by the kernel SUSE Linux Enterprise Desktop Administration 23

Boot a System Directly into a Shell (continued) • You are directly logged in

Boot a System Directly into a Shell (continued) • You are directly logged in as root without being asked for a password – Change the boot configuration to require a password before the kernel command line can be edited SUSE Linux Enterprise Desktop Administration 24

Exercise 11 -1: Manage the Boot Loader • In this exercise, you practice booting

Exercise 11 -1: Manage the Boot Loader • In this exercise, you practice booting into a shell and modifying /boot/grub/menu. lst SUSE Linux Enterprise Desktop Administration 25

Objective 3—Manage Runlevels • Managing runlevels is an essential part of Linux system administration

Objective 3—Manage Runlevels • Managing runlevels is an essential part of Linux system administration • In this objective, you learn what runlevels are, the role of the program init, and how to configure and change runlevels: – The init Program and Linux Runlevels – init Scripts and Runlevel Directories – Change the Runlevel SUSE Linux Enterprise Desktop Administration 26

The init Program and Linux Runlevels • The init program – The system is

The init Program and Linux Runlevels • The init program – The system is initialized by /sbin/init • Started by the kernel as the first process of the system – This process, or one of its child processes, starts all additional processes – SIGKILL has no effect on init – The configuration file for init is /etc/inittab – Part of the configuration in /etc/inittab is the runlevel the system uses after booting SUSE Linux Enterprise Desktop Administration 27

The init Program and Linux Runlevels (continued) • The runlevels – Runlevels define the

The init Program and Linux Runlevels (continued) • The runlevels – Runlevels define the state of the system Table 11 -1 The available runlevels SUSE Linux Enterprise Desktop Administration 28

The init Program and Linux Runlevels (continued) • Init configuration file (/etc/inittab) – Each

The init Program and Linux Runlevels (continued) • Init configuration file (/etc/inittab) – Each line in the /etc/inittab file uses the following syntax: id: rl: action: process – The first entry in the /etc/inittab file contains the following parameters: id: 5: initdefault: – The next entry in /etc/inittab looks like this: si: : bootwait: /etc/init. d/boot – The next few entries describe the actions for runlevels 0 to 6 – The final block of entries describes in which runlevels getty processes (login processes) are started SUSE Linux Enterprise Desktop Administration 29

init Scripts and Runlevel Directories • /etc/inittab defines the runlevel the system uses after

init Scripts and Runlevel Directories • /etc/inittab defines the runlevel the system uses after booting is complete • init scripts – The /etc/init. d/ directory contains shell scripts that are used to perform certain tasks at bootup and start and stop services in the running system – The shell scripts can be called up in the following ways: • Directly by init when you boot the system • Indirectly by init when you change the runlevel • Directly by /etc/init. d/script parameter SUSE Linux Enterprise Desktop Administration 30

init Scripts and Runlevel Directories (continued) Table 11 -2 /etc/init. d/script parameters SUSE Linux

init Scripts and Runlevel Directories (continued) Table 11 -2 /etc/init. d/script parameters SUSE Linux Enterprise Desktop Administration 31

init Scripts and Runlevel Directories (continued) • init scripts (continued) – Some of the

init Scripts and Runlevel Directories (continued) • init scripts (continued) – Some of the more important scripts stored in /etc/init. d/: • • • boot. local halt rc service SUSE Linux Enterprise Desktop Administration 32

init Scripts and Runlevel Directories (continued) • Runlevel symbolic links – To enter a

init Scripts and Runlevel Directories (continued) • Runlevel symbolic links – To enter a certain runlevel, init calls the /etc/init. d/rc script with the runlevel as a parameter – This script examines the respective runlevel /etc/init. d/rcx. d/ directory and starts and stops services depending on the links in this directory – Each runlevel has a corresponding subdirectory in /etc/init. d/ SUSE Linux Enterprise Desktop Administration 33

init Scripts and Runlevel Directories (continued) • Runlevel symbolic links (continued) – When you

init Scripts and Runlevel Directories (continued) • Runlevel symbolic links (continued) – When you view the files in a directory such as /etc/init. d/rc 3. d/, you see two kinds of files • Those that start with a ‘‘K’’ and those that start with an ‘‘S’’ – Entering ls -l in an /etc/init. d/rcx. d/ directory indicates that these files are actually symbolic links – By using symbolic links in subdirectories, only the script version in /etc/init. d/ needs to be modified – Usually, two links within a runlevel directory point to the same script SUSE Linux Enterprise Desktop Administration 34

init Scripts and Runlevel Directories (continued) • When you change from your current runlevel

init Scripts and Runlevel Directories (continued) • When you change from your current runlevel 5 to the new runlevel 3, three cases are possible: – There is a Kxx link for a certain service in /etc/init. d/rc 5. d/ and there is an Sxx link in /etc/init. d/rc 3. d/ for the same service • In this case, the service is neither started nor stopped – There is a Kxx link for a certain service in /etc/init. d/rc 5. d/ and there is no corresponding Sxx link in /etc/init. d/rc 3. d/ • In this case, the script in /etc/init. d/service is called with the stop parameter and the service is stopped SUSE Linux Enterprise Desktop Administration 35

init Scripts and Runlevel Directories (continued) • When you change from your current runlevel

init Scripts and Runlevel Directories (continued) • When you change from your current runlevel 5 to the new runlevel 3, three cases are possible: (continued) – There is an Sxx link in /etc/init. d/rc 3. d/ and there is no corresponding Kxx link for the service in /etc/init. d/rc 5. d/ • In this case, the script in /etc/init. d/service is called with the start parameter and the service is started – The number after the K or S determines the sequence in which the scripts are called SUSE Linux Enterprise Desktop Administration 36

init Scripts and Runlevel Directories (continued) • Activate and deactivate services for a runlevel

init Scripts and Runlevel Directories (continued) • Activate and deactivate services for a runlevel – Possible to manually create the symbolic links in the runlevel subdirectories with the ln command – To configure runlevels with Ya. ST • Start the Ya. ST Runlevel Editor module by starting Ya. ST and then selecting System>System Services (Runlevel) • Or open a terminal window and, as root, enter yast 2 runlevel – Modes • Simple mode • Expert mode SUSE Linux Enterprise Desktop Administration 37

Figure 11 -6 The Ya. ST Runlevel Editor module SUSE Linux Enterprise Desktop Administration

Figure 11 -6 The Ya. ST Runlevel Editor module SUSE Linux Enterprise Desktop Administration 38

Figure 11 -7 The Ya. ST Runlevel Editor module in expert mode SUSE Linux

Figure 11 -7 The Ya. ST Runlevel Editor module in expert mode SUSE Linux Enterprise Desktop Administration 39

init Scripts and Runlevel Directories (continued) • Activate and deactivate services for a runlevel

init Scripts and Runlevel Directories (continued) • Activate and deactivate services for a runlevel (continued) – Normally, the default runlevel of a SUSE Linux system is runlevel 5 • Changes to the default runlevel take effect the next time you boot your computer – To configure a service, select a service from the list • Then, from the options below the list, select the runlevels you want associated with the service SUSE Linux Enterprise Desktop Administration 40

Change the Runlevel • Change the runlevel at boot – Possible to boot to

Change the Runlevel • Change the runlevel at boot – Possible to boot to another runlevel by specifying the runlevel on the kernel command line of GRUB • Manage runlevels from the command line – Can change to another runlevel once the system is running by using the init command – Like most modern operating systems, Linux reacts sensitively to being switched off without warning – The shutdown command shuts down the system after the specified time SUSE Linux Enterprise Desktop Administration 41

Exercise 11 -2: Manage Runlevels • In this exercise, you practice configuring runlevels SUSE

Exercise 11 -2: Manage Runlevels • In this exercise, you practice configuring runlevels SUSE Linux Enterprise Desktop Administration 42

Summary • After performing a POST, the BIOS typically loads the boot manager from

Summary • After performing a POST, the BIOS typically loads the boot manager from the MBR • The traditional Linux boot manager is LILO • To manage LILO, you can edit the /etc/lilo. conf file and run the lilo command • A Linux system is categorized using runlevels • The init program is responsible for loading and unloading daemons in a runlevel using its configuration file /etc/inittab SUSE Linux Enterprise Desktop Administration 43

Summary (continued) • The /etc/inittab file runs scripts that start with S (start) or

Summary (continued) • The /etc/inittab file runs scripts that start with S (start) or K (kill) in the /etc/init. d/rcrunlevel. d directory when changing runlevels • You can view your current runlevel using the runlevel or who -r commands • Individual daemons can be started by running the appropriate script in the /etc/init. d directory with the start argument • The halt, poweroff, reboot, and shutdown commands can be used to safely change to runlevel 0 or 6 SUSE Linux Enterprise Desktop Administration 44