linux - How to add a new kernel to grub2

18
2014-04
  • Green Code

    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?

  • Answers
  • Community

    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

  • Flexo

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

  • Mr Shunz

    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)

  • hbdgaf

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

  • tjameson

    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.


  • Related Question

    linux - How do I install a 64-bits kernel in my Ubuntu?
  • Daniel Cukier

    I'm running in a machine with a 64bits CPU, but my kernel shows me (when I use uname -m command) that I'm running on 32bits (686). How can I change the kernel version to use all capacity of my machine?


  • Related Answers
  • Diago

    You need to download and install the 64-Bit version of Ubuntu.

    There is no way to do a direct upgrade from 32-Bit to 64-Bit.

    You can get the X86_64 version from the Ubuntu download site here