HOWTO: Switch from Test to Stable Packages

From Sabayon Wiki
Jump to: navigation, search
Portage (emerge) is not the primary package manager for Sabayon, this article is for advanced users only. In other words if this fails for you, its your fault. You have been warned.


Each Sabayon release is a compilation of packages that work well together, mostly comprised of "test" packages in the Portage tree. By default, a Sabayon installation will also install test packages whenever a new application is installed, or when updates take place. This can lead to the scenario where a stable Sabayon installation becomes unstable after doing an "emerge world". This article shows how to keep the currently installed test packages, while ensuring that any new packages are "stable".

Note: All references to amd64 should be changed to reflect your architecture - probably x86 if not amd64

Test Packages

By default, emerge will only use stable packages. If default was left is it was, then issuing an emerge world command would cause the majority of packages to be downgraded to stable packages, more than likely breaking the installation.

To prevent this, the /etc/make.conf file in Sabayon contains the following statement:


The tilde "~" in this line tells the emerge command that it is acceptable to download and install test packages when a request to install an application takes place. All packages within the gentoo repository can be marked as "stable" in that they have undergone QA, or "masked" meaning they are in the tree, but have not gone through QA (this is simplified, and there are other statuses not relevant to this article, please see the Portage documentation at for details). The equivalent line for stable packages would have the tilde removed:


As this is the default, the absence of this line would also mean "only install stable packages".

Goal and Quickstart

The goal is to change the ACCEPT_KEYWORDS line to only permit stable packages, while allowing the existing test packages to remain installed. This means that the currently working test packages will remain, however as new stable versions of these packages become available, and emerge world is executed to update new packages, the installation will slowly migrate to stable packages. Any packages that should remain as test can be added manually to the package.keywords file.

The following is the quick description of the solution, while the rest of the article describes what each step achieves:

1. Change make.conf ACCEPT_KEYWORDS line to:


2. Create a list of currently installed packages:

 equery -i -N list | grep \~ | sed 's/.* \(.*\) (.*/<=\1 ~amd64/' > testpackages
The default action for equery list has changed in Gentoolkit 0.3 - use new command syntax...
 equery -N list -F '=$cpv $mask2' '*' | grep \~ > testpackages'

3. Backup current package.keywords

 cp /etc/portage/package.keywords /etc/portage/package.keywords.back

4. Append testpackages file to package.keywords

 cat testpackages >> /etc/portage/package.keywords


Change make.conf

First things first, edit /etc/make.conf and either comment out, remove, or change the ACCEPT_KEYWORDS line to:


If you do this, you must do the rest, otherwise you could be in trouble next time you get to emerge something. This line tells emerge that all packages must be stable, unless explicitly stated in /etc/portage/package.keywords

Generate list of currently installed test packages

Next we need to get the list of packages that are currently masked as test packages, and create a file that we can use to add to the package.keywords to let emerge know that they can remain as test packages.

We use three commands piped together to do this. You can try these out stage by stage so that you can see exactly what is going on. The first part is:

   equery -i -N list

This shows a list of installed packages, such as:

   [I--] [ ~] x11-wm/twm-1.0.3 (0)

The second column will contain a tilde ‘~’ if the package is masked. These are the packages we need, so we will pipe the output into grep to pull out only those lines that contain a tilde:

   equery -i -N list | grep \~

The output will now only contain the masked packages.

==Manipulate for use in package.keywords

We need to manipulate each line a little to pull out just the package name, and then add the prefix and suffix we need ready for the package.keywords file:

   equery -i -N list | grep \~ | sed 's/.* \(.*\) (.*/=\1 ~amd64/'

This transforms the above line:

   [I--] [ ~] x11-wm/twm-1.0.3 (0)


   =x11-wm/twm-1.0.3 ~amd64

This means “permit use of a masked package for x11-wm/twm, for version 1.0.3 only.”

We just need to output the results of that to a file, and append it to /etc/portage/package.keywords

Output to a file:

   equery -i -N list | grep \~ | sed 's/.* \(.*\) (.*/<=\1 ~amd64/' > testpackages

Update package.keywords

Append to the end of /etc/portage/package.keywords (take a backup first):

   cp /etc/portage/package.keywords /etc/portage/package.keywords.back
   cat testpackages >> /etc/portage/package.keywords

This last command will need to be done with root privileges. If you followed the previous article’s approach, you will have a bunch of old entries in there from the previous method. These will need to be removed first.

Once you have done this, you can effectively leave it alone. As new packages are released into the stable tree, they will supersede the ones you have installed, and the package.keywords entries will be ignored. Forum user voxiac suggested a cron job that would clean up the package.keywords file over time. I’ll have a go at putting something together down the line, depending on what level of hassle the cleanup is.


The following command will give you a count of the current test packages you have installed:

   equery -i -N list | grep \~ | wc -l

Versus total installed:

   equery -i -N list | grep \/ | wc -l


Sabayon Stabiliser 2 Sabayon Stabiliser