![]() | Red Hat Certified System Administration 8 |
Chapter 17: Managing and Understanding the Boot ProcedureGoalAutomate the installation of Red Hat Enterprise Linux systems with KickstartSommaireBoot processBooting Steps
Grand Unified Bootloader (GRUB)Grand Unified Bootloader (GRUB)GRUB Grand Unified Bootloader Red Hat default boot managerTape A on boot time to show grub options. Tape a to show grub settings Settingscrashkernel = value-1 ... value-nvalues ■ auto ■ rhgb ■ quiet : stop system running information show ■ single : enter in root mode without password but in this case you can execute only runlevel 1 scripts (/etc/rc1.d/) init = /bin/sh don’t charge init process files. Mount only file system root (/) in read-only mode Boot files/etc/inittab lists the default runlevel to boot into and the system initialization (SysVinit File)commandsgrub-md5-crypt grub-installprotect boot configuration access#grub-md5-crypt tape passwordit generates password hash copy it and add in the file just before the first title password - -md5 hash add an OS entryDuring the boot process, everything is logged to the /var/log/dmesg file. You can also use the dmesg command to query information about the boot process after the system has booted. When the system’s drivers are in place, the kernel executes the /sbin/init program. The init program is the first process created by the kernel. It is responsible for the rest of the boot process and setting up the environment for the user. First, it consults the /etc/inittab file, which defines how the rest of the boot process will go. The /etc/inittab file lists the default runlevel to boot into and the system initialization script (/etc/rc.d/rc.sysinit). I describe what a runlevel is and how it is used later in this chapter. Let’s look at the /etc/inittab file to see what the init process goes through: In both versions of Red Hat, you can also edit the config file from within the GRUB command line as well. Using the c option to enter the GRUB command line, you can make changes to the config file, reinstall GRUB, or repair a broken config file. GrubFiles and Directories/boot/grub2//boot/grub2/grub.cfg /etc/default/grub Understanding GRUB 2The GRUB 2 boot loader makes sure that you can boot Linux. GRUB 2 is installed in the boot sector of your server’s hard drive and is configured to load a Linux kernel and the initramfs: ■ The kernel is the heart of the operating system, allowing users to interact with the hardware that is installed in the server. ■ The initramfs contains drivers that are needed to start your server. It contains a mini file system that is mounted during boot. In it are kernel modules that are needed during the rest of the boot process (for example, the LVM modules and SCSI modules for accessing disks that are not supported by default). Normally, GRUB 2 works just fine and does not need much maintenance. In some cases, though, you might have to change its configuration. To apply changes to the GRUB 2 configuration, the starting point is the /etc/default/grub file. In this file, you’ll find options that tell GRUB what to do and how to do it. Apart from the configuration in /etc/default/grub, there are a few configuration files in /etc/grub.d. In these files, you’ll find rather complicated shell code that tells GRUB what to load and how to load it. You typically do not have to modify it. You also will not need to modify anything if you want to make it possible to select from different kernels while booting. GRUB 2 picks up new kernels automatically and adds them to the boot menu automatically, so nothing has to be added manually. Based on the configuration files mentioned previously, the main configuration file / boot/grub2/grub.cfg is created. Even if this looks like a configuration file that can be manually modified, you should never do that, because it will get overwritten at some point. This will happen, for instance, after updating the kernel. The RPM from which the kernel is updated will run a post-installation script that regenerates Modifying Default GRUB 2 Boot OptionsTo apply modifications to the GRUB 2 boot loader, the file /etc/default/grub is your entry point; do not change the contents of the /boot/grub2/grub.cfg configuration file directly. The most important line in this file is GRUB_CMDLINE_LINUX, which defines how the Linux kernel should be started. In this line, you can apply permanent fixes to the GRUB 2 configuration. Some likely candidates for removal are the options rhgb and quiet . These options tell the kernel to hide all output while booting. That is nice to hide confusing messages for end users, but if you are a server administrator, you probably just want to remove these options. KickstartKickstartKickstart installation stepsAn ordered process is required to automate the successful installation of Red Hat Enterprise Linux.Three steps must be taken to perform a Kickstart installation: 1. Create a Kickstart configuration file. 2. Publish the Kickstart configuration file to the installer. 3. Boot Anaconda and point it to the Kickstart configuration file. Create a Kickstart configuration fileThere are two ways to create a Kickstart configuration file:• Use the system-config-kickstart utility. • Use a text editor. The system-config-kickstart utility presents a number of graphical dialog boxes, takes inputs from the user, then creates a text file with Kickstart directives that correspond to the user's choices. Each dialog box corresponds to a category of questions as ked by the Red Hat installer, Anaconda . Optionally, an existing configuration file can be passed as an argument and system-config-kickstart will use it to populate values for configuration options. system-config-kickstart is provided by the system-config-kickstart package. Creating a Kickstart configuration file from scratch with a text editor is rare. The Anaconda installer creates a file called /root/anaconda-ks.cfg that contains the Kickstart directives that can be used to generate the freshly installed system . This file makes a good starting point when creating a Kickstart configuration file with a text editor. The following are some reasons for creating a Kickstart file manually instead of using system config-kickstart:1. The GUI and/or system-config-kickstart is unavailable. 2. Advanced disk partition configuration instructions are needed. system-config kickstart does not support LVM and software RAID. 3. Individual packages need to be included or omitted (not just groups). 4. More advanced scripting is needed in the %pre and %post sections. ksvalidator is a utility that checks for syntax errors in a Kickstart configuration file. It will ensure keywords and options are properly used, but it will not validate URL paths, individual packages, or groups, nor any part of %post or %pre scripts. For instance, if the firewall - - disabled directive is misspelled, ksvalidator could produce one of the following errors: [student@desktop X] $ ksvalidator /tmp/anaconda-ks.cfgThe following problem occurred on line 10 of the kickstart file: Unknown command : frewall [student@desktop X] $ ksvalidator /tmp/anaconda-ks.cfg The following problem occurred on line 10 of the kickstart file: no such option: - - dsabled Publish the Kickstart configuration file to AnacondaMake the Kickstart configuration file available to the installer:• Network servers: FTP, HTTP, NFS • DHCP/TFTP server • USB disk or CD-ROM • Local hard disk The installer must be able to access the Kickstart file to begin an automated installation. Although there are several methods to make the Kickstart configuration file available, the most common is through a network server such as an FTP server, a web server, or an NFS server. Network servers facilitate Kickstart file maintenance because changes only need to be made once and take effect immediately. Providing Kickstart files on USB or CD-ROM is a not her convenient way to publish configuration files. The Kickstart configuration file is embedded on the boot media used to start the installation. When changes a remade , new installation media must be generated. It is possible to provide the Kickstart file on a local disk. This allows a quick way to rebuild a development server. Boot Anaconda and point it to the Kickstartconfiguration fileOnce a Kickstart method is chosen, the installer must be told where the Kickstart file is located. This is done by passing a ks=LOCATION argument to the installation kernel. The following are some sample specifications: • ks=http://server/dir/file • ks=ftp://server/dir/file • ks=nfs:server:/dir/file • ks=hd:device:/dir/file • ks=cdrom:/dir/file For virtual machine installations using the Virtual Machine Manager or virt-manager, the Kickstart URL can be specified in a box under URL Options. When installing physical machines■ Boot using installation media and press the Tab key to interrupt the boot process. ■ Enter one of the ks= entries above as a parameter to the installation kernel. |