Can someone tell me how to remove old kernels, I have about 5 old kernels and only use one (the most recent one)..
Thanks Jose
--------------------------------- Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2ยข/min or less.
Pichin wrote:
Can someone tell me how to remove old kernels, I have about 5 old kernels and only use one (the most recent one)..
Thanks Jose
FC5 has a yum plugin installed by default to do this. In previous versions,
# yum install yum-utils # package-cleanup --oldkernels
Rahul
Greetings Rahul,
Rahul wrote:
FC5 has a yum plugin installed by default to do this. In previous versions,
# yum install yum-utils # package-cleanup --oldkernels
[root@Magellan boot]# package-cleanup --oldkernels Setting up yum Excluding Packages in global exclude list Finished Traceback (most recent call last): File "/usr/bin/package-cleanup", line 302, in ? main() File "/usr/bin/package-cleanup", line 283, in main removeKernels(my, opts.kernelcount, opts.confirmed, opts.keepdevel) File "/usr/bin/package-cleanup", line 193, in removeKernels (kver,krel) = runningkernel.split('-') ValueError: need more than 1 value to unpack
What can you make out of this ?
Kind Regards, Kostas
Kostas Sfakiotakis wrote:
Greetings Rahul,
Rahul wrote:
FC5 has a yum plugin installed by default to do this. In previous versions,
# yum install yum-utils # package-cleanup --oldkernels
[root@Magellan boot]# package-cleanup --oldkernels Setting up yum Excluding Packages in global exclude list Finished Traceback (most recent call last): File "/usr/bin/package-cleanup", line 302, in ? main() File "/usr/bin/package-cleanup", line 283, in main removeKernels(my, opts.kernelcount, opts.confirmed, opts.keepdevel) File "/usr/bin/package-cleanup", line 193, in removeKernels (kver,krel) = runningkernel.split('-') ValueError: need more than 1 value to unpack
What can you make out of this ?
Kind Regards, Kostas
rpm -e kernel-version
you can get a list of kernels and their versions installed with "rpm -q kernel"
instaed of doing "rpm -e kernel" ... you must append the version to the kernel name ...
dont just go deleting files...use rpm
Greetings Brian ,
Brian Chadwick wrote:
rpm -e kernel-version
you can get a list of kernels and their versions installed with "rpm -q kernel"
instaed of doing "rpm -e kernel" ... you must append the version to the kernel name ...
dont just go deleting files...use rpm
I would gladly use rpm Brian , but answer for me please this question .
If i had manually installed the kernel ( you know the manual way with make menuconfig ....) how am i going to use rpm ? What is the correct parameter to give to rpm -e ?
Kostas
Kostas Sfakiotakis wrote:
Greetings Brian ,
Brian Chadwick wrote:
rpm -e kernel-version
you can get a list of kernels and their versions installed with "rpm -q kernel"
instaed of doing "rpm -e kernel" ... you must append the version to the kernel name ...
dont just go deleting files...use rpm
I would gladly use rpm Brian , but answer for me please this question .
If i had manually installed the kernel ( you know the manual way with make menuconfig ....) how am i going to use rpm ? What is the correct parameter to give to rpm -e ?
Kostas
Is it possible to run make rpm and get a compiled version of the kernel? I have not compiled a kernel in awhile. I seem to recall doing this on the vanilla kernel source. After you compile the rpm, you could remove it with the usual rpm -e <kernel-custom> command.
You could try make rpm.
Jim
Greetings Jim,
Jim Cornette wrote:
Kostas Sfakiotakis wrote:
Greetings Brian ,
< snip >
Is it possible to run make rpm and get a compiled version of the kernel?
I will fail you on that . All i can suggest is this . Get the kernel-source-version.rpm . This is essentially the "rpm version of the tarball" . Then run rpmbuild --rebuild and make the kernel rpm .
I have not compiled a kernel in awhile. I seem to recall doing this on the vanilla kernel source. After you compile the rpm, you could remove it with the usual rpm -e <kernel-custom> command.
You could try make rpm.
No rule to make target rpm . Do you by any chance mean , rpmbuild ? rpmbuild will fail because the top level directory doesn't have the spec file needed to do the job .
Anyway what do i have to loose if i just go ahead without using an rpm and compile the kernel the old fashioned way . I don't understand the problem to the stability of the system if the rpmdatabase isn't aware of the kernel being running.
Kostas
Kostas Sfakiotakis wrote:
Greetings Jim,
Jim Cornette wrote:
Kostas Sfakiotakis wrote:
Greetings Brian ,
< snip >
Is it possible to run make rpm and get a compiled version of the kernel?
I will fail you on that . All i can suggest is this . Get the kernel-source-version.rpm . This is essentially the "rpm version of the tarball" . Then run rpmbuild --rebuild and make the kernel rpm .
I think I ran the make xconfig, pick the desired kernel options and save the file. I then ran make on the other steps with making the image and modules, installed the modules and then ran make rpm (or RPM, I cannot recall exactly.) It might have been from a redhat source rpm but I thought I was doing this with the vanilla source. Too bad it was not from the vanilla source file.
I have not compiled a kernel in awhile. I seem to recall doing this on the vanilla kernel source. After you compile the rpm, you could remove it with the usual rpm -e <kernel-custom> command.
You could try make rpm.
No rule to make target rpm . Do you by any chance mean , rpmbuild ? rpmbuild will fail because the top level directory doesn't have the spec file needed to do the job .
No, this was just compiling the kernel from source. I downloaded the vanilla source to see if I can still remember how to compile the kernel, plus my curiosity regarding the make rpm. Is there by chance an rpm directory in the tree where you need to be in as the CWD before the script works? Anyway, I'll examine the source file to see if I can recall to where the make rpm was from.
Anyway what do i have to loose if i just go ahead without using an rpm and compile the kernel the old fashioned way . I don't understand the problem to the stability of the system if the rpmdatabase isn't aware of the kernel being running.
The rpm database should not realize any non-rpm packaged files on your system. I don't think rpm checks for the running kernel before removing an rpm. It just checks for installed rpms and checks dependencies of rpm installed packages.
sorry for the false lead.
Jim
Kostas
On Fri, 2006-08-25 at 01:25 +0300, Kostas Sfakiotakis wrote:
Greetings Jim,
Jim Cornette wrote:
Kostas Sfakiotakis wrote:
Greetings Brian ,
< snip >
Is it possible to run make rpm and get a compiled version of the kernel?
I will fail you on that . All i can suggest is this . Get the kernel-source-version.rpm . This is essentially the "rpm version of the tarball" . Then run rpmbuild --rebuild and make the kernel rpm .
There hasn't been a kernel-source RPM in Fedora for quite a while now; the kernel has a regular SRPM just like every other package.
It's possible to tweak this SRPM if you want to build a custom kernel RPM: http://www.city-fan.org/tips/TweakKernelPackage
I have not compiled a kernel in awhile. I seem to recall doing this on the vanilla kernel source. After you compile the rpm, you could remove it with the usual rpm -e <kernel-custom> command.
You could try make rpm.
No rule to make target rpm . Do you by any chance mean , rpmbuild ? rpmbuild will fail because the top level directory doesn't have the spec file needed to do the job .
Anyway what do i have to loose if i just go ahead without using an rpm and compile the kernel the old fashioned way . I don't understand the problem to the stability of the system if the rpmdatabase isn't aware of the kernel being running.
If you manually remove files that are "owned" by an RPM then your system will be in an inconsistent state; if you use RPM (or yum) to install something then you should use RPM (or yum) to remove it.
If you have built and installed your kernel manually then you should remove it manually (but don't forget that most of the kernel lives under /lib/modules rather than in /boot).
If you are running a custom kernel that RPM does not know about then you may have some dependency issues with userland tools such as systemtap that have dependencies or conflicts with specific kernel versions.
Paul.
Paul Howarth wrote:
On Fri, 2006-08-25 at 01:25 +0300, Kostas Sfakiotakis wrote:
Greetings Jim,
Jim Cornette wrote:
Kostas Sfakiotakis wrote:
Greetings Brian ,
< snip >
Also, checking out the vanilla source, there are a few items in the linux-2.6.9/scripts/package directory that deal with building rpms and it is supposed to be distribution neutral. This is not the same make rpm that I used before from whatever source files I used to use. It does seem that making an rpm for the kernel would be worthwhile. As Paul mentioned, you have a lot more than what resides in /boot for the kernel. You have the modules for each kernel that will linger in a simple rm type of kernel removal.
Jim
Greetings Jim,
Jim Cornette wrote:
As Paul mentioned, you have a lot more than what resides in /boot for the kernel. You have the modules for each kernel that will linger in a simple rm type of kernel removal.
What are the chances of you overlooking the last paragraph of my email Quoting from my email on 24/08/2006 01:33 ( time is most likely GMT+2 )
Did i or didn't i wrote :
After you clean the above set of 3 files from the boot directory ( initrd,System.map,vmlinuz) you have to go to the /lib/modules/ directory. There is the location that the kernel modules are stored . Delete all the directories that correspond to the kernels that you don't want to keep .
So i have already mentioned the /lib/modules/ directory but certainly missed the /boot/grub/grub.conf stanza .
Kostas
Greetings Paul,
Paul Howarth wrote:
There hasn't been a kernel-source RPM in Fedora for quite a while now; the kernel has a regular SRPM just like every other package.
To be honest i was missing that part .
I have not compiled a kernel in awhile. I seem to recall doing this on the vanilla kernel source. After you compile the rpm, you could remove it with the usual rpm -e <kernel-custom> command.
You could try make rpm.
No rule to make target rpm . Do you by any chance mean , rpmbuild ? rpmbuild will fail because the top level directory doesn't have the spec file needed to do the job .
Anyway what do i have to loose if i just go ahead without using an rpm and compile the kernel the old fashioned way . I don't understand the problem to the stability of the system if the rpmdatabase isn't aware of the kernel being running.
If you manually remove files that are "owned" by an RPM then your system will be in an inconsistent state; if you use RPM (or yum) to install something then you should use RPM (or yum) to remove it.
I guess you mean that even if updatedb finds that an "owned file" isn't there any more the broken dependency will remain , so the problem will remain , untill you uncover it and patch the broken dependency , if things don't break apart in between .
If you have built and installed your kernel manually then you should remove it manually (but don't forget that most of the kernel lives under /lib/modules rather than in /boot).
Couldn't have said things better .
If you are running a custom kernel that RPM does not know about then you may have some dependency issues with userland tools such as systemtap that have dependencies or conflicts with specific kernel versions.
Well this part i was missing . I have been running custom kernels ( manually built ) for the last couple of years and never came across such a problem ( or if i did , i didn't understood it ) . Still your note remains entirely valid .
Paul.
Greeting Jose,
Pichin wrote:
Can someone tell me how to remove old kernels, I have about 5 old kernels and only use one (the most recent one)..
There are two places that you have to visit .
1. the /boot directory
In here you will find a set of three files for each kernel version that you have installed for example
initrd-2.6.17.8.img System.map-2.6.17.8 vmlinuz-2.6.17.8
If you wish to remove the 2.6.17.8 kernel then you will have to remove the above three files .
Beware of one thing here
There is a symbolic link for System.map You will have to make sure that it doesn't point in our example to System.map-2.6.17.8 Also there is a symbolic link for vmlinuz , so again you will have to pay attention that it doesn't point to the file you want to delete .
After you clean the above set of 3 files from the boot directory ( initrd,System.map,vmlinuz) you have to go to the /lib/modules/ directory There is the location that the kernel modules are stored . Delete all the directories that corespond to the kernels that you don't want to keep .
HTH,
Kostas
Kostas Sfakiotakis wrote:
Greeting Jose,
Pichin wrote:
Can someone tell me how to remove old kernels, I have about 5 old kernels and only use one (the most recent one)..
There are two places that you have to visit .
- the /boot directory
In here you will find a set of three files for each kernel version that you have installed for example
initrd-2.6.17.8.img System.map-2.6.17.8 vmlinuz-2.6.17.8
If you wish to remove the 2.6.17.8 kernel then you will have to remove the above three files .
Beware of one thing here
There is a symbolic link for System.map You will have to make sure that it doesn't point in our example to System.map-2.6.17.8 Also there is a symbolic link for vmlinuz , so again you will have to pay attention that it doesn't point to the file you want to delete .
After you clean the above set of 3 files from the boot directory ( initrd,System.map,vmlinuz) you have to go to the /lib/modules/ directory There is the location that the kernel modules are stored . Delete all the directories that corespond to the kernels that you don't want to keep .
HTH,
Kostas
While this would work, it is not a good way to do it on a system with package management. You are much better off using rpm or yum to remove the kernel packages. This keeps your RPM database accurate. As others have covered how to use yum and rpm to do this, as well as how to remove any kernel development packages that way be installed, I will not go into that. One other way you can do it is to use the yum extender GUI, remove section, searching for kernel, and pick the packages you want to remove.
Mikkel
Greetings Mikkel,
Mikkel L. Ellertson wrote:
While this would work, it is not a good way to do it on a system with package management. You are much better off using rpm or yum to remove the kernel packages.
Is it my impression or rpm will work only if the kernel was installed using an rpm ?
This keeps your RPM database accurate. As others have covered how to use yum and rpm to do this, as well as how to remove any kernel development packages that way be installed, I will not go into that. One other way you can do it is to use the yum extender GUI, remove section, searching for kernel, and pick the packages you want to remove.
Well i can't use the Yum extender GUI because i am unaware of it .
Mikkel
Kostas
On Wed, 2006-08-23 at 19:54 -0500, Mikkel L. Ellertson wrote:
Kostas Sfakiotakis wrote:
Greeting Jose,
Pichin wrote:
Can someone tell me how to remove old kernels, I have about 5 old kernels and only use one (the most recent one)..
There are two places that you have to visit .
- the /boot directory
In here you will find a set of three files for each kernel version that you have installed for example
initrd-2.6.17.8.img System.map-2.6.17.8 vmlinuz-2.6.17.8
If you wish to remove the 2.6.17.8 kernel then you will have to remove the above three files .
Beware of one thing here
There is a symbolic link for System.map You will have to make sure that it doesn't point in our example to System.map-2.6.17.8 Also there is a symbolic link for vmlinuz , so again you will have to pay attention that it doesn't point to the file you want to delete .
After you clean the above set of 3 files from the boot directory ( initrd,System.map,vmlinuz) you have to go to the /lib/modules/ directory There is the location that the kernel modules are stored . Delete all the directories that corespond to the kernels that you don't want to keep .
HTH,
Kostas
While this would work, it is not a good way to do it on a system with package management. You are much better off using rpm or yum to remove the kernel packages. This keeps your RPM database accurate. As others have covered how to use yum and rpm to do this, as well as how to remove any kernel development packages that way be installed, I will not go into that. One other way you can do it is to use the yum extender GUI, remove section, searching for kernel, and pick the packages you want to remove.
Using the package manager also removes the entire package.
There is a lot more to a kernel than the 3 files in /boot, including /lib/modules/<kernel version>, the entry in /boot/grub/grub.conf, the entry in the rpm database, etc.
Mikkel
Do not meddle in the affairs of dragons, for thou art crunchy and taste good with Ketchup!
The original poster asked how to remove old kernels. That is a good indication of the OP's level of knowledge. It is very reasonable to conclude that the OP did not compile his own kernel so although no doubt an interesting debate and educational, it is most likely not applicable to the OP's situation and beyond the OP's knowledge/skill level (so rpm -e would be the logical suggestion to his question).
I agree with the earlier suggestion of running the following as root:
First determine what kernel version you are running (should be the latest one installed - if not I suggest you re-boot to the latest kernel as you will not be able to remove an older one which is active). Do this as follows: # uname -a
Next determine which kernels are installed. Do this as follows (-q for query, -a for all, then pipe that to grep for the results with the word kernel in it). # rpm -qa | grep kernel
Finally remove the older kernels by doing the following for each kernel you wish to remove (good advice to keep at least current and previous version): # rmp -e older-kernel-exactly-as-spelled-in-previous-query
This will also take care of modifying your grub.conf file.
Jacques B.
I asked the same question a while ago and this was how did it.
"On Tue, Jun 06, 2006 at 12:15:15PM -0700, Bazooka Joe wrote:
I didn't make /boot big enough and I was wondering what I can delete if anything.
this is a multi processor box so I know it needs the smp files
Yes. You can delete all your old kernels...
Do:
1) "uname -r" to tell you what kernel you are running.
2) "rpm -qa | grep kernel"
3) "rpm -e" all the kernel-XXX and kernel-devel-XXX kernels you want to delete. I recommend keeping your last two kernels.
4) In addition, you might want to do the following:
rpm -e `rpm -qa | grep kernel | grep -v smp`
That will remove all kernel and kernel-devel stuff that is not smp.
---Kayvan "
On 8/23/06, Pichin pichins.fedora@yahoo.com wrote:
Can someone tell me how to remove old kernels, I have about 5 old kernels and only use one (the most recent one)..
Thanks Jose
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2ยข/min or less.
-- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
On Wed, 2006-08-23 at 15:46 -0700, Bazooka Joe wrote:
Yes. You can delete all your old kernels...
However, I would keep at least two installed, just in case a nasty bug is discovered in the current kernel, or you have a fault. It gives you something else to try. I tend to keep three, it gives me leeway for experimenting if trying to resolve a problem.