Unmasking Packages in Gentoo using "autounmask"

When you want to install a unstable/beta version of a package in Gentoo, the recommended way is to unmask the package you want to install by adding a corresponding entry to the "/etc/portage/package.keywords" file. The problem is that more often than not, the package you want to install will require you to unmask other (sometimes many) packages, requiring you to iteratively add packages to the keywords file until the install process can complete without errors. Instead of having to manually unmask each package individually, a helper utility, called autounmask is available which greatly simplifies the task.

For example, supposed I want to install kde-3.5.8, which is currently masked using the ~x86 keyword. Using the manual method, I would do the following:

# echo "=kde-base/kde-3.5.8 ~x86" >> /etc/portage/packages.keywords
# emerge =kde-base/kde-3.5.8

These are the packages that would be merged, in order:

Calculating dependencies
!!! All ebuilds that could satisfy "~kde-base/kdelibs-3.5.8" have been masked.
!!! One of the following masked packages is required to complete your request:
- kde-base/kdelibs-3.5.8 (masked by: ~x86 keyword)
- kde-base/kdelibs-3.5.8-r1 (masked by: ~x86 keyword)
- kde-base/kdelibs-3.5.8-r2 (masked by: ~x86 keyword)
- kde-base/kdelibs-3.5.8-r3 (masked by: ~x86 keyword)

For more information, see MASKED PACKAGES section in the emerge man page or
refer to the Gentoo Handbook.
(dependency required by "kde-base/kde-3.5.8" [ebuild])

So I would now have to add "=kde-base/kdelibs-3.5.8-r3" to the keywords file and try again, but the kdelibs package will require that some other package be unmasked, etc, etc.

A faster way to unmask all of the kde related package would be to search the portage tree using one of the available search utilities such as "eix" or "equery", and use command-line utilities such as "grep" and "cut" to properly format the output so that it can be piped to "xargs emerge". This method is itself tedious end error-prone, and requires some trial-and error.

It should be clear by now that unmasking many packages can be time-consuming and annoying, but fear not! The "autounmask" utility makes this whole process painless. First, install the utility by doing:

# emerge app-portage/autounmask

Now, to unmask kde-3.5.8 and friends, simply run:

# autounmask kde-base/kde-3.5.8

autounmask version 0.21 (using PortageXS-0.02.07 and portage-2.1.3.19)

* Using repositories:
/usr/portage
/usr/portage/local/layman/sunrise
/usr/portage/local/layman/gentopia
/usr/local/portage

* Using package.keywords file: /etc/portage/package.keywords
* Using package.unmask file: /etc/portage/package.unmask

* Unmasking kde-base/kde-3.5.8 and its dependencies.. this might take a while..

* Added '=kde-base/kde-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdelibs-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdelibs-3.5.8-r1 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdelibs-3.5.8-r2 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdelibs-3.5.8-r3 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdemultimedia-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdemultimedia-3.5.8-r1 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdepim-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdebase-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdebase-3.5.8-r1 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdebase-3.5.8-r2 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdebase-3.5.8-r3 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdebase-3.5.8-r4 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdebase-3.5.8-r5 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdebase-3.5.8-r6 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdenetwork-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdegames-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdeartwork-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdeaddons-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/arts-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdeedu-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdetoys-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdeutils-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdeutils-3.5.8-r1 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdewebdev-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdewebdev-3.5.8-r1 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdeadmin-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdegraphics-3.5.8 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdegraphics-3.5.8-r1 ~x86' to /etc/portage/package.keywords
* Added '=kde-base/kdegraphics-3.5.8-r2 ~x86' to /etc/portage/package.keywords
* done!

As you can see, autounmask figured out all dependencies required by kde-3.5.8 and unmasked them. KDE 3.5.8 can now be installed by typing "emerge =kde-base/kde-3.5.8"

Comments

Awesome

Works Perfectly!!! Thank you

Thanks

Thank you Stephan. Very useful article!

AWESOME SUGGESTION!

thank you! i appreciate it. helped me a lot!

Great tip!

Saved me a lot of work when trying to emerge gnome-2.24. Thank you