Title: SUSE Linux Enterprise Desktop Administration
1SUSE Linux Enterprise Desktop Administration
- Chapter 11
- Manage System Initialization
2Objectives
- Objective 1Describe the Linux Load Procedure
- Objective 2GRUB (Grand Unified Bootloader)
- Objective 3Manage Runlevels
3Objective 1Describe 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
4Figure 11-1 The basic steps of booting a computer
with Linux
5BIOS 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
6Kernel
- 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
7initramfs (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
8init
- 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
9init (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
10Objective 2GRUB (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
11What 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
12What 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 1Usually installed in the Master Boot
Record (MBR) of the hard disk - Stage 2Usually contains the actual boot loader
13Boot 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
14Boot 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
15Start 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)
16Modify 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
17Configure GRUB with YaST
- To start the YaST Boot Loader module
- Start YaST, enter the root password, and then
select System gt 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
18Figure 11-2 YaST Boot Loader module
19Figure 11-3 Section Management
20Figure 11-4 Clone Selected Section
21Figure 11-4 Clone Selected Section
22Figure 11-5 Boot Loader Installation tab
23Boot 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 initnew_init_program,
you can change the first program loaded by the
kernel
24Boot 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
25Exercise 11-1 Manage the Boot Loader
- In this exercise, you practice booting into a
shell and modifying /boot/grub/menu.lst
26Objective 3Manage 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
27The 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
28The init Program and Linux Runlevels (continued)
- The runlevels
- Runlevels define the state of the system
Table 11-1 The available runlevels
29The init Program and Linux Runlevels (continued)
- Init configuration file (/etc/inittab)
- Each line in the /etc/inittab file uses the
following syntax idrlactionprocess - The first entry in the /etc/inittab file contains
the following parameters id5initdefault - The next entry in /etc/inittab looks like this
sibootwait/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
30init 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
31init Scripts and Runlevel Directories (continued)
Table 11-2 /etc/init.d/script parameters
32init 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
33init 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/
34init 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
35init 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
36init 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
37init 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 SystemgtSystem Services
(Runlevel) - Or open a terminal window and, as root, enter
yast2 runlevel - Modes
- Simple mode
- Expert mode
38Figure 11-6 The YaST Runlevel Editor module
39Figure 11-7 The YaST Runlevel Editor module in
expert mode
40init 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
41Change 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
42Exercise 11-2 Manage Runlevels
- In this exercise, you practice configuring
runlevels
43Summary
- 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
44Summary (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