Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 4

up vote 2 down vote accepted

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.

share|improve this answer

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

share|improve this answer

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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.