Gentoo Helpful Tidbits

March 21, 2008

Gentoo Helpful Tidbits

Gentoo Helpful Tidbits

Welcome to Gentoo Helpful Tidbits. I created this post over the last year of taking notes installing and managing Gentoo. Though the hardcore Gentii may not find much use in it, it should be of some use to the new users. Comments and Feeback enjoyed.

Using Portage

Gentoo Linux uses a package management system called Portage. Portage offers one of the most extensible and customizable package systems available in Linux.

Portage Packages

System Update

Update all packages on the computer. This process involves: syncing Portage, creating a text file to review updates, updating the system, merging new configuration files, remove orphaned dependencies.

Sync Portage Tree:

emerge --sync
  • Downloads the latest package information.
  • Alternately many users use the program “eix”. Eix provides fast lookups of Portage packages. Eix users use “eix-sync”.

Examine update before install:

emerge -pv --update --newuse --deep world > /home/user/Desktop/portage-world-update.txt
  • Get a look of the packages to be install.
  • If unexpected dependencies are being pull in, use the –tree variable to track it down.

Update (in one step):

emerge --update --newuse --deep world
etc-update
revdep-rebuild
glsa-check -f affected
eclean distfiles
  • In the first command portage wiil update all packages on the system
  • etc-update is Portages configuration replacement tool for /etc/ files. If a user regularly edits configurations in /etc/ consider using update-cfg or dispatch-conf.
  • revdep-rebuild will check all proper libraries and dependencies are met.
  • glsa-check is Gentoo’s security patches
  • eclean distfiles will remove package source code that isn’t being used anymore.

Remove Abandoned Dependencies:

emerge --depclean

Prelink Libraries:

  • If using prelink rebind the libraries.
prelink -amR

Failed Package Emerge in a Compilation String

At times in a long list of package emerges like a system update, a package will fail to emerge. Bugzilla and the forums may have information about known problems with the package, if not, it’s possible the package needs a newer version of a package that has not yet been installed in the compilation string. Skipping the problem package and emerge it again when the rest of the packages are compiled may fix the problem.

emerge --resume --skipfirst

Blocked Packages

Packages that block other packages from being emerged can be fixed by removing the obstructing packages and reinstalling it after blocked package is emerged.

quickpkg $BLOCKER
emerge -C $BLOCKER
emerge $BLOCKED
emerge --usepkgonly $BLOCKER

Specify USE Flags per package

Add to /etc/portage/package.use
pkg-category/pkg useflag useflag2

To add a USE flag temporarily:

USE="useflag" emerge package

Masked Packages (keyword)

The “missing keyword” mask states an ebuild doesn’t support or hasn’t been tested on the current architecture (x86, amd, ppc… ). Keywording can be added to /etc/portage/package.keywords:

media-libs/libquicktime ~ppc

Masked Packages (hard)

Gentoo hards masks some packages for security concerns, collisions… Packages are hard masked in /usr/portage/profiles/package.mask.

Packages can be unmasked in /etc/portage/package.unmask.

Emerge dependency of a package.

Packages that are dependencies of other packages (i.e. have no use on their own) should be emerged as “oneshot”. This is because if the main package is removed so too will this package when “emerge –depclean” is run. Otherwise these dependent packages are added to the world file.

emerge --oneshot package

Freeze a Package

If a rebuild of a package isn’t necessary or undesired, a package can be frozen. This is useful for kernels and other such packages.

Mask the generic package (i.e. without version) in /etc/portage/package.mask:

sys-kernel/gentoo-sources

Add the specific version to /etc/portage/package.unmask:

sys-kernel/gentoo-sources-version

Create a Binary Package

If enough disk space is available its may be a good idea to create binary of a package so it is quicker to re-install.

emerge --buildpkg zim

To install

emerge --usepkg zim

Info About the Portage System

This information can be useful for reporting bugs

emerge --info

Other Portage Tools

Info about USE flags

equery uses package
  • equery is part of gentoolkit

Programs built with a specific USE flag

equery hasuse useflay

View what files are installed by program

equery files alsa-lib

View what packages install to a folder

equery belongs /usr/share/fonts/misc

List All Installed Packages

equery list

Select New System Profiles

With each new revision (i.e. 2006.1 to 2007) new profiles are added. Profiles define basic system USE flags.

eselect profile list
eselect profile set default-linux/x86/2007.0/desktop
then "Update System"

Select New Kernel

eselect kernel list
eselect kernel set 2

Rebuild modules added from Portage

Some drivers build against the kernel (video drivers, sound drivers…).

module-rebuild

GCC Update

Update System for new GCC toolchain (yes both are recommended (http://www.gentoo.org/doc/en/gcc-upgrading.xml):

emerge -eav system
emerge -eav world

See installed GCC profiles with:

gcc-config -l

And select the profile:

gcc-config 2

The environment needs to be updated.

source /etc/profile

Create a Binary of an Already Installed Package

quickpkg <package>

Use temerge instead of emerge for faster compiling

Clean Portage World File:

Udept is a program that can speed up emerge by reducing the amount of calculations required by emerge. It does so by erasing repeat entries and dependencies in the world file (/var/lib/portage/world).

Warning: Though udept can reduce emerge calculation time, it does so literally. For example, “epiphany-extensions” requires “epiphany” so udept sees “epiphany” as a dependency of “epiphany-extensions” and take it out of the world file. Later, if “epiphany-extensions” is unmerged, “emerge –depclean” will removed “epiphany”.

dep -w

Layman / Overlays

Overlays are package systems that run on top of Portage. Many Gentoo users eventually create their own overlay to be able to customize packages or build packages that are not yet in Gentoo Portage. A good number of third party overlays are available as well.

Personal Overlay - Manually Install Packages with Custom Ebuilds

Portage ebuilds can be edited to the users needs but know that once Portage has been synced again all changes will be lost. Use an overlays to add new ebuilds or make changes to an ebuild already in Portage.

It’s best to see if the program has an ebuild in bugzilla or is in one of the third party overlays.

To make a personal overlay, create the overlay directory and let make.conf known of it (this folder can be almost anywhere).

mkdir /home/user/.portage-local

make.conf:

PORTDIR_OVERLAY="/home/user/.portage-local"

Ebuilds must be placed in a category that already exists in Portage.

mv package.ebuild ~/.portage-local/media-plugins/

Keyword if necessary:

emerge gentoolkit-dev
ekeyword ~ppc package-1.2.1.2.ebuild

Create a manifest:

ebuild ~/.portage-local/category/program/program-version.ebuild digest
emerge <package>

Layman

Layman is a manager for third party overlays the most popular being sunrise.

emerge subversion
emerge layman

Add to make.conf:

source /usr/portage/local/layman/make.conf" >> /etc/make.conf
layman --fetch
layman --list       # -Lk for a more complete list

To add an overlay

Sunrise is the most popular overlay in portage. If it’s not in the regular portage tree check sunrise.

layman --add sunrise

Update layman overlays

layman -S

Entry Filed under: Gentoo. .

4 Comments Add your own

  • 1. tangram  |  March 22, 2008 at 4:41 am

    Good and refreshing article. :)

    Sums up pretty much the need to know stuff in Gentoo.

  • 2. Christian  |  March 22, 2008 at 10:57 am

    “Package states ‘missing keyword’”: A note on this. The safest way to get it is /etc/portage/package.keywords. An entry looks like that:

    cat-egory/package **

  • 3. Dirk Gently  |  March 23, 2008 at 6:07 am

    get off the juice tangram (no sl) :)

    Christian,

    I never really understood the use for package.keywords. I’ve actually seen people use it to unmask packages which seems odd to me. But now that I’ve looked into it this is alot better way to do keywording.

    Thanks for the tip.

  • 4. moz667  |  July 4, 2008 at 12:01 am

    Great post.

    Do you know how to block packages from an overlay repository?

    or…

    How to add a single package from an overlay?

    Some times you need some overlay for one or two ebuilds and its a bit insane update the rest of your system with other that do you prefeer the gentoo oficials repository ebuilds….

    Thanks a lot for the post.. very instructive.

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Welcome to Tidbits.

Thanks for visiting. Helpful Linux Tidbits is a place for common bits of Linux knowledge and error fixes. Linux is an operating system that is growing at a fantastic rate and is exciting to be a part of - everyone can contribute to it. For the time being my posting will be limited as I try to find means to a new computer, unfortunately this may not be until October or November 2008.

I Enjoy the visit. Comments very very welcome.

Top Posts

Links

Subscribe

Atom Rss2

Creative Commons License