Im searching for grub.conf file in CentOS 7. I cant find it with locate(I called updatedb before). Where does it stores?

In older versions of CentOS I could find it.

2 Answers 2


CentOS7 is using grub2 and the generated /boot/grub2/grub.cfg rather than the old grub.conf format, which is why you can't find it. The new grub.cfg file is not intended for direct editing, instead you need to modify the source files that are used to generate it.

The files in question are /etc/default/grub and the scripts in /etc/grub.d/. In particular, if you are looking to add your own custom entries, then you will want to append a boot stanza to /etc/grub.d/40_custom. The stanza will look something like this:

menuentry "My custom boot entry" {
        set root=(hd0,1)
        linux /vmlinuz-3.11-custom
        initrd /initrd-plymouth.img

You can add the usual options to the linux line to pass in custom options to the kernel. Once you have everything looking the way you want it to, you run:

grub2-mkconfig --output=/boot/grub2/grub.cfg

Then, if you want to alter the default boot entry, you change the GRUB_DEFAULT option in /etc/default/grub to point to the new stanza you added, by zero indexed position or by name (I prefer name), something like this:

GRUB_DEFAULT="My custom boot entry"
  • 2
    I was trying to revert from a custom kernel to stock and this answer was extremely useful in that process. If you have a machine which came with a custom kernel, such as OVH servers, "yum install kernel" will create the necessary files in /etc/grub.d/ and you will just need to run grub2-mkconfig and change GRUB_DEFAULT to get back to a stock kernel.
    – eseglem
    Nov 21, 2014 at 22:29
  • 4
    If you use UEFI, it's at /boot/efi/EFI/redhat/grub.cfg
    – sjas
    Jun 15, 2015 at 21:03
  • nano /etc/grub.d/40_custom && grub2-mkconfig -o /boot/grub2/grub.cfg && grub2-reboot 4 && reboot [My favorite part of editing grub, is manually specifying the reboot to entry 4 temporarily, then having it reboot to a rescue iso, then when I reboot the liveISO it reboots back to default entry, aka the OS] Jul 1, 2016 at 21:20
  • also with CentOS 7 i found I had to use (hd0,msdos3) aka /dev/sda3 vs (hd0,2) Jul 1, 2016 at 21:42
  • 1
    Note @sjas is correct except in this specific case it's centos, not redhat, so the path is /boot/efi/EFI/centos/grub.cfg Mar 31, 2017 at 16:26

Try with following command:

find / -type f -name "grub.conf"

You can find any other file name you want by replace it to grub.conf.

  • This is teaching how to fish, instead of handing out fish. No need to downvote.
    – sjas
    Jun 15, 2015 at 21:04
  • 1
    @sjas: except that the file might be called grub.cfg so it taught how to fish but not very well. (N.B I'm not the down voter).
    – dave
    Mar 30, 2017 at 23:50
  • find / -type f -name "grub.conf" -o -name "grub.cfg" for grub2 compatibility. Jan 26 at 21:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .