GRUB2 doesn't have the menu.lst file.

How do I configure a boot script.

During boot, I hit E on the kernel image that I want to modify and make my modifications. But I would prefer to make the modifications in /grub.d/ folder and then run update-grub command.

Basically, I am including certain modules at boot time, using insmod, there are too many such modules for me to do it every time, and Im unable to edit those different looking scripts GRUB has currently.

I figured that /etc/grub.d/ contains files like


but they look like scripts that I should be careful when I modify. Is there a easier way, like using menu.lst to configure grub2

  • 2
    the boot loader doesn't deal with kernel modules, the init ramfs does. Commented Dec 20, 2013 at 16:40

1 Answer 1


The main config file is /boot/grub/grub.cfg. As it says at the top:


It is automatically generated by grub-mkconfig using templates
from /etc/grub.d and settings from /etc/default/grub

As you can see, /boot/grub/grub.cfg is generated by files from /etc/grub.d. As mentioned in /etc/grub.d/README, you can add extra files to /etc/grub.d for custom additions to /boot/grub/grub.cfg. I don't know exactly what you want, but for example you could add the insmods you require to a /etc/grub.d/01_custom_header, and after regenerating /boot/grub/grub.cfg using grub-mkconfig, the contents of this file should then appear in /boot/grub/grub.cfg after /etc/grub.d/00_header.

UPDATE: To be clear, the modules that are loaded by grub.cfg are GRUB modules, not kernel modules. These modules are loaded so that GRUB has enough functionality to (for example) handle LVM volumes and read filesystems. This isn't a place where you can put kernel modules. This was prompted by @Stephane's comment. I should have noticed this earlier but didn't.

  • That was helpful, thank you. So what I basically do is copy 00_header as 01_custom_header and make whatever insmod i want to add in that file and run grub-mkconfig and finally run update-grub. Right? Commented Dec 20, 2013 at 9:40
  • @Vigneshwaren Don't copy, just create a new file. If you copy, you will get the same functionality twice -- what effect that has, I don't know. It might cause grub-mkconfig to fail.
    – Chris Down
    Commented Dec 20, 2013 at 9:50
  • @Vigneshwaren No. The files in that subdirectory are concatenated together. Put the new/extra stuff you want in the new file, you don't want anything from 00_header because then it will just be repeated. You don't want that. Commented Dec 20, 2013 at 12:07
  • @Vigneshwaren You just run update-grub. The contents of update-grub are just #!/bin/sh set -e exec grub-mkconfig -o /boot/grub/grub.cfg "$@" Commented Dec 20, 2013 at 13:30

You must log in to answer this question.

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