Sundry helpful trivia

  • To be able to su(1), you must be in group wheel: usermod -G wheel user
  • To be able to use the SoundCard, you must be in group audio: usermod -G audio user
  • There is a thread in the Gentoo about Non-standard Portage Utilities

Package querying basics

Searching available package names

emerge search part of packagename

Listing files in a package

(old way)

qpkg -l packagename

(newer way)

equery f packagename

Changing USE flags

If you've added (or removed) some USE flags on your system, there will be some inconsistencies with how some packages are compiled.

To check the USE flags a particular package will make use of, and which it is actually compiled with, run the following:

equery uses packagename

If you'd like to check which packages will make use of a particular USE flag, do the following:

equery hasuse useflag

eg, to check which (installed) packages will make use of the 'ldap' flag, run:

equery hasuse ldap
[ Searching for USE flag ldap in all categories among: ]
 * installed packages
[I--] [  ] app-crypt/gnupg-1.2.6 (0)
[I--] [  ] dev-libs/cyrus-sasl-2.1.20 (2)
[I--] [  ] dev-php/php-4.3.10 (0)
[I--] [  ] kde-base/kdebase-3.3.2-r1 (3.3)
[I--] [  ] kde-base/kdelibs-3.3.2-r2 (3.3)
[I--] [  ] mail-client/evolution-1.4.6 (0)
[I--] [  ] mail-client/pine-4.61-r2 (0)
[I--] [  ] net-fs/samba-3.0.9-r1 (0)
[I--] [  ] net-misc/openssh-3.9_p1-r1 (0)
[I--] [  ] net-www/mozilla-firefox-1.0 (0)
[I--] [  ] net-www/mozilla-1.7.5 (0)

If you make major changes to your USE flags, and want to rebuild your entire system to make use of this, you can either run

emerge --emptytree world

This will, however, rebuild everything. If you've changed your CFLAGS then that might make sense, but if you've only changed some USE flags and want to rebuild everything that might make use of it, try the following instead:

emerge --newuse world

This will only rebuild packages whose USE flags would change

An emerge clobbered something vital, but I didn't see what!

This happens a lot. If you run emerge -Du world, and don't have a tediously slow machine, chances are pretty good that at some point you'll emerge a package which will "automatically" overwrite some config option. It'll tell you about it, but you probably won't be watching. The shadow package was doing this for a while, and was overwriting the PAM configuration -- screwing anyone who used any non-standard PAM options.

  • Don't emerge lots of packages at once. And make sure you read the output. This isn't overly useful advice.
  • Set the PORT_LOGDIR variable in /etc/make.conf, and read over the log files generated by each emerge process. Or better yet, grab portlog-info to parse the output and give you the bits you want.
  • Grab ehush and use it to emerge instead -- it suppresses the noise and only shows useful information / warning content.

The last two options are ok, however this should be part of portage, not an external script. There is a bug filed against portage for this, but it's been about two years and nothing has actually happened. It's possible this will be included in the 'next version of portage', whenever that comes out.

USE flags for specific packages

You can set specific USE flags for a given package in the package attribute /etc/portage/package.use. Those flags will then be applied to that package as though they were specified on the CommandLine. Eg., to build BitTorrent without X11 support:

echo net-p2p/bittorrent -X >> /etc/portage/package.use

Masked Packages

Packages can be flagged as masked for a number of reasons. Mostly they are masked because they might break something, or they WILL break something. These tend to be masked in /usr/portage/profiles/packages.mask, and you can either forcibly install the package (see later), or unmask the package by commenting out the line. Note that this file is rebuilt everytime you emerge sync. There is a packages.unmask file, which allows you to unmask packages that have been explicitly masked, but use this with care: The package was probably masked for a good reason. You can look in /usr/portage/profiles/package.mask to see what packages are masked and why, and copy the declaration to /etc/portage/packages.unmask to unmask it.

The other reason packages can be masked is that they are in the 'unstable' branch of the gentoo tree. This is essentially the same as unstable in debian. Sometimes things will break, othertimes they'll be fine. You're on your own.

The only recommended way to install masked packages is to add to /etc/portage/package.keywords an entry for the package you want to build. Do not, whatever you do, emerge the .ebuild directly, or try to override ACCEPT_KEYWORDS on the CommandLine. Eg., if you want to emerge XFce4 from the unstable tree, do:

echo 'wm-x11/xfce4 ~x86' >> /etc/portage/package.keywords
echo '=wm-x11/xfce4-4.0.0 ~x86' >> /etc/portage/package.keywords # specific version of the package
echo '~wm-x11/xfce4-4.0.0 ~x86' >> /etc/portage/package.keywords # all revisions of a specific version

Useful utilities

  • revdep-rebuild - checks for broken library dependancies and rebuilds
  • equery - various queries you can do against the portage system, such as checking USE flag settings, dependancies and so on.
  • enotice - this little tool keeps track of important information and notices (einfo / ewarn) from ebuilds, and logs them away for you to inspect. Very useful for boxes that have a large number of updates, where important bits (like, "we're overwriting your PAM config, fix it up afterwards" might get lost).
  • distclean- removes old source files from /usr/portage/distfiles - ie, ones that aren't associated with currently installed packages.
The following authors of this page have not agreed to the WlugWikiLicense. As such copyright to all content on this page is retained by the original authors.
  • ChetanSarva
The following authors of this page have agreed to the WlugWikiLicense.

lib/plugin/WlugLicense.php:99: Warning: Invalid argument supplied for foreach()

lib/plugin/WlugLicense.php:111: Notice: Undefined variable: ignore_authors

lib/plugin/WlugLicense.php:111: Notice: Undefined variable: ignore_authors