By submitting my Email address I confirm that I have read and accepted the Terms of Use and Declaration of Consent.

By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.

You also agree that your personal information may be transferred and processed in the United States, and that you have read and agree to the Terms of Use and the Privacy Policy.

-- GRUB2-based systems.

GRUB2 is appearing on more and more Linux systems as the default bootloader. The last release of every major Linux distribution uses it, so it's only a matter of time before GRUB2 becomes the default bootloader on enterprise Linux distributions such as SUSE Linux Enterprise Server and Red Hat Enterprise Linux.

In GRUB2, almost everything is different. Where the old GRUB bootloader version had a master configuration file /boot/grub/grub.conf, administrators cannot edit the GRUB2 configuration file /boot/grub2/grub.cfg. Instead, you'll work with input files in the directory /etc/grub.d/ along with the configuration file /etc/defaults/grub. After changing these files, you'll update GRUB2 via the grub2-mkconfig command, which writes the information to the appropriate locations in the metadata area at the beginning of your computer's hard drive.

Some things haven't changed from earlier versions; GRUB2 still points to a kernel file and an initrd, which are still needed to boot your server.

Troubleshooting routes

When something goes wrong with the GRUB2 configuration, there are a few troubleshooting options. If your server doesn't boot anymore, you still can access a boot prompt. If your distribution doesn't show a menu while booting, you can enter the GRUB2 boot prompt by pressing the Escape key. When you select the enter mode on the kernel, it shows a boot menu (Listing 1).

Listing 1. This OpenSUSE boot menu is one example of how you can troubleshoot problems with the GRUB2 bootloader.

GRUB2 roots

To start with, the line set root='hd0,msdos1' in Listing 1 identifies the boot device as the first hard disk (hd) and, on that hard disk, the second partition is identified as msdos1. This has nothing to do with the legacy Microsoft MS-DOS operating system, but is all about disk compatibility. A disk that uses a master boot record (MBR) is known as an msdos disk type; msdos1 means that GRUB2 has to look inside the partition table of this disk to identify the second partition.

When no MBR system is used, the piece of shell code inside the GRUB2 bootloader makes sure all possible options are considered and GRUB2 figures out which type is in use.

More Linux boot problems

GRUB2 also changes how you work with modules. Modules are referred to from the first lines of the GRUB2 configuration using the insmod command. The GRUB2 bootloader uses file system support modules as well as hardware support modules. The /boot/grub2/i386-pc directory lists all modules available. Many new items are supported, including new Linux file systems such as btrfs or even ZFS, and disk layout features such as LVM and LUKS encrypted devices. And, of course, it supports the new UEFI-based (Unified Extensible Firmware Interface) disk layout.

From the GRUB boot shell, you can modify any parameter, then press F10 to boot your system. Remember to apply the changes persistently to your server once it has booted completely by modifying the /etc/default/grub file or the appropriate configuration files in /etc/grub.d.

If the GRUB2 configuration becomes damaged in a way that doesn't allow you to boot into the GRUB shell, use a rescue disk, preferably the one that came with your OS. If necessary, use a generic rescue disk, such as Knoppix. Once booted from the rescue disk, you can execute the grub2-install command to reinstall the GRUB2 boot image to the metadata area of your hard disk.

0 comments

Register

Login

Forgot your password?

Your password has been sent to:

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy