6

I want to make an edit to /boot/grub/grub.cfg . I save the file and run sudo update-grub. But when I reboot, the old version is still being used by grub. So it seems update-grub is not using this file. How should I really do this? (I can press 'e' at the command line and edit the entry. But there seems no way to save this, and I don't want to keep making the edit each time I boot).

1

3 Answers 3

6

update-grub uses grub.cfg - it re-generates it. To the regeneration, it uses

  • list of your kernel/initrd images in /boot
  • configuration in /etc/default/grub
  • and the configuration generator scripts in /etc/grub.d.

To change grub.cfg permanently, you can do one of these:

  • Not using update-grub any more (painful)
  • Editing the files/configs above (need a little learning, but not too much)
  • Switching to another boot manager, for example to LILO (all have advantages and disadvantages - grub is only the most popular today, becase it integrates best with easy-to-use distros)
3

Well to my surprise I found that running:

grub-mkconfig -o /boot/grub/grub.cfg

before running update-grub fixed the problem I had. This seems inexplicable since it seems that update-grub looks as though it is calling grub-mkconfig. Anyway now my edits to 40_custom etc are being picked up.

Thanks to all for helpful responses.

0
2

You can add a custom menu to /etc/grub.d/40_custom, it will be added to /boot/grub/grub.cfg file after update-grub.

explained here : Configuring GRUB v2:

The configuration file is /boot/grub/grub.cfg, but you shouldn't edit it directly. This file is generated by grub v2's update-grub(8), based on:

  1. The script snippets in /etc/grub.d/

  2. The configuration file /etc/default/grub

To configure grub "v2", you should edit /etc/default/grub, then run update-grub. Advanced configuration are achieved by modifying the snippets in /etc/grub.d/.

You must log in to answer this question.

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