
Published: April 28, 2010 - Pageviews: 54834
An In-Depth Look at Gentoo Linux
- Introduction / Installation
- Portage - Package Management on Steroids
- Available Software, Working with Gentoo and Final Thoughts
Portage - Package Management on Steroids
The genius behind the Gentoo Linux Distribution is it's package management utility, Portage. Basically, you tell Portage to compile so and so program and it will calculate all of the dependencies that the software needs, compile those dependencies (if any), then compile the program that you specified. Finally, it adds that program into the database of installed applications so in the future when an updated version is released it will give you the option of compiling and installing the updated software.
Portage is a built around shell scripts that take care of unpacking, building and installing software from the source code. Even though this seems pretty simple, it is extremely effective in building software source code into a coherent Operating System. It is so versatile that it allows for full customization of the software by utilizing what are called "Profiles", "USE Flags" and "Masked Packages", as well as providing an easy way to install experimental and other software that are not (yet) in the main Portage tree by using what are called "Overlays".
To configure Portage, you edit various text files that Portage uses to decide how to compile the software that you select. The main configuration file is /etc/make.conf and it contains the compiler options Portage will use and the system "USE Flags" as well as (optionally) a list of Video Cards and Input Devices that you wish to compile drivers for. You can also add a list of Licenses that Portage will automatically accept to download and install certain software.
An example make.conf file that we used for testing on an Intel Core2 Duo system is below, download it here.
CFLAGS="-march=nocona -O2 -pipe" CXXFLAGS="-march=nocona -O2 -pipe" CHOST="x86_64-pc-linux-gnu" MAKEOPTS="-j3" ###### NOTE: try to set local use flags in /etc/portage/package.use USE="a52 aac aalib acpi alsa apache2 audiofile avahi bash_completion bonobo bzip2 cairo cdda cddb cdr cups curl dbus dga directfb dts dv dvd dvdr dvdread encode esd examples exif ffmpeg fftw firefox flac gd gif gnome gnome-keyring gnutls gphoto2 gstreamer gtk hal idn ieee1394 imagemagick imlib ipod jack java joystick jpeg jpeg2k kde kdeenablefinal ladspa lame lcms libcaca libnotify libsamplerate mad matroska mikmod mmx mmxext mono mp3 mp4 mpeg mplayer mtp musicbrainz mysql mysqli networkmanager nptl odbc ogg openal opengl oss pcmcia pdf plotutils png portaudio ppds pulseaudio qt4 quicktime rss samba scanner sdl slp smp sndfile sox speex spell sqlite sqlite3 sse sse2 startup-notification svg svga taglib tcltk tetex theora threads tidy tiff timidity tk truetype usb vorbis wavpack wifi win32codecs wmf X x264 xcb xine xinerama xml xv xvid" ACCEPT_LICENSE="dlj-1.1 PUEL Broadcom Q3AEULA" INPUT_DEVICES="evdev synaptics" VIDEO_CARDS="nvidia" #Add Overlays source /usr/local/portage/layman/make.conf
USE Flags
Use flags allow you to specify what features you want your system to have. For instance, the "mp3" use flag will build support for mp3 playback in music players and so on. Specifying USE flags for your system can be a daunting task, but once you are done your system will be finely tuned for the features that you use on your computer.
USE flags are broken into 2 categories, Global Use Flags and Local Use Flags. The Global Use Flags are system wide use flags that are used by many software packages. These Use flags should be specified in the /etc/make.conf file. Local Use Flags are used by individual software packages to specify how the individual package will be built. Although you can specify Local Use Flags along with the Global Use Flags in the /etc/make.conf file, it is preferred to specify them within the /etc/portage/package.use file.
An example package.use file we used for testing can be downloaded here. An explanation of all USE Flags are listed at: http://www.gentoo.org/dyn/use-index.xml.
Also of note is the fact that you can tell a certain package NOT to use a certain USE Flag by adding a minus sign in front of it, for instance "-gnome". When adjusting USE Flags, you can re-compile your system to take advantage of the new use Flags by issuing:
emerge -u world --deep --newuse
This will scan your packages to see if any of them need to be rebuilt to take advantage of the new use flags that you may have specified. It is recommended to run the above command with the -vp switch (verbose and pretend) to ensure that your use flags are to your liking before committing the changes.
![]()
Using Gentoo's Profuse Application to Manage USE Flags
An alternate way of specifying USE Flags is by using the application Profuse. During our testing we found it useful for reference material, but we still manually set the use flags to ensure we maintained control over our software.
Masked Packages
Gentoo provides "stable" packages by default. These packages are known to be solid and are suitable for nearly any mission critical system. Gentoo also provides packages that aren't as well tested that are "masked" so that they will not automatically get installed unless the user specifies that the package can be used.
To "unmask" packages, you simply need to add the package to the /etc/portage/package.keywords file and Portage will use the masked version of the package instead of the more "stable" version. This allows you to utilize newer versions of software packages even although they might not be as well tested.
An example package.keywords file can downloaded here. Note that this file was created while utilizing the GNOME Overlay below to use the latest 2.30.0 version of GNOME and will "unmask" the latest KDE release.
To unmask larger applications that depend upon other libraries (like KDE or GNOME) can be a daunting task, which if done manually may take you an hour to unmask the dependencies. Fortunately, there is a utility, autounmask, which will pretty much do it for you (although I highly recommend making backups of your /etc/portage/ directory before running it).
For those that live on the cutting edge, you can use masked packages by default on your system by setting "ACCEPT_KEYWORDS=~arch" within the /etc/make.conf file, where ~arch is your system's archetecture. For instance "ACCEPT_KEYWORDS=~x86" for 32 bit intel systems or "ACCEPT_KEYWORDS=~amd64" on 64 bit AMD and Intel systems.
Overlays
Since the Gentoo Portage system is somewhat conservative on what it considers "stable" and "masked" packages, many users have created what are called "Overlays" to provide newer packages or software that is not included within Portage (yet).
To use overlays, Gentoo has a guide at: http://www.gentoo.org/proj/en/overlays/userguide.xml.
Many overlays exist, although we only tested the GNOME overlay and the Sunrise overlay, which seemed pretty usable to us. To view all the overlays, check out http://overlays.gentoo.org/.
Fixing Broken Packages and Managing Your System
On Linux Systems, when you start updating various libraries and software packages, other libraries and software packages may become "broken" and fail to work properly. This usually happens when third-party vendors start providing updated libraries and apps without fully testing the updates to ensure the Distribution's software isn't affected.
Since Gentoo is a Source based Distribution, it is extremely easy to fix these types of errors, just recompile any package that was built on the older library to ensure it uses the new library. Gentoo even has a utility called "revdep-rebuild" which scans your system for any library or application that is "broken", then automatically rebuilds that library or application. The revdep-rebuild application is included in the "gentoolkit" package.
Most Linux Configuration Settings are located within the /etc directory and although Gentoo does not provide too many "Graphical Configuration Utilities" like other Linux Distributions to adjust these settings, Gentoo provides a few utilities to ensure software updates don't overwrite the configurations that you may have set.
The "classic" utility that they created to do this is called "etc-update" and you simply type this into a terminal to scan for and list any configuration files that may need to be changed.
Of course, with developers there is always a better way to do a certain task, thus the "dispatch-conf" utlity was created. The "dispatch-conf" utility pretty much provides the same features as the "etc-update" utility, but it also provides complete backups for any and all changes that you do to the "/etc" files. This allows you to "undo" or go back and see what conf changes were made in case something goes astray. To view more information on these tools: Check out this chapter of the Gentoo Handbook.
Next: Available Software, Working with Gentoo and Final Thoughts















