Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How Can I remove all packages except kernel and grub
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
lilgamesh
n00b
n00b


Joined: 13 Mar 2013
Posts: 9

PostPosted: Mon Mar 18, 2013 1:51 pm    Post subject: How Can I remove all packages except kernel and grub Reply with quote

Hi,
I have made some mistakes as I did not have proper understanding of gentoo system.

Now I want to clean all of them and start from the beginning. But I am happy with the kernel I built.
So is it possible to remove everything other than kernel and grub. So that I can boot into system and get very thing what I would need.
Back to top
View user's profile Send private message
LoTeK
Apprentice
Apprentice


Joined: 26 Jul 2012
Posts: 270

PostPosted: Mon Mar 18, 2013 2:07 pm    Post subject: Reply with quote

I'm in a similar situation.

If you installed gentoo on a "normal" x86, x86_64 architecture you could save your .config file and your grub configuration on a external HD and then do a fresh install. When you reach the kernel configuration you can boot the external HD and take your old one. (same for grub). This would be a lot easier for you, because if you start deleting packages then it can get very messy.

(don't laught: :) I removed all perl/python packages and then my system was dead).

So a minimal system consists of way more packages or programs than just the kernel and a bootloader.

If you have installed an X-server with a WM, than you can delete every X-related file (and/or KDE, gnome etc file), but the lower level packages are not safe to delete! (at least if you don't have a deep knowledge of the relations between them).
_________________
"I want to see gamma rays! I want to hear X-rays! Do you see the absurdity of what I am? I can't even express these things properly because I have to conceptualize complex ideas in this stupid limiting spoken language!"
Back to top
View user's profile Send private message
slackline
Veteran
Veteran


Joined: 01 Apr 2005
Posts: 1313
Location: /uk/sheffield

PostPosted: Mon Mar 18, 2013 2:32 pm    Post subject: Reply with quote

I'd do as LoTeK suggests, back up your /usr/src/linux/.config file and your grub config file (location will possibly depend on whether you installed grub or grub2) to an external storage medium and do a fresh install, then copy over them when you need to.
_________________
"Science is what we understand well enough to explain to a computer.  Art is everything else we do." - Donald Knuth
Back to top
View user's profile Send private message
lilgamesh
n00b
n00b


Joined: 13 Mar 2013
Posts: 9

PostPosted: Mon Mar 18, 2013 2:34 pm    Post subject: Reply with quote

LoTeK wrote:
I'm in a similar situation.

If you installed gentoo on a "normal" x86, x86_64 architecture you could save your .config file and your grub configuration on a external HD and then do a fresh install. When you reach the kernel configuration you can boot the external HD and take your old one. (same for grub). This would be a lot easier for you, because if you start deleting packages then it can get very messy.

(don't laught: :) I removed all perl/python packages and then my system was dead).

So a minimal system consists of way more packages or programs than just the kernel and a bootloader.

If you have installed an X-server with a WM, than you can delete every X-related file (and/or KDE, gnome etc file), but the lower level packages are not safe to delete! (at least if you don't have a deep knowledge of the relations between them).


I agree. I am already planning to do that.
I already have backed up my kernel configuration and I know how to use that.

But I wanted to know if there any other way.
Back to top
View user's profile Send private message
khayyam
Veteran
Veteran


Joined: 07 Jun 2012
Posts: 1544

PostPosted: Mon Mar 18, 2013 3:35 pm    Post subject: Reply with quote

lilgamesh ...

I've not ever tried this, so it comes with a warning. Note that you will require that the world file only has packages you've installed, and not those you may have re-inistalled without using --oneshot. If your world file can be trusted to *only* have packages that should be part of world then the following *should* work ...

Code:
# emerge -a --unmerge $(awk '{print $0}' /var/lib/portage/world)
# emerge -a --depclean

This should remove all the packages in world and their dependencies (and note again, if at any point you've run 'emerge package', when you really should have used --oneshot, then that package will also be in the world file, and so be unmerged! ... you might want to check/edit the world file before hand).

After this it might be a good idea to run 'revdep-rebuild -pv' and 'emerge -pvuDN @world' to check for consistancy.

I don't really recommend the above as the use of --unmerge is somewhat risky, but as you plan a clean install that risk is somewhat mitigated.

best ... khay
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 7403
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Mar 18, 2013 4:26 pm    Post subject: Reply with quote

khayyam,

A few pedantic comments (and you and I have never been known to be pedantic, have we?):
  • Code:
    $(awk '{ print $0 }' /var/lib/portage/world)
    is equivalent to the simpler, faster
    Code:
    $(cat /var/lib/portage/world)
    which is equivalent to the even simpler & faster
    Code:
    $(</var/lib/portage/world)
  • If --unmerge scares you in these circumstances, use --deselect, which merely removes the entries from the world set.
  • And, if that's all you're doing, a trick (that admittedly depends on implementation specifics, although specifics that have been stable for a long time) that accomplishes the same thing much faster is
    Code:
    rm /var/lib/portage/world
    touch /var/lib/portage/world
- John
_________________
This space intentionally left blank.
Back to top
View user's profile Send private message
khayyam
Veteran
Veteran


Joined: 07 Jun 2012
Posts: 1544

PostPosted: Mon Mar 18, 2013 5:09 pm    Post subject: Reply with quote

John R. Graham wrote:
Code:
rm /var/lib/portage/world
touch /var/lib/portage/world

John ... doh! Yes, *much* simpler. I won't bore you with how I got from ...

Code:
# emerge -pv $(awk '{print "="$1}' <(qlist -ICv 9999))

... to "doh!" in 30 seconds :)

.... and as we're being pedantic:

Code:
cat > /var/lib/portage/world

best ... khay
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 7403
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Mar 18, 2013 5:40 pm    Post subject: Reply with quote

Yep. TIMTOWTDI. ;)

- John
_________________
This space intentionally left blank.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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