执行grub2-mkconfig命令时,hang住

发布时间 2023-10-26 08:52:12作者: 石云华

背景:

一套新安装的ORACLE数据库环境,检查发现数据库主机上的transparent hugepages功能没有关闭。

修改完/etc/default/grub文件,执行grub2-mkconfig命令时hang住,很长时间都未执行完成。

 

原因:

当修改完/etc/default/grub配置文件,执行grub2-mkconfig命令生成新的grub.cfg配置文件时,grub2-mkconfig命令需要扫描当前主机上的所有磁盘。如果主机上挂载的磁盘比较多时,则扫描工作会花费比较多的时间,也就会出现这种hang住的现象。

 

解决方案:

在/etc/default/grub配置文件中,添加 GRUB_DISABLE_OS_PROBER=true条目。后期再修改/etc/default/grub配置文件,则grub2-mkconfig命令能很快完成。

 

下面是GRUB_DISABLE_OS_PROBER的解释:

'GRUB_DISABLE_OS_PROBER'

Normally, 'grub-mkconfig' will try to use the external 'os-prober' program, if installed, to discover other operating systems installed on the same system and generate appropriate menu entries for them. Set this option to 'true' to disable this.