| |
@@ -12,6 +12,8 @@
|
| |
|
| |
GRUB 2 reads its configuration from the `/boot/grub2/grub.cfg` file on traditional BIOS-based machines and from the `/boot/efi/EFI/fedora/grub.cfg` file on UEFI machines. This file contains menu information.
|
| |
|
| |
+ Note that the postinstall script of `grub2-common` installs a small shim which chains the UEFI-based config at `/boot/efi/EFI/fedora/grub.cfg` to the standard configuration at `/boot/grub2/grub.cfg`. To reset this shim to defaults, delete the existing `/boot/efi/EFI/fedora/grub.cfg` and then `dnf reinstall grub2-common`.
|
| |
+
|
| |
The GRUB 2 configuration file, `grub.cfg`, is generated during installation, or by invoking the [application]*/usr/sbin/grub2-mkconfig* utility, and is automatically updated by [command]#grubby# each time a new kernel is installed. When regenerated manually using [application]*grub2-mkconfig*, the file is generated according to the template files located in `/etc/grub.d/`, and custom settings in the `/etc/default/grub` file. Edits of `grub.cfg` will be lost any time [application]*grub2-mkconfig* is used to regenerate the file, so care must be taken to reflect any manual changes in `/etc/default/grub` as well.
|
| |
|
| |
Normal operations on `grub.cfg`, such as the removal and addition of new kernels, should be done using the [command]#grubby# tool and, for scripts, using [command]#new-kernel-pkg# tool. If you use [command]#grubby# to modify the default kernel the changes will be inherited when new kernels are installed. For more information on [command]#grubby#, see xref:#sec-Making_Persistent_Changes_to_a_GRUB_2_Menu_Using_the_grubby_Tool[Making Persistent Changes to a GRUB 2 Menu Using the grubby Tool].
|
| |
@@ -277,18 +279,19 @@
|
| |
|
| |
Changes to `/etc/default/grub` require rebuilding the `grub.cfg` file as follows:
|
| |
|
| |
- * On BIOS-based machines, issue the following command as `root`:
|
| |
+ * Issue the following command as `root`:
|
| |
|
| |
[subs="attributes"]
|
| |
----
|
| |
~]#{nbsp}grub2-mkconfig -o /boot/grub2/grub.cfg
|
| |
----
|
| |
|
| |
- * On UEFI-based machines, issue the following command as `root`:
|
| |
+ * On UEFI-based machines the a chaining shim to `/boot/grub2/grub.cfg` should be installed in `/boot/efi/EFI/fedora/grub.cfg`. This shim can be recreated/reset as follows:
|
| |
|
| |
[subs="attributes"]
|
| |
----
|
| |
- ~]#{nbsp}grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
|
| |
+ ~]#{nbsp}rm /boot/efi/EFI/fedora/grub.cfg
|
| |
+ ~]#{nbsp}dnf reinstall grub2-common
|
| |
----
|
| |
|
| |
[[sec-Editing_a_Menu_Entry]]
|
| |
@@ -304,18 +307,19 @@
|
| |
|
| |
Changes to `/etc/default/grub` require rebuilding the `grub.cfg` file as follows:
|
| |
|
| |
- * On BIOS-based machines, issue the following command as `root`:
|
| |
+ * Issue the following command as `root`:
|
| |
|
| |
[subs="attributes"]
|
| |
----
|
| |
~]#{nbsp}grub2-mkconfig -o /boot/grub2/grub.cfg
|
| |
----
|
| |
|
| |
- * On UEFI-based machines, issue the following command as `root`:
|
| |
+ * On UEFI-based machines the a chaining shim to `/boot/grub2/grub.cfg` should be installed in `/boot/efi/EFI/fedora/grub.cfg`. This shim can be recreated/reset as follows:
|
| |
|
| |
[subs="attributes"]
|
| |
----
|
| |
- ~]#{nbsp}grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
|
| |
+ ~]#{nbsp}rm /boot/efi/EFI/fedora/grub.cfg
|
| |
+ ~]#{nbsp}dnf reinstall grub2-common
|
| |
----
|
| |
|
| |
[[sec-Adding_a_new_Entry]]
|
| |
@@ -361,9 +365,9 @@
|
| |
|
| |
====
|
| |
|
| |
- . On BIOS-based machines, copy the contents of `/boot/grub2/grub.cfg`, or, on UEFI machines, copy the contents of `/boot/efi/EFI/fedora/grub.cfg`. Put the content of the `grub.cfg` into the `/etc/grub.d/40_custom` file below the existing header lines. The executable part of the `40_custom` script has to be preserved.
|
| |
+ . Copy the contents of `/boot/grub2/grub.cfg`. Put the content of the `grub.cfg` into the `/etc/grub.d/40_custom` file below the existing header lines. The executable part of the `40_custom` script has to be preserved.
|
| |
|
| |
- . From the content put into the `/etc/grub.d/40_custom` file, only the `menuentry` blocks are needed to create the custom menu. The `/boot/grub2/grub.cfg` and `/boot/efi/EFI/fedora/grub.cfg` files might contain function specifications and other content above and below the `menuentry` blocks. If you put these unnecessary lines into the `40_custom` file in the previous step, erase them.
|
| |
+ . From the content put into the `/etc/grub.d/40_custom` file, only the `menuentry` blocks are needed to create the custom menu. The `/boot/grub2/grub.cfg` file might contain function specifications and other content above and below the `menuentry` blocks. If you put these unnecessary lines into the `40_custom` file in the previous step, erase them.
|
| |
|
| |
This is an example of a custom `40_custom` script:
|
| |
|
| |
@@ -414,25 +418,26 @@
|
| |
** `01_users` (if it exists),
|
| |
|
| |
** and `README`.
|
| |
-
|
| |
+ +
|
| |
Alternatively, if you want to keep the files in the `/etc/grub2.d/` directory, make them unexecutable by running the [command]#chmod a-x <file_name># command.
|
| |
|
| |
. Edit, add, or remove menu entries in the `40_custom` file as desired.
|
| |
|
| |
. Rebuild the `grub.cfg` file by running the [command]#grub2-mkconfig -o# command as follows:
|
| |
-
|
| |
- ** On BIOS-based machines, issue the following command as `root`:
|
| |
-
|
| |
+ +
|
| |
+ ** Issue the following command as `root`:
|
| |
+ +
|
| |
[subs="attributes"]
|
| |
----
|
| |
~]#{nbsp}grub2-mkconfig -o /boot/grub2/grub.cfg
|
| |
----
|
| |
|
| |
- ** On UEFI-based machines, issue the following command as `root`:
|
| |
-
|
| |
+ ** On UEFI-based machines the a chaining shim to `/boot/grub2/grub.cfg` should be installed in `/boot/efi/EFI/fedora/grub.cfg`. This shim can be recreated/reset as follows:
|
| |
+ +
|
| |
[subs="attributes"]
|
| |
----
|
| |
- ~]#{nbsp}grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
|
| |
+ ~]#{nbsp}rm /boot/efi/EFI/fedora/grub.cfg
|
| |
+ ~]#{nbsp}dnf reinstall grub2-common
|
| |
----
|
| |
|
| |
[[sec-GRUB_2_Password_Protection]]
|
| |
@@ -453,7 +458,7 @@
|
| |
=== Setting Up Users and Password Protection, Specifying Menu Entries
|
| |
|
| |
. To specify a superuser, add the following lines in the `/etc/grub.d/01_users` file, where `john` is the name of the user designated as the superuser, and `johnspassword` is the superuser's password:
|
| |
-
|
| |
+ +
|
| |
[subs="quotes"]
|
| |
----
|
| |
cat <<EOF
|
| |
@@ -463,7 +468,7 @@
|
| |
----
|
| |
|
| |
. To allow other users to access the menu entries, add additional lines per user at the end of the `/etc/grub.d/01_users` file.
|
| |
-
|
| |
+ +
|
| |
[subs="quotes"]
|
| |
----
|
| |
cat <<EOF
|
| |
@@ -474,7 +479,7 @@
|
| |
----
|
| |
|
| |
. When the users and passwords are set up, specify the menu entries that should be password-protected in the `/etc/grub.d/40_custom` file in a similar fashion to the following:
|
| |
-
|
| |
+ +
|
| |
[subs="quotes, attributes"]
|
| |
----
|
| |
|
| |
@@ -508,18 +513,19 @@
|
| |
|
| |
Rebuild the `grub.cfg` file by running the [command]#grub2-mkconfig -o# command as follows:
|
| |
|
| |
- * On BIOS-based machines, issue the following command as `root`:
|
| |
+ * Issue the following command as `root`:
|
| |
|
| |
[subs="attributes"]
|
| |
----
|
| |
~]#{nbsp}grub2-mkconfig -o /boot/grub2/grub.cfg
|
| |
----
|
| |
|
| |
- * On UEFI-based machines, issue the following command as `root`:
|
| |
+ * On UEFI-based machines the a chaining shim to `/boot/grub2/grub.cfg` should be installed in `/boot/efi/EFI/fedora/grub.cfg`. This shim can be recreated/reset as follows:
|
| |
|
| |
[subs="attributes"]
|
| |
----
|
| |
- ~]#{nbsp}grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
|
| |
+ ~]#{nbsp}rm /boot/efi/EFI/fedora/grub.cfg
|
| |
+ ~]#{nbsp}dnf reinstall grub2-common
|
| |
----
|
| |
|
| |
[[sec-Password_Encryption]]
|
| |
@@ -594,26 +600,27 @@
|
| |
. Run the [command]#rm /etc/sysconfig/grub# command;
|
| |
|
| |
. For EFI systems *only*, run the following command:
|
| |
-
|
| |
+ +
|
| |
[subs="attributes"]
|
| |
----
|
| |
~]#{nbsp}dnf reinstall grub2-efi shim grub2-tools
|
| |
----
|
| |
|
| |
. Rebuild the `grub.cfg` file by running the [command]#grub2-mkconfig -o# command as follows:
|
| |
-
|
| |
- ** On BIOS-based machines, issue the following command as `root`:
|
| |
-
|
| |
+ +
|
| |
+ ** Issue the following command as `root`:
|
| |
+ +
|
| |
[subs="attributes"]
|
| |
----
|
| |
~]#{nbsp}grub2-mkconfig -o /boot/grub2/grub.cfg
|
| |
----
|
| |
-
|
| |
- ** On UEFI-based machines, issue the following command as `root`:
|
| |
-
|
| |
+ +
|
| |
+ ** On UEFI-based machines the a chaining shim to `/boot/grub2/grub.cfg` should be installed in `/boot/efi/EFI/fedora/grub.cfg`. This shim can be recreated/reset as follows:
|
| |
+ +
|
| |
[subs="attributes"]
|
| |
----
|
| |
- ~]#{nbsp}grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
|
| |
+ ~]#{nbsp}rm /boot/efi/EFI/fedora/grub.cfg
|
| |
+ ~]#{nbsp}dnf reinstall grub2-common
|
| |
----
|
| |
|
| |
. Now follow the procedure in xref:#sec-Reinstalling_GRUB_2[Reinstalling GRUB 2] to restore GRUB2 on the `/boot/` partition.
|
| |
@@ -656,18 +663,19 @@
|
| |
|
| |
Rebuild the `grub.cfg` file by running the [command]#grub2-mkconfig -o# command as follows:
|
| |
|
| |
- * On BIOS-based machines, issue the following command as `root`:
|
| |
+ * Issue the following command as `root`:
|
| |
|
| |
[subs="attributes"]
|
| |
----
|
| |
~]#{nbsp}grub2-mkconfig -o /boot/grub2/grub.cfg
|
| |
----
|
| |
|
| |
- * On UEFI-based machines, issue the following command as `root`:
|
| |
+ * On UEFI-based machines the a chaining shim to `/boot/grub2/grub.cfg` should be installed in `/boot/efi/EFI/fedora/grub.cfg`. This shim can be recreated/reset as follows:
|
| |
|
| |
[subs="attributes"]
|
| |
----
|
| |
- ~]#{nbsp}grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
|
| |
+ ~]#{nbsp}rm /boot/efi/EFI/fedora/grub.cfg
|
| |
+ ~]#{nbsp}dnf reinstall grub2-common
|
| |
----
|
| |
|
| |
[NOTE]
|
| |
The system administrators guide recommends overwriting the EFI grub.cfg shim installed by grub2-common. This will also leave essentially duplicate information in
/boot/grub2/grub.cfg
and/boot/efi/EFI/fedora/grub.cfg
with the former being ignored by the system.Correct these docs so that the shim is not overwritten (and explain how to restore it if previously broken via out-of-date docs), and grub2 configuration on end-user systems is always consistently in one place:
/boot/grub2/grub.cfg
.Also fixed some issues with list numbering not being continuous.