Fedora 32 - Enable new BLS specification management GRUB2

Keywords: Programming sudo Fedora Linux Permission denied

rise

Fedora's kernel is frequently upgraded.But I found that restarting doesn't use the new kernel.I need to check the GRUB configuration file.

ydx@ydx-mf:~ $ cat /etc/default/grub 
#GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="resume=/dev/mapper/VG01-swap rd.lvm.lv=VG01/root rd.lvm.lv=VG01/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=false

As you can see, I set GRUB_DEFAULT=saved, which means it uses a configuration that grub has saved.This refers to the configuration of the grub reboot directory.

If you set this to 'saved', then the default menu entry will be that saved by 'GRUB_SAVEDEFAULT' or grub-set-default. This relies on the environment block, which may not be available in all situations (see Environment block).

Because I was guided by EFI, I need to check as follows:

ydx@ydx-mf:~ $ sudo cat /boot/grub2/grubenv                 
# GRUB Environment Block
saved_entry=47b007f224c34ad8bf0984ac74f55452-5.6.12-300.fc32.x86_64
menu_auto_hide=1
boot_success=1
kernelopts=root=/dev/mapper/fedora_localhost--live-root ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.lvm.lv=fedora_localhost-live/swap rhgb quiet
boot_indeterminate=2
###############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################%         

I don't know why there are so many #numbers.

Undertaking

You can see that the saved entries are 5.6.12 cores. Why did you start with 5.6.10?

ydx@ydx-mf:~ $ uname -a
Linux ydx-mf 5.6.10-300.fc32.x86_64 #1 SMP Mon May 4 14:29:45 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

The official document says:

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 it comes to installing a new kernel, the configuration file is automatically updated by grubby.The problem is, I don't have grubby installed:

ydx@ydx-mf:~ $ grubby
zsh: grubby: command not found...

Packages providing this file are:
'grubby'
'grubby-deprecated'

This is a long-standing software that fedora is ready to discard, but should it be installed by default?If not, why is the official document described above?Without installation, can't the configuration be updated automatically?

Unsolved mystery...

turn

Let's go backGrub.cfgThe way the configuration file is generated.It is generated by grub2-mkconfig, with template files manually generated in / etc/grub.d/, and custom settings in / etc/default/grub files.I mentioned at the beginning that this custom setting is all proprietary variables.Now let's see what's special about template files:

ydx@ydx-mf:~ $ sudo tree /etc/grub.d 
[sudo] password for ydx: 
/etc/grub.d
├── 00_header
├── 01_users
├── 08_fallback_counting
├── 10_linux
├── 10_reset_boot_success
├── 12_menu_auto_hide
├── 20_linux_xen
├── 20_ppc_terminfo
├── 30_os-prober
├── 30_uefi-firmware
├── 40_custom
├── 41_custom
└── README

0 directories, 13 files

I suddenly feel GRUB_ENABLE_BLSCFG and 12_menu_auto_hide has a conflict (it doesn't).I want to investigate GRUB_ENABLE_BLSCFG, finally found the key note.

Something to keep in mind is that kernels installed after switching to a BLS configuration won't be present in the old configuration backup file. On platforms using grub, users can also switch back by installing the grubby-deprecated package, setting "GRUB_ENABLE_BLSCFG=false" in /etc/default/grub , and using grub2-mkconfig to re-generate their configuration file.

As you can see, "GRUB_ENABLE_BLSCFG=false and sudo grub2-mkconfig-o/boot/efi/EFI/fedora/Grub.cfg"It works together!!!"

A new term, BLS (Boot Loader Specification), is also mentioned here.It is understandable to abbreviate the Guided Loader Specification as a "quotation rule".But it's artistic to name a generic term directly as a new norm.

Now I want to start a new specification:

ydx@ydx-mf:~ $ cat /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="resume=/dev/mapper/VG01-swap rd.lvm.lv=VG01/root rd.lvm.lv=VG01/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=false
ydx@ydx-mf:~ $ grub2-switch-to-blscfg
realpath: /etc/grub2-efi.cfg: Permission denied
Couldn't find config file
ydx@ydx-mf:~ $ sudo !!
ydx@ydx-mf:~ $ sudo grub2-switch-to-blscfg   
[sudo] password for ydx: 
Generating grub configuration file ...
Adding boot menu entry for EFI firmware configuration
done
ydx@ydx-mf:~ $ cat /etc/default/grub      
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="resume=/dev/mapper/VG01-swap rd.lvm.lv=VG01/root rd.lvm.lv=VG01/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true

As you can see, GRUB_ENABLE_BLSCFG=true.

Restart to get the latest kernel._

close

There are many solutions on the web, but they are outdated.The correct way to solve a problem is:

Find the root cause of the problem, then the origin of the technology, and finally the first explanation, and finally decide whether to solve the problem or not.

 

Reference resources:
https://www.gnu.org/software/grub/manual/grub/html_node/Simple-configuration.html
https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/kernel-module-driver-configuration/Working_with_the_GRUB_2_Boot_Loader/
https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault

Posted by Shp0ngl3 on Thu, 21 May 2020 16:15:46 -0700