Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

I installed a pae kernel on my Ubuntu 12.04 32-bit box in order to try it (I thought I would add RAM to my computer which I finaly didn't).

It automatically added an entry to grub's boot menu with the pae kernel, which is now the default one.

Now I don't use it any more (just gave it a try). Now every time I boot, I select "previous linux versions" in the boot menu, and then in the submenu I choose the first entry, which used to be the default one prior to installing the PAE kernel.

Now if I uninstall the kernel with apt-get remove (as I installed it with apt-get install), I obviously expect it to leave everything the way it was before: i.e., remove the corresponding item in the boot menu and restore the old one as the default.

The question is: will it do that? I want to be sure that I won't end up with an unbootable machine with an entry in the boot menu for a kernel that is uninstalled, causing grup to freak out or something, or (less disastrous but still annoying) with a useless entry in the boot menu obliging me to choose the right option every time forever as I do now (or to manually reconfigure grup).

share|improve this question

For sure you can apt-get remove kernel that is not in use. To be sure that you're removing right version - you can type dpkg -l |grep kernel in order to find full package name from list and apt-get remove exactly that package.

Unfortunately I don't know if in ubuntu it will automatically edit for you menu.lst or not, in case if not, you will need to cd /boot/grub and edit menu.lst by yourself.

Just open it in your favorit editor, find the line with "uninstalled" kernel and remove entire block, or just check which number is kernel that you want to boot and change parameter default 0 with default N (where N starts from 0 and its number of kernel that you want to default boot)

share|improve this answer
Thanks. It certainly edited the menu when I installed it. I guess that is not a guarantee that it will edit it back when uninstalled, right? Let's suppose it won't (so the boot menu would have a "dead" entry which certainly can't boot). Would that prevent even other, sane, entries in the menu from working? (that is, would it prevent grub itself from properly showing the menu in the first place?) – matteo Dec 13 '12 at 23:28
D'Oh! There's no "menu.lst" in /boot/grub: /boot/grub/command.lst /boot/grub/crypto.lst /boot/grub/fs.lst /boot/grub/moddep.lst /boot/grub/partmap.lst /boot/grub/parttool.lst /boot/grub/terminal.lst /boot/grub/video.lst – matteo Dec 13 '12 at 23:31
Yes in new version of ubuntu they are using grub2 and not grub. grub2 is not using menu.lst anylonger, after uninstalling kernel, you just need to run sudo update-grub it will regenerate grub.cfg. – NauT Dec 14 '12 at 15:57

You must log in to answer this question.

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