View previous topic :: View next topic |
Author |
Message |
OldTango l33t


Joined: 21 Feb 2004 Posts: 722
|
Posted: Fri Feb 27, 2004 10:24 pm Post subject: Removing Old Kernel versions |
|
|
I would like to know the best way to remove or unmerge Old Kernels no longer in use, and hopefully source tree and all the files associated with them. If I simply rm the kernel file it won,t remove the other files installed with it. Or maybe I shouldn't do it this way in the first place.
Any advise?????????????????/ |
|
Back to top |
|
 |
dotcomaset n00b

Joined: 03 Feb 2004 Posts: 17
|
Posted: Fri Feb 27, 2004 10:27 pm Post subject: |
|
|
i did emerge unmerge "kernel" |
|
Back to top |
|
 |
tuxwatcher Tux's lil' helper


Joined: 05 Jun 2003 Posts: 121 Location: USA
|
Posted: Fri Feb 27, 2004 10:36 pm Post subject: |
|
|
I loaded gentoolkit and ran Code: | qpkg --dups -v gentoo-sources |
Then ran "emerge unmerge " on the individual sources I didn't want. You still may have to manually remove some directories after it is finished. |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 55207 Location: 56N 3W
|
Posted: Fri Feb 27, 2004 10:42 pm Post subject: |
|
|
OldTango,
Remove the following:-
The kernel source tree in /usr/src
The installed modules in /lib/modules/<kernel_ver>
The kernel bzImage file from /boot
The refernces in /boot/grub/grub.conf
Do make sure that you have not left the /usr/src/linux symbolic link pointing to nothing. You will get many emerge errors otherwise.
Since emerge does not build the kernel for you, it doesn't know about the modules or how you have renamed the bzImage file when you copied it to /boot _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
OldTango l33t


Joined: 21 Feb 2004 Posts: 722
|
Posted: Sat Feb 28, 2004 2:14 am Post subject: |
|
|
Thanks guys all the info was very helpful.
I did manage to emerge unemerge one old kernel source but still had one the emerge process could'nt find.
So I am going to follow Neddy's advice and manually remove the unnecessary kernels and sources.
I do have the gentoolkit and it a great tool.
In time I hope to assist others as well. After only 2 weeks of working with linux, I don't feel qualifyied to try at this point. Except for maybe grub. After at least 50 bad installs I have that down patt...............lol |
|
Back to top |
|
 |
kevmille Guru


Joined: 26 Jul 2003 Posts: 311 Location: Ho Chi Minh City (Saigon), Vietnam
|
Posted: Sat Feb 28, 2004 7:41 am Post subject: |
|
|
I wrote this based on comments from the Gentoo users mailing list:
Code: | To unmerge an old kernel, follow these simple guidelines:
1. If you do not have gentools installed on your computer yet, you will need to emerge it. If you do
not know what this is, you probably have not installed it. To install gentoolkits:
#emerge gentoolkit
2. To find out which package names you have installed for each kernel:
# qpkg -I -v gentoo-sources
Your result may look somthing similar to this:
sys-kernel/gentoo-sources-2.4.20-r5 *
sys-kernel/gentoo-sources-2.4.20-r7 *
Note:
a. The above uses a CAPITAL I as in Indiana not L as in Louisiana.
b. If you are using another kernel source, just replace 'gentoo-sources' with your preferred
source, i.e. vanilla-sources
3. To unmerge the packages:
# emerge -C <package>
Since I want to unmerge the kernel: gentoo-sources-2.4.20-r5, I will input this:
# emerge -C gentoo-sources-2.4.20-r5 *
4. So far, you have removed most of the source files, but not the compiled binary files. To remove
these files, go into /usr/src and rm -rf the directories of kernel you don't need anymore. In this
example, you would look for all files that relate to gentoo-sources-2.4.20-r5.
5. Next, mount /boot and go the /boot directory. Delete all the files related to the kernel version you just
deleted. When you are done, umount /boot.
6. Finally, go into the /lib/modules/ and delete all the files related to the kernel version you just
deleted.
You have now deleted this kernel and all the files and modules attached to it. Time to go compile another kernel:) |
This has worked everytime for me. _________________ My Company: Hakata Consulting |
|
Back to top |
|
 |
charlieg Advocate


Joined: 30 Jul 2002 Posts: 2149 Location: Manchester UK
|
Posted: Sat Feb 28, 2004 9:43 am Post subject: |
|
|
Oi! You're all making this sound so difficult! It's so easy!
Code: | # emerge -Cp \<sys-kernel/love-sources-2.6.3-r5 |
Notes:
- The < must be escaped as \< in order to prevent bash from using it
- Remove the 'p' when you're happy you're about to do the right thing
- You may be left with a little cleanup in /usr/src/linux and /boot, but nothing difficult (eg stuff left over from make menuconfig - ie files created by you and not by portage). It's just a matter of doing a quick rm -rf on the appropriate directories.
_________________ Want Free games?
Free Gamer - open source games list & commentary
Open source web-enabled rich UI platform: Vexi |
|
Back to top |
|
 |
OldTango l33t


Joined: 21 Feb 2004 Posts: 722
|
Posted: Sat Feb 28, 2004 10:56 pm Post subject: |
|
|
Well I guess I have to relink the old kernel before I can remove it because all I get is a pakcage can't be found when I attempt any of these above options.
I removed the link to the old kernel to compile a newer version of the same kernel. So I belive I can simply make a new link to the old kernel, than remove it.
Is it safe to have 2 links to 2 different kernels in /usr/src/linux at the same time. And will removing the old one affect the Kernel currantly in use.
Thanks so much for your help. I am learning a lot fast. |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 55207 Location: 56N 3W
|
Posted: Sun Feb 29, 2004 12:11 am Post subject: |
|
|
OldTango,
The link /usr/src/linux (there can only be one at a time) is used to find the kernel when things must be built against it. If it doesn't exist, some emerges will break. If it points to the wrong kernel, its dificult to forecast the effects _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
OldTango l33t


Joined: 21 Feb 2004 Posts: 722
|
Posted: Sun Feb 29, 2004 2:35 pm Post subject: |
|
|
Thanks Neddy..............I will manually remove the old kernel and any files I know for sure are linked to the old soruce alone. The rest I will leave alone until I gain more knowledge about linux...............not to self...when in doubt don't delete............  |
|
Back to top |
|
 |
sapphirecat Guru

Joined: 15 Jan 2003 Posts: 376
|
Posted: Sun Feb 29, 2004 5:21 pm Post subject: |
|
|
I usually rm -rf the source trees before doing the emerge -C so that Portage doesn't have to compute the MD5s of every file it installed.
kevmille wrote: | Code: | # emerge -C gentoo-sources-2.4.20-r5 * |
|
Is that "*" supposed to be there? It looks like it could either be annoying or dangerous, depending on what the current directory is when running that command. _________________ Former Gentoo user; switched to Kubuntu 7.04 when I got sick of waiting on gcc. Chance of thread necro if you reply now approaching 100%... |
|
Back to top |
|
 |
kevmille Guru


Joined: 26 Jul 2003 Posts: 311 Location: Ho Chi Minh City (Saigon), Vietnam
|
Posted: Thu Mar 11, 2004 3:10 am Post subject: |
|
|
loonxtall wrote: | I usually rm -rf the source trees before doing the emerge -C so that Portage doesn't have to compute the MD5s of every file it installed.
kevmille wrote: | Code: | # emerge -C gentoo-sources-2.4.20-r5 * |
|
Is that "*" supposed to be there? It looks like it could either be annoying or dangerous, depending on what the current directory is when running that command. |
No, the * is NOT supposed to be there and it is dangerous. Then again, if you want Gentoo to delete ALL of your kernels, go right ahead. Don't worry, you will still be able to boot into your computer though. I know this from experience  _________________ My Company: Hakata Consulting |
|
Back to top |
|
 |
|