From a994a311dc6a7d810136da39d4d51a3fce854925 Mon Sep 17 00:00:00 2001 From: Lukas Ruzicka Date: Tue, 12 Dec 2017 17:56:25 +0100 Subject: [PATCH] Partly modularize content --- en-US/installing-grub2.adoc | 27 + en-US/installing-grub2.html | 789 ++++++++++++++++++ ..._adding-other-operating-systems-grub2.adoc | 30 + ...ing-menu-entries-with-uefi-bootloader.adoc | 38 + .../proc_installing-grub2-on-bios-system.adoc | 54 ++ .../proc_installing-grub2-on-efi-system.adoc | 89 ++ en-US/pool.adoc | 51 ++ 7 files changed, 1078 insertions(+) create mode 100644 en-US/installing-grub2.adoc create mode 100644 en-US/installing-grub2.html create mode 100644 en-US/modules/proc_adding-other-operating-systems-grub2.adoc create mode 100644 en-US/modules/proc_creating-menu-entries-with-uefi-bootloader.adoc create mode 100644 en-US/modules/proc_installing-grub2-on-bios-system.adoc create mode 100644 en-US/modules/proc_installing-grub2-on-efi-system.adoc create mode 100644 en-US/pool.adoc diff --git a/en-US/installing-grub2.adoc b/en-US/installing-grub2.adoc new file mode 100644 index 0000000..58485f0 --- /dev/null +++ b/en-US/installing-grub2.adoc @@ -0,0 +1,27 @@ +:md: ./modules + + += Installing *GRUB2* +[[installing-grub2]] + +*GRUB2* is the latest version of *GNU GRUB*, the _GRand Unified Bootloader_. +A bootloader is the first software program that runs when a computer +starts. It is responsible for loading and transferring control to the +operating system kernel. In Fedora, the kernel is Linux. The kernel then initializes +the rest of the operating system. + +*GRUB2* is the follower of the previous version *GRUB* (version 0.9x). The original version is available under the name *GRUB Legacy*. + +Since Fedora 16, *GRUB2* has been the default bootloader on x86 BIOS +systems. For upgrades of BIOS systems, the default is also to install +*GRUB2*, but you can opt to skip bootloader configuration entirely. + +include::{md}/proc_installing-grub2-on-bios-system.adoc[leveloffset=+1] + +include::{md}/proc_installing-grub2-on-efi-system.adoc[leveloffset=+1] + +include::{md}/proc_creating-menu-entries-with-uefi-bootloader.adoc[leveloffset=+1] + +include::{md}/proc_adding-other-operating-systems-grub2.adoc[leveloffset=+1] + + diff --git a/en-US/installing-grub2.html b/en-US/installing-grub2.html new file mode 100644 index 0000000..dcd5896 --- /dev/null +++ b/en-US/installing-grub2.html @@ -0,0 +1,789 @@ + + + + + + + + +Installing GRUB2 + + + + + +
+
+
+
+

GRUB2 is the latest version of GNU GRUB, the GRand Unified Bootloader. +A bootloader is the first software program that runs when a computer +starts. It is responsible for loading and transferring control to the +operating system kernel. In Fedora, the kernel is Linux. The kernel then initializes +the rest of the operating system.

+
+
+

GRUB2 is the follower of the previous version GRUB (version 0.9x). The original version is available under the name GRUB Legacy.

+
+
+

Since Fedora 16, GRUB2 has been the default bootloader on x86 BIOS +systems. For upgrades of BIOS systems, the default is also to install +GRUB2, but you can opt to skip bootloader configuration entirely.

+
+
+
+
+

Installing GRUB2 on a BIOS system

+
+
+

Normally, GRUB2 will be installed and set up by the installer, Anaconda, during the installation process. You will probably never have to deal with manual installation of GRUB2. However, in certain situations , you will want to install GRUB2 manually, especially if you need to repair the existing GRUB2 installation or you want to change its configuration.

+
+
+

This procedure shows the steps to install GRUB2 on your Master Boot Record (MBR) of your primary hard disk.

+
+
+

Before you start:

+
+
+
Before you start
+
    +
  • +

    Make sure you have the the GRUB2 packages and the os-prober package installed in your system:

    +
    +
    +
    $ dnf list installed | grep grub
    +
    +
    +
  • +
  • +

    To automatically collect information about your disks and operating systems installed on them, the os-prober package needs to be installed on your system.

    +
  • +
+
+
+
Procedure
+
    +
  1. +

    List block devices available on the system.

    +
    +
    +
    $ lsblk
    +
    +
    +
  2. +
  3. +

    Identify the primary hard disk. Usually, it is the sda device.

    +
  4. +
  5. +

    Install GRUB2 in the MBR of the primary hard disk.

    +
    +
    +
    $ sudo grub2-install /dev/sda
    +
    +
    +
  6. +
  7. +

    Create a configuration file for GRUB2.

    +
    +
    +
    $ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    +
    +
    +
  8. +
  9. +

    Reboot your computer to boot with the newly installed bootloader.

    +
  10. +
+
+
+
More information
+
    +
  • +

    The grub2-mkconfig command creates a new configuration based on the currently +running system. It collects information from the /boot partition (or directory), from the /etc/default/grub file, and the customizable scripts in /etc/grub.d/.

    +
  • +
  • +

    The configuration format is changing with time, and a new configuration +file can become slightly incompatible with the older versions of the bootloader. Always run grub2-install before you create the configuration file with grub2-mkconfig.

    +
  • +
  • +

    In Fedora, it is generally safe to edit /boot/grub2/grub.cfg manually. Grubby in Fedora patches the configuration when a kernel update is performed and will try to not make any other changes than what is necessary. Manual changes can be overwritten with grub2-mkconfig when the system gets upgraded with +Anaconda. Customizations placed in /etc/grub.d/40_custom or +/boot/grub2/custom.cfg files will survive running the grub2-mkconfig command.

    +
  • +
+
+
+
+
+

Installing GRUB2 on a UEFI system

+
+
+

Normally, GRUB2 will be installed and set up by the installer, Anaconda, during the installation process. You will probably never have to deal with manual installation of GRUB2. However, in certain situations , you will want to install GRUB2 manually, especially if you need to repair the existing GRUB2 installation or you want to change its configuration.

+
+
+

This procedure shows the steps to install GRUB2 on a UEFI system on Fedora 18 or newer. The procedure consists of three parts.

+
+
+

Creating an EFI System Partition

+
+

The UEFI firmware requires to boot from an EFI System Partition on +a disk with a GPT label. To create such a partition:

+
+
+
    +
  1. +

    List available block devices to find a place to create your ESP.

    +
    +
    +
    $ lsblk
    +
    +
    +
  2. +
  3. +

    Create at least a 128 MiB disk partition using a GPT label on the primary hard disk.

    +
    +
    +
    $ sudo gdisk /dev/sda
    +
    +
    +
    +

    For the sake of this procedure, we assume that the created partition is recognized as /dev/sda1.

    +
    +
  4. +
  5. +

    Format the partition with the FAT32 file system.

    +
    +
    +
    $ sudo mkfs.vfat /dev/sda1
    +
    +
    +
  6. +
  7. +

    Create the /boot/efi directory as a mount point for the new partition.

    +
    +
    +
    $ sudo mkdir /boot/efi
    +
    +
    +
  8. +
  9. +

    Mount the partition to the /boot/efi mount point.

    +
    +
    +
    $ sudo mount /dev/sda1 /boot/efi
    +
    +
    +
  10. +
  11. +

    Proceed to the next part.

    +
  12. +
+
+
+
+

Install the bootloader files

+
+

In order to use GRUB2 with on the UEFI systems, you need to install or re-install appropriate packages:

+
+
+
    +
  1. +

    Re-install the necessary packages.

    +
    +
    +
    dnf reinstall grub2-efi grub2-efi-modules shim
    +
    +
    +
  2. +
  3. +

    If the above command ends with an error, install the packages.

    +
    +
    +
    dnf install grub2-efi grub2-efi-modules shim
    +
    +
    +
  4. +
+
+
+
More information
+
    +
  • +

    This installs the signed shim and the GRUB2 binary.

    +
  • +
+
+
+
+

Create a GRUB2 configuration

+
+

If you already have a working GRUB2 EFI configuration file, you do not need to do anything else.

+
+
+

Otherwise, create the configuration file using the grub2-mkconfig command.

+
+
+
+
$ sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
+
+
+
+
More information
+
    +
  • +

    Under EFI, GRUB2 looks for its configuration in +/boot/efi/EFI/fedora/grub.cfg.

    +
  • +
  • +

    For newly installed kernels to work, +grubby expects /etc/grub2-efi.cfg to be a symlink to the real +grub.cfg (for example /boot/efi/EFI/fedora/grub.cfg).

    +
  • +
+
+
+
+
+
+

Creating the boot menu entries with UEFI bootloader

+
+
+

When you power on your system, your firmware will look for EFI variables that tell it how to boot. On running systems, which have booted into the EFI mode and their EFI runtime services are working correctly, you can configure your boot menu with efibootmgr.

+
+
+

If not, shim can help you bootstrap. The EFI program +/boot/efi/EFI/BOOT/fallback.efi will look for files called BOOT.CSV +in your ESP and will add boot entries corresponding to them. The shim command +provides its own BOOT.CSV file that will add an entry for grub2-efi.

+
+
+

During the boot process, you can use the EFI Shell to invoke the fallback.efi profile to boot the system:

+
+
+
    +
  1. +

    Enter the boot partition.

    +
    +
    +
    > fs0:
    +
    +
    +
  2. +
  3. +

    Navigate into the EFI\BOOT directory.

    +
    +
    +
    > cd EFI\BOOT
    +
    +
    +
  4. +
  5. +

    Invoke the fallback.efi profile.

    +
    +
    +
    > fallback.efi
    +
    +
    +
  6. +
+
+
+
More information
+
    +
  • +

    If you have no boot entries at all, then just booting off your disk in +UEFI mode should automatically invoke /boot/efi/EFI/BOOT/BOOTX64.EFI, +which will, in turn, invoke fallback.efi.

    +
  • +
  • +

    If you already have incorrect boot entries, you’ll either need to delete +them or to modify BOOT.CSV to create new entries with different names.

    +
  • +
+
+
+
+
+

Adding other operating systems to the GRUB2 menu

+
+
+

Normally, GRUB2 is preset to boot multiple operating systems during the Fedora installation process. If you can, it is advisable to install non-Linux operating systems first. Then, during the installation process, all those operating systems and their locations will be discovered and properly set.

+
+
+

Sometimes, however, you cannot use this approach and you will have to create the bootloader configuration file again to enable it to boot more operating systems.

+
+
+
Before you start
+
    +
  • +

    Make sure that the operating systems are on disks, connected to the system.

    +
  • +
  • +

    You have the os-prober package installed.

    +
  • +
+
+
+
Procedure
+
    +
  1. +

    Install GRUB2 into the MBR of your primary hard disk.

    +
    +
    +
    $ sudo grub2-install /dev/sda
    +
    +
    +
  2. +
  3. +

    Recreate the GRUB2 configuration file.

    +
    +
    +
    $ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    +
    +
    +
  4. +
+
+
+
More information
+
    +
  • +

    The grub2-mkconfig command will add entries for all operating systems it can find.

    +
  • +
  • +

    When problems appear, see the GRUB manual to solve issues with booting secondary operating systems.

    +
  • +
+
+
+
+
+ + + \ No newline at end of file diff --git a/en-US/modules/proc_adding-other-operating-systems-grub2.adoc b/en-US/modules/proc_adding-other-operating-systems-grub2.adoc new file mode 100644 index 0000000..dd918d3 --- /dev/null +++ b/en-US/modules/proc_adding-other-operating-systems-grub2.adoc @@ -0,0 +1,30 @@ += Adding other operating systems to the *GRUB2* menu +[[adding-other-operating-systems-to-the-grub-2-menu]] + +Normally, *GRUB2* is preset to boot multiple operating systems during the Fedora installation process. If you can, it is advisable to install non-Linux operating systems first. Then, during the installation process, all those operating systems and their locations will be discovered and properly set. + +Sometimes, however, you cannot use this approach and you will have to create the bootloader configuration file again to enable it to boot more operating systems. + +.Before you start + +* Make sure that the operating systems are on disks, connected to the system. +* You have the `os-prober` package installed. + +.Procedure + +. Install *GRUB2* into the MBR of your primary hard disk. ++ +---- +$ sudo grub2-install /dev/sda +---- + +. Recreate the *GRUB2* configuration file. ++ +---- +$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg +---- + +.More information +* The `grub2-mkconfig` command will add entries for all operating systems it can find. +* When problems appear, see the link:http://www.gnu.org/software/grub/manual/grub.html#Multi_002dboot-manual-config[GRUB manual] to solve issues with booting secondary operating systems. + diff --git a/en-US/modules/proc_creating-menu-entries-with-uefi-bootloader.adoc b/en-US/modules/proc_creating-menu-entries-with-uefi-bootloader.adoc new file mode 100644 index 0000000..e76cde1 --- /dev/null +++ b/en-US/modules/proc_creating-menu-entries-with-uefi-bootloader.adoc @@ -0,0 +1,38 @@ += Creating the boot menu entries with UEFI bootloader +[[creating-the-boot-menu-entries-with-uefi-bootloader]] + +When you power on your system, your firmware will look for EFI variables that tell it how to boot. On running systems, which have booted into the EFI mode and their EFI runtime services are working correctly, you can configure your boot menu with `efibootmgr`. + +If not, `shim` can help you bootstrap. The EFI program +`/boot/efi/EFI/BOOT/fallback.efi` will look for files called `BOOT.CSV` +in your ESP and will add boot entries corresponding to them. The `shim` command +provides its own `BOOT.CSV` file that will add an entry for `grub2-efi`. + +During the boot process, you can use the *EFI Shell* to invoke the `fallback.efi` profile to boot the system: + +. Enter the boot partition. ++ +---- +> fs0: +---- + +. Navigate into the `EFI\BOOT` directory. ++ +---- +> cd EFI\BOOT +---- + +. Invoke the `fallback.efi` profile. ++ +---- +> fallback.efi +---- + +.More information +* If you have no boot entries at all, then just booting off your disk in +UEFI mode should automatically invoke `/boot/efi/EFI/BOOT/BOOTX64.EFI`, +which will, in turn, invoke `fallback.efi`. +* If you already have incorrect boot entries, you'll either need to delete +them or to modify `BOOT.CSV` to create new entries with different names. + + diff --git a/en-US/modules/proc_installing-grub2-on-bios-system.adoc b/en-US/modules/proc_installing-grub2-on-bios-system.adoc new file mode 100644 index 0000000..1d2c948 --- /dev/null +++ b/en-US/modules/proc_installing-grub2-on-bios-system.adoc @@ -0,0 +1,54 @@ += Installing GRUB2 on a BIOS system +[[installing-grub-2-on-a-bios-system]] + +Normally, *GRUB2* will be installed and set up by the installer, *Anaconda*, during the installation process. You will probably never have to deal with manual installation of *GRUB2*. However, in certain situations , you will want to install *GRUB2* manually, especially if you need to repair the existing *GRUB2* installation or you want to change its configuration. + +This procedure shows the steps to install *GRUB2* on your _Master Boot Record_ (MBR) of your primary hard disk. + +Before you start: + + +.Before you start + +* Make sure you have the the *GRUB2* packages and the `os-prober` package installed in your system: ++ +---- +$ dnf list installed | grep grub +---- + +* To automatically collect information about your disks and operating systems installed on them, the `os-prober` package needs to be installed on your system. + +.Procedure + +. List block devices available on the system. ++ +---- +$ lsblk +---- + +. Identify the primary hard disk. Usually, it is the `sda` device. + +. Install *GRUB2* in the MBR of the primary hard disk. ++ +---- +$ sudo grub2-install /dev/sda +---- + +. Create a configuration file for *GRUB2*. ++ +---- +$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg +---- + +. Reboot your computer to boot with the newly installed bootloader. + +.More information + +* The `grub2-mkconfig` command creates a new configuration based on the currently +running system. It collects information from the `/boot` partition (or directory), from the `/etc/default/grub` file, and the customizable scripts in `/etc/grub.d/`. +* The configuration format is changing with time, and a new configuration +file can become slightly incompatible with the older versions of the bootloader. Always run `grub2-install` before you create the configuration file with `grub2-mkconfig`. +* In Fedora, it is generally safe to edit `/boot/grub2/grub.cfg` manually. *Grubby* in Fedora patches the configuration when a kernel update is performed and will try to not make any other changes than what is necessary. Manual changes can be overwritten with `grub2-mkconfig` when the system gets upgraded with +*Anaconda*. Customizations placed in `/etc/grub.d/40_custom` or +`/boot/grub2/custom.cfg` files will survive running the `grub2-mkconfig` command. + diff --git a/en-US/modules/proc_installing-grub2-on-efi-system.adoc b/en-US/modules/proc_installing-grub2-on-efi-system.adoc new file mode 100644 index 0000000..a02b345 --- /dev/null +++ b/en-US/modules/proc_installing-grub2-on-efi-system.adoc @@ -0,0 +1,89 @@ += Installing GRUB2 on a UEFI system +[[installing-grub-2-configuration-on-uefi-system]] + +Normally, *GRUB2* will be installed and set up by the installer, *Anaconda*, during the installation process. You will probably never have to deal with manual installation of *GRUB2*. However, in certain situations , you will want to install *GRUB2* manually, especially if you need to repair the existing *GRUB2* installation or you want to change its configuration. + +This procedure shows the steps to install *GRUB2* on a UEFI system on Fedora 18 or newer. The procedure consists of three parts. + +== Creating an EFI System Partition +[[create-an-esp]] + +The UEFI firmware requires to boot from an _EFI System Partition_ on +a disk with a GPT label. To create such a partition: + +. List available block devices to find a place to create your ESP. ++ +---- +$ lsblk +---- + +. Create at least a 128 MiB disk partition using a GPT label on the primary hard disk. ++ +---- +$ sudo gdisk /dev/sda +---- ++ +For the sake of this procedure, we assume that the created partition is recognized as `/dev/sda1`. + +. Format the partition with the _FAT32_ file system. ++ +---- +$ sudo mkfs.vfat /dev/sda1 +---- + +. Create the `/boot/efi` directory as a mount point for the new partition. ++ +---- +$ sudo mkdir /boot/efi +---- + +. Mount the partition to the `/boot/efi` mount point. ++ +---- +$ sudo mount /dev/sda1 /boot/efi +---- + +. Proceed to the next part. + + +== Install the bootloader files +[[install-the-bootloader-files]] + +In order to use *GRUB2* with on the UEFI systems, you need to install or re-install appropriate packages: + + +. Re-install the necessary packages. ++ +---- +dnf reinstall grub2-efi grub2-efi-modules shim +---- + +. If the above command ends with an error, install the packages. ++ +---- +dnf install grub2-efi grub2-efi-modules shim +---- + +.More information + +* This installs the signed *shim* and the *GRUB2* binary. + +== Create a GRUB2 configuration +[[create-a-grub-2-configuration]] + + +If you already have a working *GRUB2* EFI configuration file, you do not need to do anything else. + +Otherwise, create the configuration file using the `grub2-mkconfig` command. + +---- +$ sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg +---- + +.More information +* Under EFI, *GRUB2* looks for its configuration in +`/boot/efi/EFI/fedora/grub.cfg`. +* For newly installed kernels to work, +`grubby` expects `/etc/grub2-efi.cfg` to be a symlink to the real +grub.cfg (for example `/boot/efi/EFI/fedora/grub.cfg`). + diff --git a/en-US/pool.adoc b/en-US/pool.adoc new file mode 100644 index 0000000..c679903 --- /dev/null +++ b/en-US/pool.adoc @@ -0,0 +1,51 @@ + +[[setting-default-entry]] +== Setting default entry + +Due to `grub2-mkconfig` (and *os-prober*) we cannot predict the order of +the entries in `/boot/grub2/grub.cfg`, so we set the default by +name/title instead. + +.Before you start + +. Open `/etc/default/grub` and make sure these lines exist in the file. ++ +---- +GRUB_DEFAULT=saved +GRUB_SAVEDEFAULT=false +---- + +. Apply the changes to `grub.cfg` by running. ++ +---- +$sudo grub2-mkconfig -o /boot/grub2/grub.cfg +---- + +.Procedure + +. List all possible menu entries. ++ +---- +$sudo grep -P "submenu|^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2 +---- + +. Set the desired default menu entry ++ +---- +$sudo grub2-set-default "" +---- + +. Verify the default menu entry ++ +---- +$sudo grub2-editenv list +---- + +.More information +If you understand the risks involved, you can manually modify the +`/boot/grub2/grub.cfg` file. In that case, set the number of the default operating system using the `set default` variable. + +For example: +---- +set default="5" +----