Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can we add a kernel to grub2? i knew the stuff we could do with the former versions, but it seems to have changed. What files should we edit?

share|improve this question

migrated from stackoverflow.com Nov 8 '10 at 13:58

This question came from our site for professional and enthusiast programmers.

To add a new kernel to grub2:

  1. Move your kernel to /boot/
  2. Run sudo update-grub

update-grub will scan your computer for kernels, and create a listing of available kernels at boot.

In order for you to select which kernel to boot at boot time, you may have to hold the SHIFT button down right after your BIOS does it's posting.

You can edit /etc/default/grub to change default boot options and parameters that you may need.

Edit: Just a note: update-grub/update-grub2 are present only for debian-based distros. You will have to follow grub2 documentation or your distros wiki/something. For example for fedora, see here

share|improve this answer

/boot/grub/grub.cfg is the file that replaced menu.lst from grub1

In Debian/Ubuntu systems this is generated by update-grub, which runs the scripts in /etc/grub.d using something similar to run-parts.

share|improve this answer

If the new kernel is installed with dpkg (as if it's compiled with make-kpkg), update-grub2 is enough (it removes no more existent kernels, too)

share|improve this answer

You don't "edit" to add kernels anymore. It scans and adds them dynamically. If you MUST add one a scan doesn't find you should look in /etc/grub.d and modify or copy and custom40(it is added last so it's a great place to test your config before you put it at the top of your list).

share|improve this answer

Try update-grub or update-grub2 depending on you grub version. You will have to run these as root, sudo. This worked for me when I installed a second Linux distro without reinstalling grub.

share|improve this answer
    
I realized that my answer is similar to Alan's answer, but I added the grub2 command. – tjameson Mar 31 '11 at 19:38

I'm running Fedora 20, and the command to update grub2 is grub2-mkconfig. Also, the entire process can be accomplished with the kernel build make:

make xconfig (make config, etc)
make bzImage
make modules
sudo make modules_install
sudu make install

This (last step) will copy the kernel into /boot, and update the grub2 boot loader. Very easy, and it worked correctly in my case. My only issue is that you don't really learn any important details of the process, everything is automated. If you have problems and have to figure out what's wrong, you could get stuck.

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.