Ubuntu Installation :: Grub2 Removing Old Kernel Versions Forever
Apr 14, 2010
Here's how to always have only the latest kernel version in your grub:
Code:
sudo gedit /etc/grub.d/10_linux
Find these lines:
Code:
list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
And change it with this:
Code:
for ver in /boot/vmlinu[xz]-* ; do
list="$ver"
done
Notice two differences.
1. There's no ` before "for" and after "done" keywords.
2. There's no list= before "for"
If you want to change the name of entry, scroll down to the end of the file and find last two occurrences of:
Code:
linux_entry
${OS} stands for Ubuntu and ${version} stands for your kernel version. I changed this into:
Code:
linux_entry "${OS} 9.10 Karmic Koala"
You can use your own imagination. If you want to have specific name for your Windows entry, in /boot/grub/grub.cfg copy everything between:
Code:
### BEGIN /etc/grub.d/30_os-prober ###
and
Code:
### END /etc/grub.d/30_os-prober ###
paste it in
/etc/grub.d/40_custom
Change the text between double quotes right after menu entry. (For example, my 40_custom looks like this now:
Code:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the menu entries you want to add after this comment. Be careful not to change the 'exec tail' line above.
menuentry "Windows 7" {
insmod ntfs
set root=(hd0,1)
search --no-floppy --fs-uuid --set bcdc24dddc249424
chainloader +1
}
)
and make 30_os-prober not executable:
Code:
sudo chmod -x 30_os-prober
If you want to remove recovery mode entry, just uncomment this line in /etc/default/grub:
Code:
#GRUB_DISABLE_LINUX_RECOVERY="true"
PS Don't forget to run
Code:
sudo update-grub
After you finish editing everything! And check in /boot/grub/grub.cfg if everything is ok!
I have looked for existing threads on this issue, but found no matches, so I am starting a new one.I first installed Ubuntu 9.04 on my laptop from a bought CD last year. When I later installed the kernel updtates with the Update Manager, I noticed the the list of versions growing when I booted up. Then something horrible happened. After installing maybe the third or fourth kernel update, I couldn't boot into Ubuntu, it failed every time. After that I left Ubuntu broken on my laptop for a while.I have now reinstalled from the CD again However, I am now very wary when it comes to installing even the important security updates, never mind the recommended ones! I prefer to keep it simple, because I don't want to do any more reinstalls for a while. So far I have just one kernel headers update on the boot list, and I am trying to figure out how to remove the previous one. I do not see the point in having a growing list of them again.
How do you go about removing old kernel from other distros from the grub menu. For example I have lucid and ubuntu studio installed. Lucid controls the grub2. So how would I remove the old kernel out of the ubuntu studio?
Ubuntu, Linux 2.6.31-19-generic Ubuntu, Linux 2.6.31-19-generic (recovery mode) Ubuntu, Linux 2.6.31-14-generic Ubuntu, Linux 2.6.31-14-generic (recovery mode)
Q1) I only really need the latest kernel, 2.6.31-19, don't I?
Q2) So how can I get rid of the two 2.6.31-14 entries?
Today, I used the Update Manager to do my first post-installation update of Ubuntu 9.10. I have a multi-boot setup (Ubuntu / WinXP), using GRUB2. Before the update, I had 5 options: Ubuntu, Linux 2.6.31-14-generic Ubuntu, Linux 2.6.31-14-generic (recovery mode) Memory test (memtest86+) Memory test (memtest86+, serial console 115200)
[Code]...
Is it valid that the -14- has remained in the list? Surely I can only boot -20- now? How should I get rid of this version since it is added by update-grub because of the existence of this file: /boot/vmlinuz-2.6.31-14-generic,Should I delete the file or just rename it? Or is there a better way?
Trying to install VMWare I get the following message:
Really after it VMWare anyway doesn't agree to install. Zypper says that no newer version of gcc is available. So I can't see how I can install VMWare.
I need to prevent that the latest kernel update removes the only kernel that still works in my computer. how can i do this? Currently I have 3 linux kernels versions:
But only the oldest works. With the new update there is a new kernel version (2.6.32-24) that possibly will not boot (like previous 2.6.32-* kernels) and also I expect that, as in previous updates, the oldest kernel will become inaccessible, thus rendering my ubuntu unbootable.
PS: unsolved threads on the underlaying problem: Can't boot default kernel after upgrading from 9.xx to 10.04 lucid Upgrade to 10.04 freezes on the Ubuntu screen
I have winxp and ubuntu 10.04 dualboot. They were working ok. Today I removed old *21 kernel image and headers so grub updated the confs. That's all I did that could cause the win no longer boot. It starts booting, the screen goes black and the PC reboots. I tried safe mode, it started to load some dlls as it usually shows in safe mode but then still reboot.
Code: $ sudo fdisk -l Disk /dev/sda: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
I have Ubuntu 10.10 installed on my laptop.Its a dual boot with XP, have been using ubuntu/xp for a while now..Till now i always used to remove older kernel images after ubuntu update, then update grub and do "sudo apt-get autoclean" never had any problem at all.i skipped the second step, i removed the old kernel image and did "Autoclean" on apt-get but forgot to update grub.
Now after i have reboot, when grub loads i can see only 2 "Memtest" lines in grub list and 1 "windows xp" line.the "Linux kernel generic" line is missing. I can boot in xp (have done just that to post this) but since there is no line in grub list to boot into Ubuntu, cant boot in Ubuntu.Is there any option, something i can do at "Grub" to boot into Ubuntu?
I have not dug into Ubuntu for almost a year now (Since Jaunty, really). I am trying to come to grips with Grub2, but have just now encountered it in Lucid. I am having a terrible time with the graphics chipset, and it may well be that Ubuntu cannot be used on this computer (an older laptop with the dreaded Intel 82845G graphics chip). There are a number of older bug reports that it is unsupported, but some success in more recent versions.
Anyway, one suggestion has been to add i915.nomodset=1 to the kernel boot line. Now, this was a cinch in Legacy Grub, but I have been reading Grub2 wikis and tutorials for two days now, and I know about the config files, but I cannot find anything which tells me specifically how to add a parameter to the kernel boot line.
Is removing previous older kernels "vmlinuz", when updates do get a newer version an easy task, or do the more recent Linux like Ubuntu 9.10 do that automatically, and only keep a few older previous kernels ?
I had the 180.xxx nvidia drivers on my FC10 setup.I installed the 185.xxx and am running into issues. It gives me the fatal server error: no screens found message. Before that it says that the nvidia kernel module is 180.xxx and the driver component has 185.xxx. I can't seem to figure out how to uninstall the previous module to make this work. I removed the yum kmod nvidia. I'm running this using sh nvidia.185xxx.xxxx.run . The weird thing is that it sometimes would work but then I would restart and it would break again. Thanks in advance,
I just did an upgrade and it included the kernel. As time goes by, I will be stuck with a lot of kernels to choose from, and lower disk space. How do I remove an older kernel and everything it's related to it without breaking stuff?
I've been using Ubuntu since 7.10 Gutsy Gibbon. I only recently fully switched to Linux OS's, and Ubuntu is now my primary. I currently have 9.10 installed. CURRENTLY I also have Backtrack 4, and Fedora 12 (Ugh!).Previously, I thought something was wrong with my my filesystem in Ubuntu 9.10, and after an upgrade of the linux kernel, I started to get Error: You need to load the Kernel First. That's where my problems started. I had upgraded to 9.10 from 9.04 and I still had Grub Legacy, so I went through hoops to try and get it to work, but eventually everything just kind of broke, and I completely wiped off my partitions on it and started fresh installs of all 3.
And now that the new linux kernel is released, 2.6.31-20 generic (I think... That's what the highest number on a file I can find in /boot is)I went through a few more hoops and ladders and tried to get it to work, but to no avail. I've looked the internet for a solution to this and tried just about everything but there is no unified answer, and I've seen on Launchpad there are alot of bugs that are classified as 'Fixed', but the problem still remains.I took out the 'quiet splash' part in the GRUB2 line for the newest kernel and it didn't do anything. It only changed it to "Error: Couldn't find file".This is the top two kernels (Main and Recovery for the new, and Main and Recovery for the previous working one)
Quote:
### BEGIN /etc/grub.d/10_linux ### menuentry "Ubuntu, Linux 2.6.31-20-generic" { recordfail=1
I have installed grub2 on a flash drive to boot some os's that I want to carry around. But in grub.cfg when i put this:
Code: menuentry "BackTrack Persistent" { set gfxpayload=1024x768 linux/backtrack/boot/vmlinuz BOOT=casper boot=casper persistent rw quiet initrd/backtrack/boot/initrd.gz } it does exactaly the same thing as this
[Code]....
I'm thinking of filing a bug report but I want to make sure i'm not doing something wrong first.
I have recently installed the Maverick backport kernel (2.6.35 - from the lucid-updates/main repo) and while I was at it I also manually (through synaptic) got rid of some old kernels. I made sure that I kept the current Lucid kernel though (that was working fine). All seemed well (although I didn't actually check - just no errors) so I rebooted.On reboot I have lost all my Ubuntu kernel options!
jed@lightning:/boot$ ls abi-2.6.32-31-generic memtest86+.bin abi-2.6.32-32-generic System.map-2.6.32-31-generic
[code]....
Even reinstalled burg (used to use it but it got broken by a kernel update long ago and never bothered to fix it as I only use Linux these days anyway)Funny thing is that BURG finds the kernels and reports no problem, but then drops to the grub-error prompt on boot.
I have made a custom grub2 menu however, both the default and the custom show together. So my grub looks like the list below, the bolded entries are my custom ones. How do I get rid of the duplicates? I have tried apt-get remove and deleting old kernels.
ubuntu,linux ... ubuntu,linux recovery memtest memtest windows7 windows7 ubuntu linux ubuntu linux recover
I'm simply trying to remove old kernels and second rename things that are on the list. It used to take me 10 seconds with grub1, but having some difficultly with grub2. So far I went into /boot/ and removed the old kernels and then did a sudo update-grub2 and it seemed to remove all the old kernels from the list. Is this the best way or doing it or any issues on doing it this way? Second I just want to rename what boots up like Ubuntu 2.6.32-22-generic to something else. I keep read not to modify the grub.cfg, but not sure what to do? I poked around the files in /etc/grub.d/, but not sure what to do?
I've taken the kernel 2.6.33.3 and edited the .config file to take out most of the compatibility etc. that I will not be using. I'm run the makes and updated grub. I go to boot it runs through most of the way until I get the following:Quote:/bin/plymouthd: symbol lookup error: /bin/plymouthd: undefined symbol:ply_chara could not read byte from child: SuccessNo root device foundBoot has failed, sleeping forever.'m fairly new to Linux and still more of a dabbler. (Though this seemed more difficult than "Who is root" so I didn't put this in the newbie thread.)Any ideas for what might be wrong?I've tried looking in the config file from something that relates, but they have all been included (Y) in the module.
Have recently installed 10.10 and have several other OS' installed, as well as other NTFS (non-OS) partitions. After a couple of updates, my boot menu shows about 8 entries, whereas I should only have about 4... How is this fixed in Grub2?
Have installed Startup Manager, and there seems to be no option here...
what i did was, remove evolution mail from synaptic, what i wanted to do was just remove the indicator applet from the task bar. i read a bunch of bad stuff about removing evolution from synaptic vs just removing the applet.
im worried. did i break anything or put my security at risk. after, i used a command (older) (sudo apt-get install ubuntu-desktop)to install ubuntu desktop. because i thought that it would fix evolution. then i went to synaptic and installed a package called evolution. i rechecked evolution in applications menu. however, i notice that i have both a checkable evolution and two evolution icons. nothing 'seems' broken. im not sure if it ever was. and evolution calender pops up as normal, as does the the installed plain evolution. they both seems to be an exact copy of the other.
all i really wanted to do was remove the indicator applet. did i make a serious mistake. since ive had ubuntu, ive reformatted a lot because i was worried i made a mistake of some kind. however now im into the more "make a mistake and fix it stage' as im pretty happy with my current desktop and have worked hard to customize it. the command, sudo apt-get remove indicator-messages removed the mail icon. i still am worried that i broke something, or put my security at risk. also, now i have two mail icons. evolution mail and calendar, and another just called evolution.
I've been having some odd kernel issues recently. A while back I installed 2.6.32rc6 when I first upgraded to 9.04, because it solved issues I was having with surround sound. A few months back I installed mythtv and the mythbuntu binaries as well, although I have since uninstalled them. All of a sudden, I seemed to have issues booting into ubuntu with certain versions of the kernel, where it would just freeze at the white ubuntu logo, while other versions of the kernel would load fine (I think 2.6.31?) but it would display the mythbuntu logo instead (not sure if this is related).
I just upgraded to 10.04, and I still seem to have issues booting with certain kernel versions. Right now I'm running 2.6.32-020632rc6-generic which seems to work, but it's outdated, and I have surround sound issues again. Which one should I be using? Is there a way to clean this mess up? How do I fix the problem of freezing at the boot screen?
it turns out that I don't have my Ubuntu option in GRUB any more. I need the kernel version in order to add it to my list file. Any help? I can't boot it to find out because GRUB doesn't recognize it as an option.
How do I know the exact kernel version (or rpm package name) of fedora 14 without having to install one? I couldn't find the information on the the website. And one more question. Does one fedora distribution has only one kernel available all the time? Where can I find all the kernels for a particular distribution (for example Fedora 12) distributed by Fedora Project? I can find all the available kernels for a RedHat Enterprise distribution on [URL], but not for Fedora.
When yum updates the kernel it keeps the last 3 versions; the older kernels are deleted. Is there a way to keep more than 3 versions?
I presently have one working version and two which are not compatible with my machine. One more bad version and my system will be toast. (I would like to keep the "bad" versions for testing.)
In the processing of reinstalling VirtualBox, I found this:2.6.35.6-48.fc14.i686.PAE/source -> /usr/src/kernels/2.6.35.6-48.fc14.i686.PAE/ ,but this folder don't exist.。 I try to relink the ln as source -> /usr/src/kernels/2.6.35.9-64.fc14.i686.PAE , but VirtualBox still get problem with the kernel. Since VirB works fine with other 2 kernels, the solution for this is not quite needed, but I just wonder why this happens. See below. I don't know why these two folder contain different version of kernels. Anybody get an idea?
2.6.35.6-48.fc14.i686.PAE]$ ll /usr/src/kernels/; ll /lib/modules/; ll /lib/modules/2.6.35.6-48.fc14.i686.PAE/ |grep build total 16 drwxr-xr-x. 22 root root 4096 Nov 19 14:58 2.6.35.6-45.fc14.i686 drwxr-xr-x. 22 root root 4096 Nov 15 00:04 2.6.35.6-48.fc14.i686 drwxr-xr-x. 22 root root 4096 Dec 8 17:08 2.6.35.9-64.fc14.i686 drwxr-xr-x. 22 root root 4096 Dec 8 15:19 2.6.35.9-64.fc14.i686.PAE
I checked my kernel version (uname -r) and see I'm on "2.6.34.8-0.2-default", and I noticed that they just released 2.6.39. I'm assuming (perhaps incorrectly) that there's been at least versions 2.6.35/6/7/8 released in there. Why isn't my openSUSE 11.3 using anything more recent than .34? How does this updating work? Is 11.4 on a more recent one?
i initilally installed ubuntu 9.10 then installed windows 7 ,then i recovered grub2 using livecd as told in the post [URL] i did "sudo update-grub" and got windows 7 menu entry but when i select that entry windows 7 does not load but the grub2 is reloaded again. i cant boot to windows 7.
Windows 7 have 100 mb partition "System Reserved" the grub2 points to that partition but still windows 7 not loaded.
sudo fdisk -l Disk /dev/sda: 320.1 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x3c3a81f5
I went through so many post but I haven't found the proper answer yet hope you have an Idea1. Grub2 saves only Linux OS as last selected no Windows OS2.It is possible to boot into a cdrom (drive)?
I am attempting to install 10.10 from a usb stick after a disc installation failed, but it is taking forever. I am stuck on the screen which says 'Ubuntu 10.10' and has four little orange dots flashing as if it is loading. It has been like this for over 20 minutes now. Is this unusual or is it normal? Anyway, I am restarting my PC and trying again.