Warning! You have JavaScript turned off. For full viewing experience, switch it back on.

In the beginning the Universe was created. This has made a lot of people very angry and is widely regarded as a bad move.

— Douglas Adams

Color sit amet

by Michał 'czesiek' Czyżewski - computer geek, free software enthusiast & tea lover

Mar 10, 2010

back to blog

Keeping your Gentoo nice and clean

Linux Gentoo is my primary operating system. Yes, I've tried Ubuntu/Arch, I've been down that road. The thing with Gentoo is that it works perfectly - it does exactly what I want it to do. And that means also that when I fail, my Gentoo suffers. It's like your dog.

Having been friends with my Gentoo for quite some time (ca. 5 years now, with 2 year break for Ubuntu), I've learned how to take care of my beloved OS.

First of all, the universal upgrade strategy (dah):

emerge --sync
emerge -uDN world

When upgrading libraries, some of the packages that link to them can get broken. From time to time, it's good to fix them:

revdep-rebuild

When it gets cold in the winter, you may want to rebuild all your packages:

emerge -e world

GNU libtool files (*.la) can sometimes get confusing. To fix them you should install lafilefixer:

emerge dev-util/lafilefixer
lafilefixer --justfixit

Removing orphans

Removing old and unneeded packages (often pulled by some removed package and called orphaned packages) is also necessary to keep things from getting messy. Do:

emerge -pv --depclean

to get the list of packages to be removed (check carefully for the packages you don't want to remove - this is important!).

To add the package to the world file (keep it installed):

emerge -n packagename

Then do:

emerge --depclean

to remove orphans.

Removing unneeded sources

To remove unneeded tarballs with package sources run:

eclean-dist -d

It is an alias for eclean -d distfiles and will clean /usr/portage/distfiles (it compares against the list of packages installed).

Thanks to chuso for mentioning depclean.

gravatar

Arne Babenhauserheide

Did you test using the commands in cron scripts?

I use weekly update scripts which also always run revdep-rebuild after the saturday night update :)

That lafixer is important wasn't clear to me, so thanks for mentioning it!

What I'd add: I do a daily update with pkgcore:

pmerge @glsa

That pulls in all Gentoo Linux Security Advisories - most of the time important updates with short compile time. (You need pkgcore for that: "emerge pkgcore")

PS: Typo: "emergre"

PPS: My script in /etc/cron.daily/update_glsa_programs.cron

#! /bin/sh

### Update the portage tree and the glsa packages via pkgcore

# spew a status message
echo $(date) "start to update GLSA" >> /tmp/cron-update.log

# Sync only portage
pmaint sync /usr/portage

# security relevant programs
pmerge -uDN @glsa > /tmp/cron-update-pkgcore-last.log || cat /tmp/cron-update-pkgcore-last.log >> /tmp/cron-update.log

# And keep everything working
revdep-rebuild

# Finally update all configs which can be updated automatically
cfg-update -au

echo $(date) "finished updating GLSA" >> /tmp/cron-update.log

gravatar

Arne Babenhauserheide

Since the whole text layout died, I reposted my comment on my own website: http://draketo.de/light/english/automatic-updates-gentoo-gnulinux

gravatar

czesiek

Yep, the site is a prototype, comments are certainly not well implemented. I've fixed it already. Thanks for suggestions. No, I haven't put neither revdep nor emerge in cron. 'cfg-update -au' is ingenious!

gravatar

Chuso

You forgot emerge --depclean, don't you?

gravatar

czesiek

Thanks for mentioning it. Depclean is of course crucial to Gentoo's health (when done right :) ).

Add comment