Why does grub2-mkconfig fails with "no command and will do nothing" error ?

Solution Verified - Updated -

Issue

  • grub2-mkconfig fails to generate grub configuration file
[root@rhel8 ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
Generating grub configuration file ...
Script `/boot/efi/EFI/redhat/grub.cfg.new' contains no commands and will do nothing
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/efi/EFI/redhat/grub.cfg.new file attached.

The file created /boot/efi/EFI/redhat/grub.cfg.new is an empty file.

[root@rhel8 ~]# cat /boot/efi/EFI/redhat/grub.cfg.new
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

Environment

Red Hat Enterprise Linux 7
Red Hat Enterprise Linux 8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content