Gentoo tips & tricks

This is a collection of tips & tricks for the peculiarities of Gentoo.

Use flags
USE flags are the way Gentoo organizes the compile time options. This is a feature that sets Gentoo apart from other distributions. While USE flags are set during the install, you can go back and change them at anytime. If you do, make sure that you use Portage to recompile any programs that might take advantage of any USE flag changes. Also, when using Portage to install new programs, you can request it to compile that program with a USE flag specifically for it, or make an entry in /etc/portage/package.use for that package and/or version. You have a list of them in your /etc/make.conf for your overall system. See the external links below for more information.

Tools
ufed = USE flag editor, emerge ufed, then run ufed as root

A problem with ufed, is that it organizes your useflags alphabetically, So if you added an experimental one by hand in your make.conf, it will be hidden amongst your countless others.

Files
/etc/make.conf has a USE flag section in it for general package building on a system. /usr/portage/profiles/use.desc and /usr/portage/profiles/use.local.desc contain lists of all valid USE flags with brief descriptions of what each flag does. You can use the 'euse' command to look up USE flags. For example, 'euse -i pdf'.

Rebuilding what needs to be rebuilt
If you've added a new USE flag to your make.conf then just run emerge --update --newuse world

Masked packages
A lot of times you'll want to emerge a masked package (or a masked version of one). To do this, you should add an entry to /etc/portage/package.keywords. For example:

$ echo "package-category/package-name ~ " >> /etc/portage/package.keywords

Mixing unstable with stable packages can lead to problems, so it's recommended you pick one type and use it all the time. This is more important for libraries rather then programs.

Note: You should never use ACCEPT_KEYWORDS on the command line to make changes to your system.

Emerge tips

 * emerge --sync – syncs portage with the lateset tree
 * emerge -uDNav world – list things to be updated
 * emerge -uDN world – get almost everything updated
 * revdep-rebuild – check for packages that break by rebuilding a dependency

Gentoo & KDE
Remember - when installing KDE on Gentoo, you don't have to install every kde package. Instead, you can simply choose to install a "small" subset of them - for example:


 * 1) emerge kdebase kdeartwork

Prior to this, if you want to check out what packages would be installed, use the --pretend option - for example:


 * 1) emerge --pretend kdebase kdeartwork | less

(As a useful alternative to --pretend, you could use the --ask option - see man emerge for more information).

N.B - As of KDE 3.4 onwards, you will be able to utilize split ebuilds - this approach enables you to install individual KDE applications, without a plethora of other KDE apps automatically being installed (as in the monolithic approach).