This file contains the configuration of the GRUB 2 menu items. It replaces menu.lst
used in GRUB Legacy. grub.cfg
should not be edited—it is automatically generated by the command
### BEGIN /etc/grub.d/90_persistent ###0.
### BEGIN /etc/grub.d/90_persistent ###1
This optional file is directly sourced by grub.cfg
at boot time and can be used to add custom items to the boot menu. Starting with openSUSE Leap Leap 42.2 these entries will also be parsed when using
### BEGIN /etc/grub.d/90_persistent ###3.
### BEGIN /etc/grub.d/90_persistent ###4
This file controls the user settings of GRUB 2 and usually includes additional environmental settings such as backgrounds and themes.
Scripts under### BEGIN /etc/grub.d/90_persistent ###5
The scripts in this directory are read during execution of the command
### BEGIN /etc/grub.d/90_persistent ###0. Their instructions are integrated into the main configuration file
### BEGIN /etc/grub.d/90_persistent ###7.
### BEGIN /etc/grub.d/90_persistent ###8
This configuration file holds some basic settings like the boot loader type and whether to enable UEFI Secure Boot support.
### BEGIN /etc/grub.d/90_persistent ###9,
These configuration files contain architecture-specific options.
GRUB 2 can be controlled in various ways. Boot entries from an existing configuration can be selected from the graphical menu [splash screen]. The configuration is loaded from the file /boot/grub2/grub.cfg
which is compiled from other configuration files [see below]. All GRUB 2 configuration files are considered system files, and you need
### END /etc/grub.d/90_persistent ###1 privileges to edit them.
After having manually edited GRUB 2 configuration files, you need to run
### BEGIN /etc/grub.d/90_persistent ###0 to activate the changes. However, this is not necessary when changing the configuration with YaST, because YaST will automatically run this command.
The graphical splash screen with the boot menu is based on the GRUB 2 configuration file /boot/grub2/grub.cfg
, which contains information about all partitions or operating systems that can be booted by the menu.
Every time the system is booted, GRUB 2 loads the menu file directly from the file system. For this reason, GRUB 2 does not need to be re-installed after changes to the configuration file. grub.cfg
is automatically rebuilt with kernel installations or removals.
More general options of GRUB 2 belong here, such as the time the menu is displayed, or the default OS to boot. To list all available options, see the output of the following command:
tux >
grep "export GRUB_DEFAULT" -A50 /usr/sbin/grub2-mkconfig | grep GRUB_
In addition to already defined variables, the user may introduce their own variables, and use them later in the scripts found in the
### END /etc/grub.d/90_persistent ###5 directory.
After having edited
### BEGIN /etc/grub.d/90_persistent ###4, update the main configuration file with
### BEGIN /etc/grub.d/90_persistent ###0.
All options set in this file are general options that affect all boot entries. Specific options for Xen kernels or the Xen hypervisor can be set via the GRUB_*_XEN_* configuration options. See below for details.
### END /etc/grub.d/90_persistent ###8
Sets the boot menu entry that is booted by default. Its value can be a numeric value, the complete name of a menu entry, or “saved”.
### END /etc/grub.d/90_persistent ###9 boots the third [counted from zero] boot menu entry.
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID0 boots the first submenu entry of the third top-level menu entry.
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID1 boots the menu entry with the title “Example boot menu entry”.
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID2 boots the entry specified by the
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID3 or
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID4 commands. While
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID5 sets the default boot entry for the next reboot only,
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID4 sets the default boot entry until changed.
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID7 lists the next boot entry.
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID8
Waits the specified number of seconds for the user to press a key. During the period no menu is shown unless the user presses a key. If no key is pressed during the time specified, the control is passed to
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID9.
0 first checks whether Shift is pressed and shows the boot menu if yes, otherwise immediately boots the default menu entry. This is the default when only one bootable OS is identified by GRUB 2.tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
1tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
If
2 is specified, a countdown timer is displayed on a blank screen when thetux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID8 feature is active.
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID9
Time period in seconds the boot menu is displayed before automatically booting the default boot entry. If you press a key, the timeout is cancelled and GRUB 2 waits for you to make the selection manually.
5 will cause the menu to be displayed until you select the boot entry manually.tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
6tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
Entries on this line are added at the end of the boot entries for normal and recovery mode. Use it to add kernel parameters to the boot entry.
7tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
Same as
6 but the entries are appended in the normal mode only.tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
9tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
Same as
6 but the entries are appended in the recovery mode only.tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
set superusers="root" password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...1
This entry will completely replace the
6 parameters for all Xen boot entries.tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
set superusers="root" password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...3
Same as
set superusers="root" password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...1 but it will only replace parameters of
7.tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
set superusers="root" password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...6
This entry specifies the kernel parameters for the Xen guest kernel only—the operation principle is the same as for
6.tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
set superusers="root" password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...8
Same as
set superusers="root" password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...6—the operation principle is the same as for
7.tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
1tux >
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
Enables and specifies an input/output terminal device. Can be
2 [PC BIOS and EFI consoles],tux >
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
3 [serial terminal],tux >
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
4 [Open Firmware console], or the defaulttux >
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
5 [graphics-mode output]. It is also possible to enable more than one device by quoting the required options, for exampletux >
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
6.tux >
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
7tux >
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
The resolution used for the
5 graphical terminal. Note that you can only use modes supported by your graphics card [VBE]. The default is ‘auto’, which tries to select a preferred resolution. You can display the screen resolutions available to GRUB 2 by typingtux >
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
9 in the GRUB 2 command line. The command line is accessed by typing C when the GRUB 2 boot menu screen is displayed.tux >
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
You can also specify a color depth by appending it to the resolution setting, for example /boot/grub2/grub.cfg
0.
/boot/grub2/grub.cfg
1Set a background image for the
5 graphical terminal. The image must be a file readable by GRUB 2 at boot time, and it must end with thetux >
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
/boot/grub2/grub.cfg
3, /boot/grub2/grub.cfg
4, /boot/grub2/grub.cfg
5, or /boot/grub2/grub.cfg
6 suffix. If necessary, the image will be scaled to fit the screen./boot/grub2/grub.cfg
7If this option is set to /boot/grub2/grub.cfg
8, automatic searching for other operating systems is disabled. Only the kernel images in /boot/grub2/grub.cfg
9 and the options from your own scripts in
### BEGIN /etc/grub.d/90_persistent ###5 are detected.
menu.lst
1If this option is set to /boot/grub2/grub.cfg
8, GRUB 2 can boot directly into Snapper snapshots. For more information, see Section 3.3, “System Rollback by Booting from Snapshots”.
For a complete list of options, see the GNU GRUB manual.
The scripts in this directory are read during execution of the command
### BEGIN /etc/grub.d/90_persistent ###0. Their instructions are incorporated into
/boot/grub2/grub.cfg
. The order of menu items in grub.cfg
is determined by the order in which the files in this directory are run. Files with a leading numeral are executed first, beginning with the lowest number. menu.lst
6 is run before menu.lst
7, which would run before menu.lst
8. If files with alphabetic names are present, they are executed after the numerically-named files. Only executable files generate output to grub.cfg
during execution of grub.cfg
0. By default all files in the ### END /etc/grub.d/90_persistent ###5 directory are executable.
grub.cfg
Because /boot/grub2/grub.cfg
is recompiled each time grub.cfg
0 is run, any custom content is lost. If you want to insert your lines directly into /boot/grub2/grub.cfg
without losing them after grub.cfg
0 is run, insert them between
### BEGIN /etc/grub.d/90_persistent ###
and
### END /etc/grub.d/90_persistent ###
The grub.cfg
7 script ensures that such content will be preserved.
A list of the most important scripts follows:
menu.lst
6
Sets environmental variables such as system file locations, display settings, themes, and previously saved entries. It also imports preferences stored in the
### BEGIN /etc/grub.d/90_persistent ###4. Normally you do not need to make changes to this file.
menu.lst
7Identifies Linux kernels on the root device and creates relevant menu entries. This includes the associated recovery mode option if enabled. Only the latest kernel is displayed on the main menu page, with additional kernels included in a submenu.
### BEGIN /etc/grub.d/90_persistent ###01
This script uses
### BEGIN /etc/grub.d/90_persistent ###02 to search for Linux and other operating systems and places the results in the GRUB 2 menu. There are sections to identify specific other operating systems, such as Windows or macOS.
menu.lst
8This file provides a simple way to include custom boot entries into grub.cfg
. Make sure that you do not change the
### BEGIN /etc/grub.d/90_persistent ###05 part at the beginning.
The processing sequence is set by the preceding numbers with the lowest number being executed first. If scripts are preceded by the same number the alphabetical order of the complete name decides the order.
### BEGIN /etc/grub.d/90_persistent ###1
If you create
### BEGIN /etc/grub.d/90_persistent ###1 and fill it with content, it will be automatically included into
/boot/grub2/grub.cfg
just after 40_custom at boot time.12.2.4 Mapping between BIOS Drives and Linux Devices #Edit source
In GRUB Legacy, the
### BEGIN /etc/grub.d/90_persistent ###09 configuration file was used to derive Linux device names from BIOS drive numbers. The mapping between BIOS drives and Linux devices cannot always be guessed correctly. For example, GRUB Legacy would get a wrong order if the boot sequence of IDE and SCSI drives is exchanged in the BIOS configuration.
GRUB 2 avoids this problem by using device ID strings [UUIDs] or file system labels when generating grub.cfg
. GRUB 2 utilities create a temporary device map on the fly, which is usually sufficient, particularly in the case of single-disk systems.
However, if you need to override the GRUB 2's automatic device mapping mechanism, create your custom mapping file
### BEGIN /etc/grub.d/90_persistent ###11. The following example changes the mapping to make
### BEGIN /etc/grub.d/90_persistent ###12 the boot disk. Note that GRUB 2 partition numbers start with
### BEGIN /etc/grub.d/90_persistent ###13 and not with
### BEGIN /etc/grub.d/90_persistent ###14 as in GRUB Legacy.
[hd1] /dev/disk-by-id/DISK3 ID [hd2] /dev/disk-by-id/DISK1 ID [hd3] /dev/disk-by-id/DISK2 ID
Even before the operating system is booted, GRUB 2 enables access to file systems. Users without root permissions can access files in your Linux system to which they have no access after the system is booted. To block this kind of access or to prevent users from booting certain menu entries, set a boot password.
If set, the boot password is required on every boot, which means the system does not boot automatically.
Proceed as follows to set a boot password. Alternatively use YaST [].
Encrypt the password using
### BEGIN /etc/grub.d/90_persistent ###
15tux >
sudo
grub2-mkpasswd-pbkdf2 Password: **** Reenter password: **** PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...Paste the resulting string into the file
### BEGIN /etc/grub.d/90_persistent ###
16 together with the### BEGIN /etc/grub.d/90_persistent ###
17 command.set superusers="root" password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
To import the changes into the main configuration file, run:
tux >
sudo
grub2-mkconfig -o /boot/grub2/grub.cfg
After you reboot, you will be prompted for a user name and a password when trying to boot a menu entry. Enter
### END /etc/grub.d/90_persistent ###1 and the password you typed during the
### BEGIN /etc/grub.d/90_persistent ###19 command. If the credentials are correct, the system will boot the selected boot entry.