Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Removing Old Kernel versions
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
OldTango
l33t
l33t


Joined: 21 Feb 2004
Posts: 722

PostPosted: Fri Feb 27, 2004 10:24 pm    Post subject: Removing Old Kernel versions Reply with quote

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
View user's profile Send private message
dotcomaset
n00b
n00b


Joined: 03 Feb 2004
Posts: 17

PostPosted: Fri Feb 27, 2004 10:27 pm    Post subject: Reply with quote

i did emerge unmerge "kernel"
Back to top
View user's profile Send private message
tuxwatcher
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jun 2003
Posts: 121
Location: USA

PostPosted: Fri Feb 27, 2004 10:36 pm    Post subject: Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 55207
Location: 56N 3W

PostPosted: Fri Feb 27, 2004 10:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
OldTango
l33t
l33t


Joined: 21 Feb 2004
Posts: 722

PostPosted: Sat Feb 28, 2004 2:14 am    Post subject: Reply with quote

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
View user's profile Send private message
kevmille
Guru
Guru


Joined: 26 Jul 2003
Posts: 311
Location: Ho Chi Minh City (Saigon), Vietnam

PostPosted: Sat Feb 28, 2004 7:41 am    Post subject: Reply with quote

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
View user's profile Send private message
charlieg
Advocate
Advocate


Joined: 30 Jul 2002
Posts: 2149
Location: Manchester UK

PostPosted: Sat Feb 28, 2004 9:43 am    Post subject: Reply with quote

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
View user's profile Send private message
OldTango
l33t
l33t


Joined: 21 Feb 2004
Posts: 722

PostPosted: Sat Feb 28, 2004 10:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 55207
Location: 56N 3W

PostPosted: Sun Feb 29, 2004 12:11 am    Post subject: Reply with quote

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
View user's profile Send private message
OldTango
l33t
l33t


Joined: 21 Feb 2004
Posts: 722

PostPosted: Sun Feb 29, 2004 2:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
sapphirecat
Guru
Guru


Joined: 15 Jan 2003
Posts: 376

PostPosted: Sun Feb 29, 2004 5:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
kevmille
Guru
Guru


Joined: 26 Jul 2003
Posts: 311
Location: Ho Chi Minh City (Saigon), Vietnam

PostPosted: Thu Mar 11, 2004 3:10 am    Post subject: Reply with quote

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 :D
_________________
My Company: Hakata Consulting
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum