Fedora Linux Support Community & Resources Center
  #1  
Old 23rd November 2011, 10:26 PM
jcllings Offline
Registered User
 
Join Date: Feb 2009
Posts: 2
linuxchrome
How can I remove grub2 entries?

Fedora keeps adding kernels and I can't figure out how to delete them. Clue, please?
Reply With Quote
  #2  
Old 23rd November 2011, 10:40 PM
stoat Offline
Registered User
 
Join Date: Jun 2006
Posts: 7,550
linuxopera
Re: How can I remove grub2 entries?

You shouldn't delete them. After you have the maximum number set in yum (usually three), the oldest kernel will be uninstalled automatically when a new one is installed. Those previous kernels come in handy when something gets busted by a new kernel. That's a rare event these days IMO, but it's still a good idea to have those two old kernels around just in case.
Reply With Quote
  #3  
Old 23rd November 2011, 10:45 PM
jcllings Offline
Registered User
 
Join Date: Feb 2009
Posts: 2
windows_7chrome
Re: How can I remove grub2 entries?

So I have a total of like 8 boot entries right now. Failsafe, I can understand but why do I need more than one? Everything else is a duplicate of the latest kernel or the one Windows 7 entry.
Reply With Quote
  #4  
Old 23rd November 2011, 11:00 PM
Firewing1 Offline
Registered User
 
Join Date: Dec 2004
Location: Canada
Age: 23
Posts: 9,224
macossafari
Re: How can I remove grub2 entries?

Quote:
Originally Posted by jcllings View Post
So I have a total of like 8 boot entries right now. Failsafe, I can understand but why do I need more than one? Everything else is a duplicate of the latest kernel or the one Windows 7 entry.
You can eliminate the addition of the failsafe entries by setting/uncommenting GRUB_DISABLE_RECOVERY =true in /etc/default/grub. If you do ever need to boot in recovery mode, hit "e" on a menu entry and simply add:
Code:
1
to the kernel boot parameters.

Update 2011-11-24: Changed GRUB_DISABLE_LINUX_RECOVERY to GRUB_DISABLE_RECOVERY
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #5  
Old 23rd November 2011, 11:12 PM
chrismurphy Offline
Registered User
 
Join Date: May 2010
Posts: 970
macoschrome
Re: How can I remove grub2 entries?

With three linux kernels and Windows, I'd expect there to be 7 entries. If you have 8, then I would:

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

And a new grub.cfg will be created which will contain six linux entries (three kernels multiuser and single user entries for each) and one Windows entry.
Reply With Quote
  #6  
Old 23rd November 2011, 11:57 PM
sonoran Offline
Registered User
 
Join Date: May 2005
Location: Sonoran Desert
Posts: 2,394
linuxfirefox
Re: How can I remove grub2 entries?

My grub2 menu in F16 displays all the kernels on my drives, too. If you look at
'man grubby' there is a --remove-kernel command. I've been meaning to try it and
see if I can simplify my boot menu, but man grubby is not exactly crystal clear.
Quote:
The command line syntax is more than a little baroque. This probably
won't be fixed as grubby is only intended to be called from shell
scripts which can get it right.
I'm not sure whether running grubby with --remove-kernel just removes the menu
entry for that kernel or removes the kernel itself.
Reply With Quote
  #7  
Old 24th November 2011, 03:19 AM
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 7,320
linuxfirefox
Re: How can I remove grub2 entries?

The "proper" way to remove the recovery kernel options from your grub menu is to specify it in your /etc/default/grub file

Edit the /etc/default/grub file (as root) and add the following line to it.

Code:
GRUB_DISABLE_LINUX_RECOVERY="true"
save it, then as root run:

Code:
grub2-mkconfig -o /boot/grub2/grub.cfg

The recovery lines in your grub2 menu are not extra kernels stored on your system, they point to the same kernel files as the regular menu entry does. The only difference in the 2 menu entries is that the rescue kernel has the "single" option on the kernel line

The "improper" way to remove them is to just edit your /boot/grub2/grub.cfg file and remove the menu sections for the rescue entires
If you do it this way, be aware that they will reappear if you ever run grub2-mkconfig, though.

A Fedora kernel update doesn't run grub2-mkconfig, it uses grubby, so manual edits to your /boot/grub2/grub.cfg file will remain after a normal kernel update n Fedora.

Edit:

also, to expand a little more on the OP's question..

Yum will by default keep 3 kernels installed. (The current one and 2 previous ones.) After you get 3 installed, when it updates the kernel again, it will delete the older one for you.

You can change the total number that yum keeps by changing it in your /etc/yum.conf file

as root, edit your /etc/yum.conf file and change the line that has installonly_limit=3 to reflect the total number of Fedora kernels that you wish to keep. (I would never recommend changing it to less than 2 in case a bad kernel install prevented you from booting, you could boot the previous kernel)

Last edited by DBelton; 24th November 2011 at 03:34 AM.
Reply With Quote
  #8  
Old 24th November 2011, 04:55 AM
chrismurphy Offline
Registered User
 
Join Date: May 2010
Posts: 970
macoschrome
Re: How can I remove grub2 entries?

If you add the following line to /etc/default/grub
GRUB_DISABLE_RECOVERY=true

Followed by the command:
grub2-mkconfig -o /boot/grub2/grub.cfg

your resulting grub menu will not contain recovery options. If you need a recovery boot, you can choose an existing kernel entry in the menu, edit the entry manually adding single to the end of the line, then boot. Useful if you rarely need to boot in recovery.
Reply With Quote
  #9  
Old 24th November 2011, 05:08 AM
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 7,320
linuxfirefox
Re: How can I remove grub2 entries?

You are correct, chris.

I stated it's GRUB_DISABLE_LINUX_RECOVERY, which is what everything says it is supposed to be, but if you look in the /etc/grub.d/10_linux file, it is looking for GRUB_DISABLE_RECOVERY as you stated.
Reply With Quote
  #10  
Old 24th November 2011, 12:46 PM
David Batson Offline
Registered User
 
Join Date: Jul 2009
Posts: 1,234
windows_7opera
Re: How can I remove grub2 entries?

Perhaps not your situation, but related none the less.

I have 4 OS's installed on my hard drive. I tried os-prober in arch, but it put too many entries in grub2 for my liking. I uninstalled os-prober and deleted /etc/grub.d/30_os-prober. I added my additional menu entries to /etc/grub.d/40_custom. Then I deleted my /boot/grub/grub.cfg file and reran grub2-mkconfig -o /boot/grub2/grub.cfg.
__________________
Fedora 19 Gnome on a ThinkPad X220, i5-2540M CPU, Intel HD Graphics 3000, Intel N 6205 wireless, and Sierra Wireless 754S Mobile Hotspot (AT&T)
Reply With Quote
  #11  
Old 24th November 2011, 02:57 PM
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 7,320
linuxfirefox
Re: How can I remove grub2 entries?

David..

There is no need to delete the scripts in /etc/grub.d if you no longer wish to run them.

Just set them as non-executable with chmod and they won't be picked up by grub2-mkconfig

chmod -x /etc/grub.d/30_os-prober
Reply With Quote
  #12  
Old 24th November 2011, 05:36 PM
David Batson Offline
Registered User
 
Join Date: Jul 2009
Posts: 1,234
windows_7opera
Re: How can I remove grub2 entries?

Quote:
Originally Posted by DBelton View Post
David..

There is no need to delete the scripts in /etc/grub.d if you no longer wish to run them.

Just set them as non-executable with chmod and they won't be picked up by grub2-mkconfig

chmod -x /etc/grub.d/30_os-prober
Good to know, however if I'm not mistaken /etc/grub.d/30_os-prober was just a placeholder (empty file) until I installed os-prober. Uninstalling os-prober did not remove the script.
__________________
Fedora 19 Gnome on a ThinkPad X220, i5-2540M CPU, Intel HD Graphics 3000, Intel N 6205 wireless, and Sierra Wireless 754S Mobile Hotspot (AT&T)
Reply With Quote
  #13  
Old 24th November 2011, 08:28 PM
chrismurphy Offline
Registered User
 
Join Date: May 2010
Posts: 970
macoschrome
Re: How can I remove grub2 entries?

Quote:
Originally Posted by Firewing1 View Post
You can eliminate the addition of the failsafe entries by setting/uncommenting GRUB_DISABLE_LINUX_RECOVERY=true in /etc/default/grub.
It should be:
GRUB_DISABLE_RECOVERY=true


---------- Post added at 01:24 PM ---------- Previous post was at 01:22 PM ----------

Quote:
Originally Posted by David Batson View Post
Good to know, however if I'm not mistaken /etc/grub.d/30_os-prober was just a placeholder (empty file) until I installed os-prober. Uninstalling os-prober did not remove the script.
Instead add the line to /etc/default/grub
GRUB_DISABLE_OS_PROBER=true

---------- Post added at 01:28 PM ---------- Previous post was at 01:24 PM ----------

After changing /etc/default/grub you need to rerun grub2-mkconfig.

What I'm presently perplexed about is I have three Fedora 16 systems which started with various states of beta and final builds, but all are completely yum updated. All but one of them overwrites grub.cfg when grub2-mkconfig is called. The other system insists on naming the newly created one as grub.cfg.new despite the on-screen status while building the configuration saying that it's creating grub.cfg not grub.cfg.new. Bogus!

Last edited by chrismurphy; 24th November 2011 at 08:56 PM.
Reply With Quote
  #14  
Old 24th November 2011, 08:30 PM
Firewing1 Offline
Registered User
 
Join Date: Dec 2004
Location: Canada
Age: 23
Posts: 9,224
macossafari
Re: How can I remove grub2 entries?

Oops, good catch. I updated my original post to GRUB_DISABLE_RECOVERY.
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #15  
Old 27th September 2012, 06:37 AM
jogreen29b Offline
Registered User
 
Join Date: Aug 2011
Posts: 11
linuxfirefox
Re: How can I remove grub2 entries?

Making more space in /boot as a part of preupgrade from F15 to F16 (https://fedoraproject.org/wiki/How_to_use_PreUpgrade) I was using prune.py and somehow managed to get the following last menu entry record in grub.cfg:

egrep ^menuentry\|^set /boot/grub2/grub.cfg
set default="0"
set timeout=5
menuentry 'Fedora (3.4.11-1.fc16.x86_64)' --class fedora --class gnu-linux --class gnu --class os {
menuentry 'Fedora (3.4.9-2.fc16.x86_64)' --class fedora --class gnu-linux --class gnu --class os {
menuentry 'Fedora Linux, with Linux prune.py' --class fedora --class gnu-linux --class gnu --class os {

I guess (please correct me if I'm wrong), there is no harm in having it there and, eventually, it will be pushed away by new kernels... but how, pray tel,l it get there?
Reply With Quote
Reply

Tags
grub 2, remove

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW TO: remove GRUB2 booloader and recover windows default deathmood Guides & Solutions (No Questions) 4 18th March 2013 01:31 AM


Current GMT-time: 15:26 (Wednesday, 22-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Avezzano Travel Photos on Instagram - Don Benito - Vassouras Travel Photos on Instagram