2

I've been looking around to solve a black screen problem and found some pages with a very similar solution but each one using different grub files to edit.

For instance I've found examples using grub here /etc/default/grub and here /boot/grub/grub.cfg.

What is the difference between them and which one should I edit?

4 Answers 4

3

As the comment at the start of /boot/grub/grub.cfg says:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

In other words, any time you run update-grub or it is run for you ( for instance, when install a new kernel, or certain other packages ), grub.cfg is thrown out and recreated, so edit /etc/default/grub.

1
  • Additionally colors in grub.cfg may require editing in /etc/grub.d/05_debian_theme Apr 3, 2017 at 3:02
0

if you are using ubuntu 9.10 karmic koala or later then it is Grub2. Grub2 uses /boot/grub/grub.cfg and is generated automatically when you invoke update-grub command So you can not edit it.

you MUST edit /etc/default/grub or /etc/grub.d/ but Never edit /boot/grub/grub.cfg

0

/etc/default/grub is a user editable file which is used by update-grub and grub-mkconfig to construct /boot/grub/grub.cfg which is not usually edited by users. Some experimenters and such edit it anyway knowing [or not] that their changes will be wiped out the next time update-grub is run.

There is another set of files in /etc/grub.d/ which are scripts used by grub-mkconfig in the process of making /boot/grub/grub.cfg. This is another common place to work grub magic.

0

The first, /etc/default/grub is the one you should edit. The second one, /boot/grub/grub.cfg, is produced by runing update-grub. There are comments in the beginning of each of those files reminding you of which is which. It mentions grub-mkconfig but that's a program that is run by update-grub.

The first one only has rather permanent information that tell update-grub what you want. The second merges that information with what operating systems you had on your system at the time you ran update-grub and is what grub itself uses to produce the boot menu.

To see information on using the /etc/default/grub use the info -f grub -n 'Simple configuration' command.

Most people don't have to mess with any of this. When Ubuntu is installed it puts something reasonable in /etc/default/grub and that is that.

You must log in to answer this question.