Why so many files relating to grub (/etc/grub.d/, /etc/default/grub, /boot/grub2/grub.cfg)? What is the purpose of each?

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?

4

1 Answer

/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.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like