430 likes | 780 Views
SUSE Linux Enterprise Desktop Administration. Objectives. Objective 1Describe the Linux Load ProcedureObjective 2GRUB (Grand Unified Bootloader)Objective 3Manage Runlevels. 2. SUSE Linux Enterprise Desktop Administration. Objective 1Describe the Linux Load Procedure. 3. The basic steps of boot
E N D
1. SUSE Linux Enterprise Desktop Administration Chapter 11
Manage System Initialization
2. SUSE Linux Enterprise Desktop Administration Objectives Objective 1—Describe the Linux Load Procedure
Objective 2—GRUB (Grand Unified Bootloader)
Objective 3—Manage Runlevels 2
3. SUSE Linux Enterprise Desktop Administration Objective 1—Describe the Linux Load Procedure 3
4. SUSE Linux Enterprise Desktop Administration 4
5. SUSE Linux Enterprise Desktop Administration 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 5
6. SUSE Linux Enterprise Desktop Administration 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 6
7. SUSE Linux Enterprise Desktop Administration 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 7
8. SUSE Linux Enterprise Desktop Administration 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 8
9. SUSE Linux Enterprise Desktop Administration 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 9
10. SUSE Linux Enterprise Desktop Administration 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 YaST
Boot a System Directly into a Shell 10
11. SUSE Linux Enterprise Desktop Administration 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 11
12. SUSE Linux Enterprise Desktop Administration 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 12
13. SUSE Linux Enterprise Desktop Administration 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 13
14. SUSE Linux Enterprise Desktop Administration 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 14
15. SUSE Linux Enterprise Desktop Administration 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) 15
16. SUSE Linux Enterprise Desktop Administration Modify the GRUB Configuration File 16
17. SUSE Linux Enterprise Desktop Administration Configure GRUB with YaST To start the YaST Boot Loader module
Start YaST, 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 yast2 bootloader
Select the Section Management tab to see the current GRUB settings for your system
17
18. SUSE Linux Enterprise Desktop Administration 18
19. SUSE Linux Enterprise Desktop Administration 19
20. SUSE Linux Enterprise Desktop Administration 20
21. SUSE Linux Enterprise Desktop Administration 21
22. SUSE Linux Enterprise Desktop Administration 22
23. SUSE Linux Enterprise Desktop Administration 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 23
24. SUSE Linux Enterprise Desktop Administration 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 24
25. SUSE Linux Enterprise Desktop Administration Exercise 11-1: Manage the Boot Loader In this exercise, you practice booting into a shell and modifying /boot/grub/menu.lst 25
26. SUSE Linux Enterprise Desktop 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 26
27. SUSE Linux Enterprise Desktop Administration 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 27
28. SUSE Linux Enterprise Desktop Administration The init Program and Linux Runlevels (continued) The runlevels
Runlevels define the state of the system
28
29. SUSE Linux Enterprise Desktop Administration 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 29
30. SUSE Linux Enterprise Desktop Administration 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 30
31. SUSE Linux Enterprise Desktop Administration init Scripts and Runlevel Directories (continued) 31
32. SUSE Linux Enterprise Desktop Administration init Scripts and Runlevel Directories (continued) init scripts (continued)
Some of the more important scripts stored in /etc/init.d/:
boot
boot.local
halt
rc
service 32
33. SUSE Linux Enterprise Desktop Administration 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/ 33
34. SUSE Linux Enterprise Desktop Administration init Scripts and Runlevel Directories (continued) Runlevel symbolic links (continued)
When you view the files in a directory such as /etc/init.d/rc3.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 34
35. SUSE Linux Enterprise Desktop Administration 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/rc5.d/ and there is an Sxx link in /etc/init.d/rc3.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/rc5.d/ and there is no corresponding Sxx link in /etc/init.d/rc3.d/
In this case, the script in /etc/init.d/service is called with the stop parameter and the service is stopped 35
36. SUSE Linux Enterprise Desktop Administration 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/rc3.d/ and there is no corresponding Kxx link for the service in /etc/init.d/rc5.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 36
37. SUSE Linux Enterprise Desktop Administration 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 YaST
Start the YaST Runlevel Editor module by starting YaST and then selecting System>System Services (Runlevel)
Or open a terminal window and, as root, enter yast2 runlevel
Modes
Simple mode
Expert mode 37
38. SUSE Linux Enterprise Desktop Administration 38
39. SUSE Linux Enterprise Desktop Administration 39
40. SUSE Linux Enterprise Desktop Administration 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 40
41. SUSE Linux Enterprise Desktop Administration 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 41
42. SUSE Linux Enterprise Desktop Administration Exercise 11-2: Manage Runlevels In this exercise, you practice configuring runlevels 42
43. SUSE Linux Enterprise Desktop Administration 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 43
44. SUSE Linux Enterprise Desktop Administration 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 44