 |
 |
 |
 |
| Installation and Live Media Help with Installation & Live Media (Live CD, USB, DVD) problems. |

23rd November 2011, 10:26 PM
|
|
Registered User
|
|
Join Date: Feb 2009
Posts: 2

|
|
|
How can I remove grub2 entries?
Fedora keeps adding kernels and I can't figure out how to delete them. Clue, please?
|

23rd November 2011, 10:40 PM
|
|
Registered User
|
|
Join Date: Jun 2006
Posts: 7,551

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

23rd November 2011, 10:45 PM
|
|
Registered User
|
|
Join Date: Feb 2009
Posts: 2

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

23rd November 2011, 11:00 PM
|
 |
Administrator
|
|
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224

|
|
|
Re: How can I remove grub2 entries?
Quote:
Originally Posted by jcllings
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: to the kernel boot parameters.
Update 2011-11-24: Changed GRUB_DISABLE_LINUX_RECOVERY to GRUB_DISABLE_RECOVERY
|

23rd November 2011, 11:12 PM
|
|
Registered User
|
|
Join Date: May 2010
Posts: 867

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

23rd November 2011, 11:57 PM
|
 |
Registered User
|
|
Join Date: May 2005
Location: Sonoran Desert
Posts: 2,108

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

24th November 2011, 03:19 AM
|
 |
Administrator
|
|
Join Date: Aug 2009
Posts: 6,612

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

24th November 2011, 04:55 AM
|
|
Registered User
|
|
Join Date: May 2010
Posts: 867

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

24th November 2011, 05:08 AM
|
 |
Administrator
|
|
Join Date: Aug 2009
Posts: 6,612

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

24th November 2011, 12:46 PM
|
|
Registered User
|
|
Join Date: Jul 2009
Posts: 1,158

|
|
|
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 18 Gnome on a ThinkPad X220, i5-2540M CPU, Intel HD Graphics 3000, Intel N 6205 wireless, and Sierra Wireless 754S Mobile Hotspot (AT&T)
|

24th November 2011, 02:57 PM
|
 |
Administrator
|
|
Join Date: Aug 2009
Posts: 6,612

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

24th November 2011, 05:36 PM
|
|
Registered User
|
|
Join Date: Jul 2009
Posts: 1,158

|
|
|
Re: How can I remove grub2 entries?
Quote:
Originally Posted by DBelton
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 18 Gnome on a ThinkPad X220, i5-2540M CPU, Intel HD Graphics 3000, Intel N 6205 wireless, and Sierra Wireless 754S Mobile Hotspot (AT&T)
|

24th November 2011, 08:28 PM
|
|
Registered User
|
|
Join Date: May 2010
Posts: 867

|
|
|
Re: How can I remove grub2 entries?
Quote:
Originally Posted by Firewing1
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
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.
|

24th November 2011, 08:30 PM
|
 |
Administrator
|
|
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224

|
|
|
Re: How can I remove grub2 entries?
Oops, good catch. I updated my original post to GRUB_DISABLE_RECOVERY.
|

27th September 2012, 06:37 AM
|
|
Registered User
|
|
Join Date: Aug 2011
Posts: 8

|
|
|
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?
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 17:22 (Thursday, 23-05-2013)
|
|
 |
 |
 |
 |
|
|