I have seen that grub2 configuration files exist in so many different locations.

  1. /etc/grub.d
  2. /etc/default/grub
  3. /boot/grub2/grub.cfg

Can anyone tell me the purpose of each directory/file?

  • 3
    I recently stumbled upon /etc/default/grub.d... Is it new? should I store settings into a file stored in this dir? doesn't seem to work, though...
    – JPT
    Nov 10, 2019 at 15:47
  • The files in /etc/default/grub.d need to be named .cfg
    – JPT
    Nov 11, 2019 at 8:20
  • 1
    "The files in /etc/default/grub.d need to be named .cfg". I don't think so!
    – Quidam
    Jun 3, 2020 at 11:57
  • and now I see in debian buster a new folder : /etc/default/grub.d !!! Jan 7, 2021 at 3:04

1 Answer 1


/etc/default/grub is where you can set simple options for many GRUB settings. It is parsed as a shell script.

/etc/grub.d contains shell scripts which generate GRUB configuration (based on settings on /etc/default/grub). update-grub (aka grub-mkconfig) runs these scripts to generate actual GRUB configuration.

/boot/grub2/grub.cfg is where the generated configuration is saved for GRUB to use.

Ordinarily, for setting GRUB options, you edit /etc/default/grub. If you need to generate additional GRUB entries or alter the entries generated, then add or change scripts in /etc/grub.d. Don't manually edit /boot/grub2/grub.cfg.


You must log in to answer this question.

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