Gentoo - Using Masked Packages

When a package is masked, it means you have to explicitly alter some configuration files to emerge it.

Usually packages are masked because they’re not considered stable enough for the standard Gentoo environment. This can be because they just need more testing, or they’re incompatible with another package, or there may be something seriously wrong with the package itself.

In this article we’ll see how we can access these packages.


Warning!

Packages are usually masked for a very good reason.

Although the aim of these articles is to assist in building a stable server environment and we do show you what to do, we recommend that you don’t unmask packages in most situations.

Just keep in mind what we are trying to achieve when creating and building our Slice.

Remembering these recommendations, let’s see what to do if we really need to have a masked package installed…

Using a masked package

In our example esearch is masked; the stable version is broken and only the testing version is available. This is what happens when we try to emerge esearch:

$ emerge -vp esearch
...
!!! All ebuilds that could satisfy "app-portage/esearch" have been masked.
!!! One of the following masked packages is required to complete your request:
- app-portage/esearch-0.7.1-r7 (masked by: ~amd64 keyword)
- app-portage/esearch-0.7.1-r6 (masked by: ~amd64 keyword)
- app-portage/esearch-0.7.1 (masked by: package.mask, ~amd64 keyword)
/usr/portage/profiles/package.mask:
# Paul Varner <fuzzyray@gentoo.org> (31 Dec 2008)
# Masked due to being broken with portage 2.1 and 2.2.
# Users can use either the unstable versions or switch to app-portage/eix

There are two types of masks in this output; keyword masks (masked by: ~amd64 keyword), and hard masks (masked by: package.mask).

Keyword Masks

Keywords are defined in the ebuild file itself; in this case:

/usr/portage/app-portage/esearch/esearch-0.7.1-r7.ebuild

This mask is declaring that the version we want to install is flagged as ”testing only” on our amd64 architecture Slice.

We can enable the latest testing version on our system by adding the following line to /etc/portage/package.keywords:

=app-portage/esearch-0.7.1-r7 ~amd64

You can see more information on the syntax on this file by entering man portage on the Linux command prompt:

man portage

Once inside the man program, you can type /package.keywords and hit enter to find the correct place in the file. Hitting the q key will exit the man program.

Once the package.keywords file has been updated, we should be able to emerge esearch without any further problems. As always, we’d test with -vp first, then when we’re ready, run the real command:

sudo emerge esearch

Hard Masks

The other type of mask shown comes from the package.mask file, indicating that the 0.7.1 version is broken or has a security risk and is not supported by the Gentoo team. In the emerge output, it looks like this:

...
- app-portage/esearch-0.7.1 (masked by: package.mask, ~amd64 keyword)
/usr/portage/profiles/package.mask:
# Paul Varner <fuzzyray@gentoo.org> (31 Dec 2008)
# Masked due to being broken with portage 2.1 and 2.2.
# Users can use either the unstable versions or switch to app-portage/eix

In this particular case, there are two masks on this package; the hard mask represented by masked by: package.mask, plus a keyword mask shown as ~amd64 keyword.

The last 3 lines of the output are actually an excerpt from the /usr/portage/profiles/package.mask file; they explain the reason that it is masked.

To override the hard mask we could add a line like this to /etc/portage/package.unmask:

=app-portage/esearch-0.7.1

More info on this file can be found in the portage man page.

That’s the hard mask out of the way, but we’d still need to get around the keyword mask if we wanted to emerge this version of the esearch package. To do this we could repeat the earlier process, only with a different version number, by adding a line like the following to /etc/portage/package.keywords:

=app-portage/esearch-0.7.1 ~amd64

Just be careful when installing these types of packages - they’re usually masked for a reason.

matiu

Want to comment?


(not made public)

(optional)

(use plain text or Markdown syntax)