Upgrading Gentoo/zh-cn

本文档解释了新的 Gentoo 版本如何影响现有安装.

思想
在 Gentoo 领域，升级的概念与 Linux 世界的其他地方相比完全不同. 众所周知，Gentoo 从未接触过“经典”的软件升级方式：等待新版本、下载、刻录、放入光驱，然后按照升级说明进行操作.

Gentoo users know however that this process is extremely frustrating for power users that want to live on the bleeding edge. Even power users from other distributions probably share the same feelings, given the popularity and spread of tools like apt or apt-rpm which make it possible to have quick and frequent updates. However, no distribution is more suited than Gentoo to satisfy these kind of demanding users. From the beginning, Gentoo was designed around the concept of fast, incremental updates.

理想情况下，用户安装一次软件，从不担心发布：只需按照 Gentoo 手册 中的 Portage 介绍 中的说明进行操作，该说明解释了如何保持系统处于最新状态. 虽然这是通常的方式，但有时会对核心系统进行更改，这需要手动完成更新.

发布和特性配置文件
关于 Gentoo 发布过程的一个反复出现的问题是：“如果新版本不是为了让用户更新软件，为什么要频繁推出新版本？”有多种原因：


 * 新版本意味着带有错误修正和更多功能的新安装 CD
 * 新版本提供了一组更新的 GRP 包，以便选择“快速方式”安装（stage3 + 预编译包）的用户最终得到一个未过时的系统
 * 最后，新版本可能会不时实现一些与以前版本不兼容的功能

当一个版本包含新的不兼容特性，或者提供了一组深入修改系统行为的核心包和设置时，我们说它提供了一个新的“特性配置文件”.

特性配置文件 是一组配置文件，存储在 的子目录中，描述诸如被视为“系统”包的 ebuild 等内容，默认情况下的 USE 标志、虚拟包的默认映射以及系统运行的体系结构.

The profile in use is determined by the symbolic link, which points to a subdirectory of which holds the profile files. For instance, the default 13.0 profile can be found at. The files in the parent directories are part of the profile as well (and are therefore shared by different subprofiles). This is why we call these cascaded profiles.

Profiles obsoleted by new ones are kept in along with the current ones, but they are marked as deprecated. When that happens a file named is put in the profile directory. The content of this file is the name of the profile that should be "upgraded to"; Portage uses this information to automatically warn administrators when they should update to a new profile.

There are various reasons that a new profile may be created: the release of new versions of core packages (such as, , or ) that are incompatible with previous versions, a change in the default USE flags or in the virtual mappings, or maybe a change in system-wide settings.

不更改特性配置文件的版本
如果一个新的 Gentoo 版本不包含一个新的特性配置文件，那么就假装它从未发生过. :)

When the installed packages are upgraded as explained in the Gentoo Handbook, then the system will be exactly the same as one that has been installed using the new release.

Releases with profile changes
如果是发布（例如 13.0 为 ）引入了一个新配置文件，那么就可以选择迁移到新配置文件.

Generally, such migrations are not mandatory, and systems can continue to use the old profile - just update the packages as explained in the Gentoo Handbook.

但是，Gentoo 强烈建议更新已弃用的配置文件. 当这种情况发生时，它意味着 Gentoo 开发人员不再计划支持它.

When a profile migration is apparent, then the upgrade has to be executed manually. The way to update may vary significantly from release to release; it depends on how deep the modifications introduced in the new profile are.

In the simplest case users only have to change the symlink, in the worst case they may have to recompile the entire system from scratch while doing a neat voodoo dance. Migration is usually covered in the release notes. The necessary instructions are explained further in this guide.

支持的配置文件
To view the list of supported profiles, call (which can be installed using ) as follows:

从旧系统升级
Some systems are too old to just switch the profile. Newer profiles might need more recent Portage versions or other software that cannot be installed anymore because the package definitions (ebuilds) for those older software versions are not available anymore.

If this is the case, the system should first receive older Portage tree snapshots and upgrade at least Portage (but preferably all packages in the system set), gradually increasing the Portage tree snapshot date until it is recent enough to follow the profile switching instructions again:

Older snapshots are often still available on some mirrors on the Internet or on specific locations dedicated for this purpose. It is recommended to verify the integrity of those files to make sure they are not tampered with:

Although the release signing keys might be expired, the signature should still be OK.

Upgrading from (too) old systems
Sometimes, systems are too old to easily upgrade. The upgrade path might need intermediate versions of software (such as portage) that does not exist any more, requiring to update the portage tree in steps (for instance incremental tree updates with steps of 3 to 4 months).

To upgrade such systems, a recent stage3 can be used to update the system. Instructions for that are given in the Updating old systems section.

通用信息
First, run. The utility makes viewing and selecting profiles easy, without needing to create or remove symlinks by hand.

Changing profiles manually is still supported though:

Updating to 2008.0, 2007.0, or 2006.1
Be aware that, if an upgrade from these profiles is selected, that they expect the system to be set to a Unicode locale by default; specifically that  is set in. For this to work, a Unicode locale for the system must be created. Please read the UTF-8 article to learn how to create the proper locale.

Alternatively, if setting a locale is not preferred, then users need to specify  in, and re-emerge  (or wait until the next baselayout update) with the   USE flag. This can be accomplished through:


 * setting  just for, like so:


 * or setting it globally for all packages by adding it to the USE variable in :

Finally, follow the general upgrade instructions for updating the profile.

Updating to 2006.0
To switch to the 2006.0 profile, point the symlink to the new location. Make sure Portage is updated before changing the profile.

- Users that use a 2.4 kernel or don't want to use NPTL should use the default-linux/alpha/no-nptl profile. More information is available in the alpha release notes.

- The merge of the ppc32 and ppc64 profiles went forward. The ppc32 profile has been changed in a way that offers a minimalistic generic profile for all purposes, located in. The release-dependent profile is optimized for desktop-usage and located in. There are some subprofiles available for G3 and G4 processors, and G3/Pegasos and G4/Pegasos for the Pegasos Open Desktop Workstation. Make sure to choose the correct subprofile for the system when migrating to a 2006.0 profile.

- Upgrading to the 2.4 -kernel based 2006.0/2.4 profile requires manual user intervention (unmerging Java stuff) and an because of the GCC upgrade. Upgrading to the 2.6 -kernel based 2006.0 profile which is not considered stable also requires an entry in to unmask a 2.6 version of  and a full rebuild.

All other archs - There are no fundamental changes in this profile. No specific action needs to be performed.

Updating to 2005.1
To switch to the 2005.1 profile, point the symlink to the new location. Make sure Portage is updated before changing the profile.

All archs - There are no fundamental changes in this profile. No specific action needs to be performed.

- With the 2005.1 release, the ppc and ppc64 profiles were merged and a number of subprofiles for specific subarchitectures were created. Make sure to choose the correct subprofile for the system when migrating to a 2005.1 profile.

Updating to 2005.0
With the introduction of 2005.0, several architectures have decided to define additional profiles. Make sure to read the description of said profiles before deciding to migrate to one of them. Most architectures now also default to the 2.6 kernel tree where 2.4 was chosen previously.

Some architectures require a bit more actions to be completed in order to convert from one profile to another. If that is the case, the step-by-step guides are linked from the table.

To switch to the selected profile, point the symlink to the new location. Make sure Portage is updated before changing the profile!

When an upgrade is planned from a Linux 2.4-based system to a 2.6 kernel, make sure to read our Gentoo Linux 2.6 Migration Guide.

Updating to 2004.3
With the introduction of the 2004.3 profiles, users are not going to see huge modifications of their systems (see below for details). However, Gentoo developers decided to push out this new profile and to deprecate quite a few of the old ones to speed up the adoption of stacked profiles, that is, the profiles that follow the new layout of the directory, for instance  (supported by Portage 2.0.51 or later).

To switch to the 2004.3 profile, point the symlink to the new location:

All archs - As said above, there are no big changes introduced in this profile. However, it should be noted that (deprecated) and  are no longer considered system packages. This means that during a, Portage will try to remove them from the system. If any of those packages are needed, add them to after the profile switch, or manually emerge them.

- is now the default instead of  (deprecated) for newly installed machines. This has no effect on already installed machines, though.

Updating Portage to support cascading profiles
Although this section does not seem to integrate well in this upgrading guide, it is quite important. Any profile listed above this section requires a Portage version that supports cascading profiles. However, some obsoleted profiles don't allow the user to upgrade Portage or the user is using a profile that isn't available anymore - any attempt to upgrade Portage will result in a failure.

To work around this problem, users can set a temporary symbolic link to the obsolete profile, allowing them to upgrade their Portage after which they can continue with the upgrade procedure set forth in this guide. Please substitute  with the respective system architecture:

Updating to 2004.2
To switch to the 2004.2 profile, point the symlink to the new location:

- This profile changes the default X11 implementation from (deprecated) to. This change only touches the default value, and is only relevant for those who have not installed an X server yet. If one is already installed, then it will not affect the system at all; users are free to switch from one X server to the other exactly as before.

- There are no fundamental changes from previous profiles, no specific action needs to be performed.

Updating to 2004.0
To switch to the 2004.0 profile, point the symlink to the new location:

All archs - There are no fundamental changes from previous profiles, no specific action needs to be performed.

Updating from profiles older than 1.4 to 1.4
The instructions for this upgrade are quite complex, and can be found here.

Idea of the upgrade
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.

网络、chroot 和更新
新安装需要访问网络，因此复制网络相关的信息：

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):

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!