quick-docs/modules/ROOT/partialsdelete/2delete-proc_installing-grub2-on-efi-system.adoc

123 lines
3.9 KiB
Text
Raw Normal View History

2017-12-12 16:56:25 +00:00
[[installing-grub-2-configuration-on-uefi-system]]
2018-01-20 17:59:12 +00:00
= Installing GRUB2 on a UEFI system
2017-12-12 16:56:25 +00:00
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 four parts.
2017-12-12 16:56:25 +00:00
[[create-an-esp]]
2018-01-20 17:59:12 +00:00
== Creating an EFI System Partition
2017-12-12 16:56:25 +00:00
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.
+
----
2018-01-20 17:59:12 +00:00
# gdisk /dev/sda
2017-12-12 16:56:25 +00:00
----
+
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.
+
----
2018-01-20 17:59:12 +00:00
# mkfs.vfat /dev/sda1
2017-12-12 16:56:25 +00:00
----
. Create the `/boot/efi` directory as a mount point for the new partition.
+
----
2018-01-20 17:59:12 +00:00
# mkdir /boot/efi
2017-12-12 16:56:25 +00:00
----
. Mount the partition to the `/boot/efi` mount point.
+
----
2018-01-20 17:59:12 +00:00
# mount /dev/sda1 /boot/efi
2017-12-12 16:56:25 +00:00
----
. Proceed to the next part.
[[install-the-bootloader-files]]
2018-01-20 17:59:12 +00:00
== Install the bootloader files
2017-12-12 16:56:25 +00:00
In order to use *GRUB2* with on the UEFI systems, you need to install or re-install appropriate packages:
. Re-install the necessary packages.
+
----
2018-01-20 17:59:12 +00:00
# dnf reinstall grub2-efi grub2-efi-modules shim
2017-12-12 16:56:25 +00:00
----
. If the above command ends with an error, install the packages.
+
----
2018-01-20 17:59:12 +00:00
# dnf install grub2-efi grub2-efi-modules shim
2017-12-12 16:56:25 +00:00
----
.More information
* This installs the signed *shim* and the *GRUB2* binary.
2018-01-20 17:59:12 +00:00
2017-12-12 16:56:25 +00:00
[[create-a-grub-2-configuration]]
2018-01-20 17:59:12 +00:00
== Create a GRUB2 configuration
2017-12-12 16:56:25 +00:00
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.
----
2022-04-14 17:19:42 +00:00
# grub2-mkconfig -o /boot/grub2/grub.cfg
2017-12-12 16:56:25 +00:00
----
.More information
2022-04-14 17:19:42 +00:00
* Under EFI, *GRUB2* looks for its configuration in `/boot/efi/EFI/fedora/grub.cfg`, however the postinstall script of `grub2-common` installs a small shim which chains to the standard configuration at `/boot/grub2/grub.cfg` which is generated above. To reset this shim to defaults, delete the existing `/boot/efi/EFI/fedora/grub.cfg` and then `dnf reinstall grub2-common`.
* For newly installed kernels to work, `grubby` expects `/etc/grub2-efi.cfg` to be a symlink to the real `grub.cfg` (for example `/boot/grub2/grub.cfg`).
2018-01-20 17:59:12 +00:00
[[solving-problems-with-uefi-bootloader]]
2018-01-20 17:59:12 +00:00
== Solving problems 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`.
2018-01-20 17:59:12 +00:00
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
2018-01-20 17:59:12 +00:00
* 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.