Upgrading Gentoo

This document Article description::explains how to upgrade (update) Gentoo.

Gentoo has its own approach to updates: this will be explained here, as well as how to proceed for a well maintained system.

It is important to keep Gentoo up to date. In addition to the need to have the latest security patches, Gentoo installations can get too out of sync with the current version and sometimes become complex to update.

Any instructions that only affect ten or more year old systems will not be retained here. See page history for previous versions.

About Gentoo architecture and upgrades
Gentoo differs from most other Linux distributions when it comes to updates. Most distributions have regular releases, every few months or years, which are often published without too much fanfare.

Gentoo, by contrast, is a rolling release distribution. There is no need to wait for a release to come out to get the latest version of packages: software can be installed as soon as it becomes stable, with frequent updates. Gentoo was designed from the beginning around this concept of fast, incremental updates, and there are updates to its software nearly every day.

Once software is installed, regular system updates will keep all packages on the latest available version. Only in very rare cases are changes made to the core system which require updates to be done manually. This typically involves switching to a new profile.

A news item will be published in such critical cases.

Profiles are central to a Gentoo system because they can define core system functionality, and new profiles are made available when there are fundamental changes to the way Gentoo works.

A profile is selected at install time, according to the intended use of the system and is usually only changed if necessary, or for an update.

Updating packages
The Handbook has detailed information on updating the Gentoo repository and on updating the system. See for more detailed information.

To update all installed packages to the latest available versions, first update the Gentoo repository with Project:Portage/Sync:

Or, for short:

This may output messages that should be read and followed.

Run emerge to update the whole system, with dependencies (including build-time dependencies):

Pay attention to any information provided by Portage at the end of the update.

If Portage reports dependency issues, sometimes using the  (or an even higher number) can help. By default, Portage has a relatively low limit on how far it tries to resolve dependencies (for performance reasons), occasionally it is not enough.

After the update, Portage recommends running. Be very careful running, it can remove important packages (e.g. kernel sources or virtual pakage optional dependencies when an alternative gets merged). Always use  or   options and carefully review output:

If would remove packages that should not be removed, the   option could temporally be used, or they can be added to the world set (preferred), for example:

Any configuration file changes should be addressed, this can be managed by dispatch-conf:

Profile updating instructions
When a new profile is available, Portage will inform the user with a news item (recent news items are listed on the website).

If a system is too old, it may be non trivial to get the system up to date, it may even be easier to start from scratch.

Generally, it is not mandatory to switch to a new profile when one comes out. Systems can continue to use their old profile, they won't stop working by staying on an old profile. However, Gentoo strongly recommends updating the profile if it becomes deprecated, as this means that Gentoo developers no longer plan on supporting it.

Profile updates are executed manually. The way to update may vary significantly from profile to profile; it depends on how deep the modifications introduced in the new profile are. In the simplest case, users only have to use the tool to change the  symlink,  the worst case could be having to recompile the entire system from scratch, with significant reconfiguration (though changes are usually not too hard, and are well explained - the main thing to remember is to properly follow the instructions).

Exactly what is required to migrate to a new profile is detailed in the relevant news item.

General instructions
This is a generic outline of what is done to update a profile. As stated previously, specific instructions will be provided in a news item, for each new profile. A profile update often requires manual intervention, beyond just switching the profile version.

Switch profiles with
Make sure warnings in parent section have been read.

To switch profiles with the automatic tool, must be installed. The utility makes viewing and selecting profiles easy, without needing to create or remove symlinks by hand:

Switch profiles manually
Make sure warnings in parent section have been read.

Changing profiles manually is still supported:

Updating to 17.1
See the appropriate news item. At this point all installations should already be using the 17.1 profile, and migration could be difficult.

Updating to 17.0
See the appropriate news item. At this point all installations should be using the 17.1 profile, and migration could be difficult.

Updating old systems
Sometimes, systems are too old to easily upgrade. It may be possible to manually update a very old system, but it may be better to start from scratch and copy system configuration an files from the old system to the new one.

Here is a rough guide to updating an old system. Another method can be found here.

Synopsis
The idea with this upgrade approach is that we create an intermediate build chroot in which a recent stage3 is extracted. Then, using the tools available in the stage3 chroot we upgrade the packages on the live system.

Preparing the intermediate build chroot
Let's first create the intermediate build chroot location, say, and extract a recent stage3 archive into it.

Next, we create a mount point inside this chroot environment, on which we then bind-mount the live (old) environment.

So now the live (old) system is also reachable within. This will allow us to reach the live (old) system and update the packages even when chrooted inside the intermediate build chroot.

Network, chroot, and update
The new install needs to access the network, so copy over the network related information:

Now chroot into the intermediate build location, and start updating vital packages on the live system, until the live system can be updated from within the live system (rather than through the intermediate build chroot):

It may be a good idea to check that the profile and Portage configuration are compatible between the (old) live system and the chroot.

Now start building packages into the (old) live system. If Portage is old or missing, it is a good idea to start with that:

Keep this chrooted session open and try to update the (old) live system. When failures occur, use this chrooted session to update packages using the build tools available in the intermediate build chroot (which includes recent, , etc.). Tools can be added as needed to the build chroot.

For some installations it may be necessary to update configuration files in order to install new software. Make the changes in the chroot environment.

To get the system fully up-to-date before exiting the root, build the  set (all packages) into the (old) live system:

Once finished the system should now be up to date!