Working with the GRUB 2 Boot Loader
|
Editor’s Note This guide is deprecated! Large parts of it are no longer current and it will not receive any updates. A series of shorter, topic-specific documentation will gradually replace it. For additional information about Grub version 2 on Fedora see Bootloading with GRUB2. |
Fedora 40 is distributed with the GNU GRand Unified Boot loader (GRUB) version 2 boot loader, which allows the user to select an operating system or kernel to be loaded at system boot time. GRUB 2 also allows the user to pass arguments to the kernel.
Introduction to GRUB 2
GRUB 2 reads its configuration from the /boot/grub2/grub.cfg file. This file contains menu information.
The GRUB 2 configuration file, grub.cfg, is generated during installation, or by invoking the /usr/sbin/grub2-mkconfig utility, and is automatically updated by grubby each time a new kernel is installed. When regenerated manually using 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 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 grubby tool and, for scripts, using new-kernel-pkg tool. If you use grubby to modify the default kernel the changes will be inherited when new kernels are installed. For more information on grubby, see Making Persistent Changes to a GRUB 2 Menu Using the grubby Tool.
The /etc/default/grub file is used by the grub2-mkconfig tool, which is used by anaconda when creating grub.cfg during the installation process, and can be used in the event of a system failure, for example if the boot loader configurations need to be recreated. In general, it is not recommended to replace the grub.cfg file by manually running grub2-mkconfig except as a last resort. Note that any manual changes to /etc/default/grub require rebuilding the grub.cfg file.
Among various code snippets and directives, the grub.cfg configuration file contains one or more menuentry blocks, each representing a single GRUB 2 boot menu entry. These blocks always start with the menuentry keyword followed by a title, list of options, and an opening curly bracket, and end with a closing curly bracket. Anything between the opening and closing bracket should be indented. For example, the following is a sample menuentry block for Fedora 40 with Linux kernel 3.17.4-301.fc21.x86_64:
menuentry 'Fedora, with Linux 3.17.4-301.fc21.x86_64' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.17.4-301.fc21.x86_64-advanced-effee860-8d55-4e4a-995e-b4c88f9ac9f0' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' f19c92f4-9ead-4207-b46a-723b7a2c51c8
else
search --no-floppy --fs-uuid --set=root f19c92f4-9ead-4207-b46a-723b7a2c51c8
fi
linux16 /vmlinuz-3.17.4-301.fc21.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root rhgb quiet LANG=en_US.UTF-8
initrd16 /initramfs-3.17.4-301.fc21.x86_64.img
}
Each menuentry block that represents an installed Linux kernel contains linux on 64-bit IBM POWER Series, linux16 on x86_64 BIOS-based systems, and linuxefi on UEFI-based systems. Then the initrd directives followed by the path to the kernel and the initramfs image respectively. If a separate /boot partition was created, the paths to the kernel and the initramfs image are relative to /boot. In the example above, the initrd /initramfs-3.17.4-301.fc21.x86_64.img line means that the initramfs image is actually located at /boot/initramfs-3.17.4-301.fc21.x86_64.img when the root file system is mounted, and likewise for the kernel path.
The kernel version number as given on the linux16 /vmlinuz-kernel_version line must match the version number of the initramfs image given on the initrd /initramfs-kernel_version.img line of each menuentry block. For more information on how to verify the initial RAM disk image, see Verifying the Initial RAM Disk Image.
|
In For information on using Dracut, see Verifying the Initial RAM Disk Image. |
Configuring the GRUB 2 Boot Loader
Changes to the GRUB 2 menu can be made temporarily at boot time, made persistent for a single system while the system is running, or as part of making a new GRUB 2 configuration file.
-
To make non-persistent changes to the GRUB 2 menu, see Making Temporary Changes to a GRUB 2 Menu.
-
To make persistent changes to a running system, see Making Persistent Changes to a GRUB 2 Menu Using the grubby Tool.
-
For information on making and customizing a GRUB 2 configuration file, see Customizing the GRUB 2 Configuration File.
Making Temporary Changes to a GRUB 2 Menu
To change kernel parameters only during a single boot process, proceed as follows:
-
Start the system and, on the GRUB 2 boot screen, move the cursor to the menu entry you want to edit, and press the e key for edit.
-
Move the cursor down to find the kernel command line. The kernel command line starts with
linuxon 64-Bit IBM Power Series,linux16on x86-64 BIOS-based systems, orlinuxefion UEFI systems. -
Move the cursor to the end of the line.
Press Ctrl+a and Ctrl+e to jump to the start and end of the line, respectively. On some systems, Home and End might also work.
-
Edit the kernel parameters as required. For example, to run the system in emergency mode, add the emergency parameter at the end of the
linux16line:
linux16 /vmlinuz-4.2.0-1.fc23.x86_64 root=/dev/mapper/fedora-root ro rd.md=0 rd.dm=0 rd.lvm.lv=fedora/swap crashkernel=auto rd.luks=0 vconsole.keymap=us rd.lvm.lv=fedora/root rhgb quiet emergency
The rhgb and quiet parameters can be removed in order to enable system messages.
These settings are not persistent and apply only for a single boot. To make persistent changes to a menu entry on a system, use the grubby tool. See Adding and Removing Arguments from a GRUB Menu Entry for more information on using grubby.
Making Persistent Changes to a GRUB 2 Menu Using the grubby Tool
The grubby tool can be used to read information from, and make persistent changes to, the grub.cfg file. It enables, for example, changing GRUB menu entries to specify what arguments to pass to a kernel on system start and changing the default kernel.
In Red Hat Enterprise Linux 7, if grubby is invoked manually without specifying a GRUB configuration file, it defaults to searching for /etc/grub2.cfg, which is a symbolic link to the grub.cfg file, whose location is architecture dependent. If that file cannot be found it will search for an architecture dependent default.
To find out the file name of the default kernel, enter a command as follows:
~]# grubby --default-kernel /boot/vmlinuz-4.2.0-1.fc23.x86_64
To find out the index number of the default kernel, enter a command as follows:
~]# grubby --default-index 0
To make a persistent change in the kernel designated as the default kernel, use the grubby command as follows:
~]# grubby --set-default /boot/vmlinuz-4.2.0-1.fc23.x86_64
To list all the kernel menu entries, enter a command as follows:
~]$ grubby --info=ALL
On UEFI systems, all grubby commands must be entered as root.
To view the GRUB menu entry for a specific kernel, enter a command as follows:
~]$ grubby --info /boot/vmlinuz-4.2.0-1.fc23.x86_64 index=0 kernel=/boot/vmlinuz-4.2.0-1.fc23.x86_64 args="ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet LANG=en_US.UTF-8" root=/dev/mapper/fedora-root initrd=/boot/initramfs-4.2.0-1.fc23.x86_64.img title=Fedora (4.2.0-1.fc23.x86_64) 23 (Workstation Edition)
Try tab completion to see the available kernels within the /boot/ directory.
The --update-kernel option can be used to update a menu entry when used in combination with --args to add new arguments and --remove-arguments to remove existing arguments. These options accept a quoted space-separated list. The command to simultaneously add and remove arguments a from GRUB menu entry has the follow format:
grubby --remove-args="argX argY" --args="argA argB" --update-kernel /boot/kernel
To add and remove arguments from a kernel’s GRUB menu entry, use a command as follows:
~]# grubby --remove-args="rhgb quiet" --args=console=ttyS0,115200 --update-kernel /boot/vmlinuz-4.2.0-1.fc23.x86_64
This command removes the Red Hat graphical boot argument, enables boot message to be seen, and adds a serial console. As the console arguments will be added at the end of the line, the new console will take precedence over any other consoles configured.
To review the changes, use the --info command option as follows:
~]# grubby --info /boot/vmlinuz-4.2.0-1.fc23.x86_64 index=0 kernel=/boot/vmlinuz-4.2.0-1.fc23.x86_64 args="ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap LANG=en_US.UTF-8 console=ttyS0,115200" root=/dev/mapper/fedora-root initrd=/boot/initramfs-4.2.0-1.fc23.x86_64.img title=Fedora (4.2.0-1.fc23.x86_64) 23 (Workstation Edition)
To add the same kernel boot arguments to all the kernel menu entries, enter a command as follows:
~]# grubby --update-kernel=ALL --args=console=ttyS0,115200
The --update-kernel parameter also accepts DEFAULT or a comma separated list of kernel index numbers.
To change a value in an existing kernel argument, specify the argument again, changing the value as required. For example, if the virtual console font size has been set to latarcyrheb-sun16 and you want to change the virtual console font size to 32, use a command as follows:
~]# grubby --args=vconsole.font=latarcyrheb-sun32 --update-kernel /boot/vmlinuz-4.2.0-1.fc23.x86_64 index=0 kernel=/boot/vmlinuz-4.2.0-1.fc23.x86_64 args="ro rd.lvm.lv=fedora/root crashkernel=auto rd.lvm.lv=fedora/swap vconsole.font=latarcyrheb-sun32 vconsole.keymap=us LANG=en_US.UTF-8" root=/dev/mapper/fedora-root initrd=/boot/initramfs-4.2.0-1.fc23.x86_64.img title=Fedora (4.2.0-1.fc23.x86_64) 23 (Workstation Edition)
See the grubby(8) manual page for more command options.
To add a new entry with the default kernel but with additional kernel arguments and make it the default entry, use:
~]# grubby --add-kernel $(grubby --default-kernel) --copy-default --args=crashkernel=128M --title "Default kernel with kdump support" --make-default
In this example, we set the crashkernel=128M argument for kdump support.
Customizing the GRUB 2 Configuration File
GRUB 2 scripts search the user’s computer and build a boot menu based on what operating systems the scripts find. To reflect the latest system boot options, the boot menu is rebuilt automatically when the kernel is updated or a new kernel is added.
However, users may want to build a menu containing specific entries or to have the entries in a specific order. GRUB 2 allows basic customization of the boot menu to give users control of what actually appears on the screen.
GRUB 2 uses a series of scripts to build the menu; these are located in the /etc/grub.d/ directory. The following files are included:
-
00_header, which loads GRUB 2 settings from the/etc/default/grubfile. -
01_users, which is created only when a boot loader password is assigned in a kickstart file. -
10_linux, which locates kernels in the default partition of Fedora. -
30_os-prober, which builds entries for operating systems found on other partitions. -
40_custom, a template, which can be used to create additional menu entries.
Scripts from the /etc/grub.d/ directory are read in alphabetical order and can be therefore renamed to change the boot order of specific menu entries.
|
With the |
Changing the Default Boot Entry
By default, the key for the GRUB_DEFAULT directive in the /etc/default/grub file is the word saved. This instructs GRUB 2 to load the kernel specified by the saved_entry directive in the GRUB 2 environment file, located at /boot/grub2/grubenv. You can set another GRUB record to be the default, using the grub2-set-default command, which will update the GRUB 2 environment file.
By default, the saved_entry value is set to the name of latest installed kernel of package type kernel. This is defined in /etc/sysconfig/kernel by the UPDATEDEFAULT and DEFAULTKERNEL directives. The file can be viewed by the root user as follows:
~]# cat /etc/sysconfig/kernel # UPDATEDEFAULT specifies if new-kernel-pkg should make # new kernels the default UPDATEDEFAULT=yes # DEFAULTKERNEL specifies the default kernel package type DEFAULTKERNEL=kernel-core
The DEFAULTKERNEL directive specifies what package type will be used as the default. Installing a package of type kernel-debug will not change the default kernel while the DEFAULTKERNEL is set to package type kernel.
GRUB 2 supports using a numeric value as the key for the saved_entry directive to change the default order in which the operating systems are loaded. To specify which operating system should be loaded first, pass its number to the grub2-set-default command. For example:
~]# grub2-set-default 2
Note that the position of a menu entry in the list is denoted by a number starting with zero; therefore, in the example above, the third entry will be loaded. This value will be overwritten by the name of the next kernel to be installed.
To force a system to always use a particular menu entry, use the menu entry name as the key to the GRUB_DEFAULT directive in the /etc/default/grub file. To list the available menu entries, run the following command as root:
~]# awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
The file name /etc/grub2.cfg is a symlink to the grub.cfg file, whose location is architecture dependent. For reliability reasons, the symlink is not used in other examples in this chapter. It is better to use absolute paths when writing to a file, especially when repairing a system.
Changes to /etc/default/grub require rebuilding the grub.cfg file as follows:
-
On both UEFI-based and BIOS-based machines, issue the following command as
root:
~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Editing a Menu Entry
If required to prepare a new GRUB 2 file with different parameters, edit the values of the GRUB_CMDLINE_LINUX key in the /etc/default/grub file. Note that you can specify multiple parameters for the GRUB_CMDLINE_LINUX key. For example:
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,9600n8"
Where console=tty0 is the first virtual terminal and console=ttyS0 is the serial terminal to be used.
Changes to /etc/default/grub require rebuilding the grub.cfg file as follows:
-
On both UEFI-based and BIOS-based machines, issue the following command as
root:
~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Adding a new Entry
When executing the grub2-mkconfig command, GRUB 2 searches for Linux kernels and other operating systems based on the files located in the /etc/grub.d/ directory. The /etc/grub.d/10_linux script searches for installed Linux kernels on the same partition. The /etc/grub.d/30_os-prober script searches for other operating systems. Menu entries are also automatically added to the boot menu when updating the kernel.
The 40_custom file located in the /etc/grub.d/ directory is a template for custom entries and looks as follows:
#!/bin/sh exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above.
This file can be edited or copied. Note that as a minimum, a valid menu entry must include at least the following:
menuentry "<Title>"{
<Data>
}
Creating a Custom Menu
If you do not want menu entries to be updated automatically, you can create a custom menu.
|
Before proceeding, back up the contents of the |
|
Note that modifying the |
-
Copy the contents of
/boot/grub2/grub.cfg. Put the content of thegrub.cfginto the/etc/grub.d/40_customfile below the existing header lines. The executable part of the40_customscript has to be preserved. -
From the content put into the
/etc/grub.d/40_customfile, only themenuentryblocks are needed to create the custom menu. The/boot/grub2/grub.cfgfile might contain function specifications and other content above and below themenuentryblocks. If you put these unnecessary lines into the40_customfile in the previous step, erase them.
This is an example of a custom 40_custom script:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'First custom entry' --class red --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.2.0-1.fc23.x86_64-advanced-32782dd0-4b47-4d56-a740-2076ab5e5976' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 7885bba1-8aa7-4e5d-a7ad-821f4f52170a
else
search --no-floppy --fs-uuid --set=root 7885bba1-8aa7-4e5d-a7ad-821f4f52170a
fi
linux16 /vmlinuz-4.2.0-1.fc23.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root vconsole.font=latarcyrheb-sun16 rd.lvm.lv=fedora/swap vconsole.keymap=us crashkernel=auto rhgb quiet LANG=en_US.UTF-8
initrd16 /initramfs-4.2.0-1.fc23.x86_64.img
}
menuentry 'Second custom entry' --class red --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-0-rescue-07f43f20a54c4ce8ada8b70d33fd001c-advanced-32782dd0-4b47-4d56-a740-2076ab5e5976' {
load_video
insmod gzio
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 7885bba1-8aa7-4e5d-a7ad-821f4f52170a
else
search --no-floppy --fs-uuid --set=root 7885bba1-8aa7-4e5d-a7ad-821f4f52170a
fi
linux16 /vmlinuz-0-rescue-07f43f20a54c4ce8ada8b70d33fd001c root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root vconsole.font=latarcyrheb-sun16 rd.lvm.lv=fedora/swap vconsole.keymap=us crashkernel=auto rhgb quiet
initrd16 /initramfs-0-rescue-07f43f20a54c4ce8ada8b70d33fd001c.img
}
-
Remove all files from the
/etc/grub.ddirectory except the following:-
00_header, -
40_custom, -
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 chmod a-x <file_name> command.
-
Edit, add, or remove menu entries in the
40_customfile as desired. -
Rebuild the
grub.cfgfile by running the grub2-mkconfig -o command as follows:-
On both UEFI-based and BIOS-based machines, issue the following command as
root:
-
~]# grub2-mkconfig -o /boot/grub2/grub.cfg
GRUB 2 Password Protection
GRUB 2 supports both plain-text and encrypted passwords in the GRUB 2 template files. To enable the use of passwords, specify a superuser who can reach the protected entries. Other users can be specified to access these entries as well. Menu entries can be password-protected for booting by adding one or more users to the menu entry as described in Setting Up Users and Password Protection, Specifying Menu Entries. To use encrypted passwords, see Password Encryption.
|
If you do not use the correct format for the menu, or modify the configuration in an incorrect way, you might be unable to boot your system. |
All menu entries can be password-protected against changes by setting superusers, which can be done in the /etc/grub.d/00_header or the /etc/grub.d/01_users file. The 00_header file is very complicated and, if possible, avoid making modifications in this file. Menu entries should be placed in the /etc/grub.d/40_custom and users in the /etc/grub.d/01_users file. The 01_users file is generated by the installation application anaconda when a grub boot loader password is used in a kickstart template (but it should be created and used it if it does not exist). Examples in this section adopt this policy.
Setting Up Users and Password Protection, Specifying Menu Entries
-
To specify a superuser, add the following lines in the
/etc/grub.d/01_usersfile, wherejohnis the name of the user designated as the superuser, andjohnspasswordis the superuser’s password:
cat <<EOF set superusers="john" password john johnspassword EOF
-
To allow other users to access the menu entries, add additional lines per user at the end of the
/etc/grub.d/01_usersfile.
cat <<EOF set superusers="john" password john johnspassword password jane janespassword EOF
-
When the users and passwords are set up, specify the menu entries that should be password-protected in the
/etc/grub.d/40_customfile in a similar fashion to the following:
menuentry 'Red Hat Enterprise Linux Server' --unrestricted {
set root=(hd0,msdos1)
linux /vmlinuz
}
menuentry 'Fedora' --users jane {
set root=(hd0,msdos2)
linux /vmlinuz
}
menuentry 'Red Hat Enterprise Linux Workstation' {
set root=(hd0,msdos3)
linux /vmlinuz
}
In the above example:
-
johnis thesuperuserand can therefore boot any menu entry, use the GRUB 2 command line, and edit items of the GRUB 2 menu during boot. In this case,johncan access both Red Hat Enterprise Linux Server, Fedora, and Red Hat Enterprise Linux Workstation. Note that onlyjohncan access Red Hat Enterprise Linux Workstation because neither the--usersnor--unrestrictedoptions have been used. -
User
janecan boot Fedora since she was granted the permission in the configuration. -
Anyone can boot Red Hat Enterprise Linux Server, because of the
--unrestrictedoption, but onlyjohncan edit the menu entry as a superuser has been defined. When a superuser is defined then all records are protected against unauthorized changes and all records are protected for booting if they do not have the--unrestrictedparameter
If you do not specify a user for a menu entry, or make use of the --unrestricted option, then only the superuser will have access to the system.
After you have made changes in the template file the GRUB 2 configuration file must be updated.
Rebuild the grub.cfg file by running the grub2-mkconfig -o command as follows:
-
On both UEFI-based and BIOS-based machines, issue the following command as
root:
~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Password Encryption
By default, passwords are saved in plain text in GRUB 2 scripts. Although the files cannot be accessed on boot without the correct password, security can be improved by encrypting the password using the grub2-mkpasswd-pbkdf2 command. This command converts a desired password into a long hash, which is placed in the GRUB 2 scripts instead of the plain-text password.
-
To generate an encrypted password, run the grub2-mkpasswd-pbkdf2 command on the command line as
root. -
Enter the desired password when prompted and repeat it. The command then outputs your password in an encrypted form.
-
Copy the hash, and paste it in the template file where you configured the users, that is, either in
/etc/grub.d/01_usersor/etc/grub.d/40_custom.
The following format applies for the 01_users file:
cat <<EOF set superusers="john" password_pbkdf2 john grub.pbkdf2.sha512.10000.19074739ED80F115963D984BDCB35AA671C24325755377C3E9B014D862DA6ACC77BC110EED41822800A87FD3700C037320E51E9326188D53247EC0722DDF15FC.C56EC0738911AD86CEA55546139FEBC366A393DF9785A8F44D3E51BF09DB980BAFEF85281CBBC56778D8B19DC94833EA8342F7D73E3A1AA30B205091F1015A85 EOF
The following format applies for the 40_custom file:
set superusers="john" password_pbkdf2 john grub.pbkdf2.sha512.10000.19074739ED80F115963D984BDCB35AA671C24325755377C3E9B014D862DA6ACC77BC110EED41822800A87FD3700C037320E51E9326188D53247EC0722DDF15FC.C56EC0738911AD86CEA55546139FEBC366A393DF9785A8F44D3E51BF09DB980BAFEF85281CBBC56778D8B19DC94833EA8342F7D73E3A1AA30B205091F1015A85
Reinstalling GRUB 2
Reinstalling GRUB 2 is a convenient way to fix certain problems usually caused by an incorrect installation of GRUB 2, missing files, or a broken system. Other reasons to reinstall GRUB 2 include the following:
-
Upgrading from the previous version of GRUB.
-
The user requires the GRUB 2 boot loader to control installed operating systems. However, some operating systems are installed with their own boot loaders. Reinstalling GRUB 2 returns control to the desired operating system.
-
Adding the boot information to another drive.
Discovering the firmware type
To discover what firmware your machine uses, run the following command:
~]# [ -d /sys/firmware/efi ] && echo UEFI || echo BIOS
The output returns only UEFI or BIOS, depending on the firmware your machine runs.
Reinstalling GRUB 2 on BIOS-Based Machines
When using the grub2-install command, the boot information is updated and missing files are restored. Note that the files are restored only if they are not corrupted.
Use the grub2-install device command to reinstall GRUB 2 if the system is operating normally. For example, if sda is your device:
~]# grub2-install /dev/sda
Reinstalling GRUB 2 on UEFI-Based Machines
When using the dnf reinstall grub2-efi shim command, the boot information is updated and missing files are restored. Note that the files are restored only if they are not corrupted.
Use the dnf reinstall grub2-efi shim command to reinstall GRUB 2 if the system is operating normally. For example:
~]# dnf reinstall grub2-efi shim
Resetting and Reinstalling GRUB 2
This method completely removes all GRUB 2 configuration files and system settings. Apply this method to reset all configuration settings to their default values. Removing of the configuration files and subsequent reinstalling of GRUB 2 fixes failures caused by corrupted files and incorrect configuration. To do so, as root, follow these steps:
-
Run the rm /etc/grub.d/* command;
-
Run the rm /etc/sysconfig/grub command;
-
For EFI systems only, run the following command:
~]# dnf reinstall grub2-efi shim grub2-tools
-
Rebuild the
grub.cfgfile by running the grub2-mkconfig -o command as follows:-
On both UEFI-based and BIOS-based machines, issue the following command as
root:
-