Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Clean up system with emerge --root
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
artworcs
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2005
Posts: 126

PostPosted: Wed Dec 21, 2011 11:51 am    Post subject: Clean up system with emerge --root Reply with quote

I have a very old ~x86 install(2004) that's seen a few drive switches, 1 computer switch and a reiser4 crash(lost half of /, had fun fixing it ;-) )

I just got an SSD drive and instead of the usual copy i was thinking of emerging the system from scratch into a different directory.

Basically what I want to do is something like:
Code:

emerge -e --root=/mnt/new_root world


followed by manual copy of the config files in /etc.

Does anyone have any experience with something like this? Any tips to watch out for?
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 5329

PostPosted: Wed Dec 21, 2011 1:42 pm    Post subject: Reply with quote

Never tried this, but I've always had trouble even just updating a Gentoo box that hasn't been synced for more than a couple of months. I'd just start from scratch a la The Handbook for that fresh new Gentoo smell.
_________________
Gentoo Studio: http://gentoostudio.org
Facebook: http://www.facebook.com/gentoostudio
G+: https://plus.google.com/113947758237122861689/posts
Linux 'Tude Tees: http://moodytudetees.com/index.php/linux-tude-tees
Back to top
View user's profile Send private message
artworcs
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2005
Posts: 126

PostPosted: Wed Dec 21, 2011 1:48 pm    Post subject: Reply with quote

I think I didn't make myself clear, I've been updating constantly. I've never been more then a few weeks out of sync.

There is no way I'm reinstalling. I'll sooner migrate to another distro then start from scratch.


For the moment, things are going well: Jobs: 253 of 531 complete.
Back to top
View user's profile Send private message
Veldrin
Veteran
Veteran


Joined: 27 Jul 2004
Posts: 1942
Location: Zurich, Switzerland

PostPosted: Wed Dec 21, 2011 2:10 pm    Post subject: Reply with quote

I was just wondering what the up- or downside of your method opposed to a standard stage3 install with a copied over world file is.
IMO, if you are running stable, the stage3 install would have been faster, while on a unstable (~x86) the time would be the same.

V.
_________________
read the portage output!
If my answer is too concise, ask for an explanation.
Back to top
View user's profile Send private message
artworcs
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2005
Posts: 126

PostPosted: Wed Dec 21, 2011 2:31 pm    Post subject: Reply with quote

I like to experiment and this is something I still haven't done. But really I feel that my system is full of cruft with some many years of updating and I want to get rid of that. After portage is done I plan on reusing /etc and most of /var.

The only reason I made this post is in case I missed something and there's more to a system then just the packages. I really hope someone doesn't come and say something like: you first need to download xyz and extract it in / or the asdf metadata will be corrupt and you can't regenerate it.
Back to top
View user's profile Send private message
Veldrin
Veteran
Veteran


Joined: 27 Jul 2004
Posts: 1942
Location: Zurich, Switzerland

PostPosted: Wed Dec 21, 2011 2:42 pm    Post subject: Reply with quote

Well, I am not an expert on the subject, but I was recently messing with gentoo/fbsd on amd64, which also uses the --root approach. the first thing, that they installed, was baselayout, then the entire rest. also at a later stage when building the catalyst stage, it was always baselayout first (IIRC then portage) and the rest (i.e system).
but there were some additional quirks with build useflags.

Please post you results. I always like the know other ways on how to do things...


V.
_________________
read the portage output!
If my answer is too concise, ask for an explanation.
Back to top
View user's profile Send private message
artworcs
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2005
Posts: 126

PostPosted: Wed Dec 21, 2011 9:33 pm    Post subject: Reply with quote

Small update. For some reason, it seems that
Code:
 emerge -e --root world
is not taking the hosts packages and install them into root, it only takes a random selection... I knew there was something wrong with just 500 or so packages.

But, I have copied /etc/portage and my world file to the new partition and we're up to 1.5k packages. Yeah!
Back to top
View user's profile Send private message
yoshi314
l33t
l33t


Joined: 30 Dec 2004
Posts: 832
Location: PL

PostPosted: Fri Dec 30, 2011 1:26 pm    Post subject: Reply with quote

artworcs wrote:
Small update. For some reason, it seems that
Code:
 emerge -e --root world
is not taking the hosts packages and install them into root, it only takes a random selection... I knew there was something wrong with just 500 or so packages.

But, I have copied /etc/portage and my world file to the new partition and we're up to 1.5k packages. Yeah!


emerge --root basically installs only runtime deps into target directory. or at least it used to, last time i did this.

packages build against the host system, but only necessary runtime dependencies end up installed into --root dir.

this feature is useful for making small installations with gentoo, and was mentioned a couple of times in some guides.
_________________
~amd64
shrink your /usr/portage with squashfs+aufs
Back to top
View user's profile Send private message
artworcs
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2005
Posts: 126

PostPosted: Fri Dec 30, 2011 1:51 pm    Post subject: Reply with quote

UPDATE:

I finally managed to find some free time to continue with my little project. I managed to get a bootable system after I solved some missing device node problems. I did all my testing in qemu with the text interface, so I can't test X, but everything else seems to be working.

The steps required are:
- emerge --root -e world
- copy over the portage configuration files(make.conf, package.*, world)
- chroot && emerge -uD world (at this point you should have all the packages)
- it is important to use build as use flag for baselayout at some point(probably at the beginning, I only did it half way)
- make sure you have CONFIG_DEVTMPFS in your kernel or use mknod for /dev/console

For all the other config files in /etc I did a big diff and only copied what I wanted.


My big surprise came when I examined the difference in /etc. I was expecting to have accumulated a significant amount of garbage, but that is not so. I had very few files that were unaccounted for, portage really does do an excellent job of cleaning up. Since then I also compared /usr and there is again almost no difference.

Taking into account that this box was continuously updated from 2004, i am very surprised to find it as clean as a new install.
NOTE: Clearly I am not talking about /var here.

TL;DR: it works, but totally unnecessary.
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 368
Location: NRW, Germany

PostPosted: Fri Dec 30, 2011 5:33 pm    Post subject: Reply with quote

artworcs wrote:
TL;DR: it works, but totally unnecessary.

Portage tracks all files that were installed by an ebuild. Just list all files installed by portage and compare them to the actual disk contents.
Back to top
View user's profile Send private message
dol-sen
Developer
Developer


Joined: 30 Jun 2002
Posts: 2687
Location: Richmond, BC, Canada

PostPosted: Sat Dec 31, 2011 3:15 am    Post subject: Reply with quote

I just recently created a new emaint module to clean out stale/old entries in var/lib/portage/config. config is used by portage so as to not keep multiple copies of configs to update, etc.. It will clean out entries of files that no longer exist on your system as well as entries that do not match the md5sums of the files they point to.

It is not yet merged into portage. It is part of a more modular rewrite I did to the emaint code. If you want to test it. It can run from the git checkout without needing to be installed. You can get it here.
Code:
emaint -c cleanconfig
emaint -f cleanconfig
The more testing it gets, the better :) You can back up the file before running to be sure. On my system which is only a couple years old. It cleaned out about 60 entries in total. On anther person's install that has been going for many years like yours, it cleaned out around 150 entries (before I added the mismatch cleaning).
_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software 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