Gentoo 1.4 Upgrade Guide
1. Before you begin
Be prepared
As with any major upgrade to the core of your Gentoo
system, there is always the possibility that unforeseen
problems will ensue. It is always prudent to back up all
important data before beginning this process. If possible,
try to allocate a large block of time for this upgrade, so
that you will not feel rushed. All the software on your
machine will need to be recompiled.
Other options
This is not the only way to upgrade your system. You can
install a new 1.4 system onto a separate partition and
reuse some of your system configuration instead. This method also has
the advantage that you can always go back to your old system
in the meantime as a fallback. You may also decide to simply
not upgrade your system. If you decide you want to upgrade
in place, read on.
General notes
Whenever the code listings suggest running the
emerge command, it is always a good idea to make a test
run of the command using the -p or --pretend
option to make sure that the command will do what you expect
it to do.
2. Upgrading in place
Get Portage as current as possible
Some of the syntax of current ebuilds is unreadable by
older versions of Portage. If you don't have at least Portage 2.0.44, try upgrading Portage.
Code Listing 2.1 |
# emerge --sync
# emerge -u portage
|
Note: If your Portage version is very old, you may get an
error message containing the phrase "unscriptable object".
Read and follow the instructions in
/usr/portage/sys-apps/portage/files/README.RESCUE.
Your Portage install should then be
current. |
Preparing GCC for cohabitation
You will be installing a newer version of GCC during this
upgrade. Versions of GCC older than 2.95.3-r8 are not
designed to have multiple versions of GCC installed. You must
therefore upgrade GCC to at least version 2.95.3-r8. This
will also have the beneficial side-effect of installing the
gcc-config package on your system, which can be used to
switch back and forth between various installed versions of
GCC.
Code Listing 2.2 |
# emerge -u gcc
|
You can now check to see if gcc-config is working properly:
Code Listing 2.3 |
# gcc-config --get-current-profile
|
This should return i686-pc-linux-gnu-2.95.3 on most x86 systems. Older systems may return i586-pc-linux-gnu-2.95.3.
Installing GCC 3
Now you can install a newer version of GCC without damaging
your current compiler. Look in
/usr/portage/sys-devel/gcc for a version of the
GCC ebuild that is at least 3.2.1-r6. Choose the highest
version that is marked stable for your architecture. To see
if an ebuild is considered stable for your architecture, look
for the KEYWORDS line in the ebuild file. If it has your
architecture listed without a ~ in front of it, it is
considered stable. Assuming 3.2.2 is the most current stable
version, we first need to remove the glibc dependency from gcc.
Edit /usr/portage/sys-devel/gcc/gcc-3.2.2.ebuild and search for the
line containing DEPEND. Remove the glibc dependency and save the
ebuild.
Code Listing 2.4: Editing gcc-3.2.2.ebuild |
# vim /usr/portage/sys-devel/gcc/gcc-3.2.2.ebuild
|
Now install the latest GCC version on your system:
Code Listing 2.5 |
# USE="-java" emerge /usr/portage/sys-devel/gcc/gcc-3.2.2.ebuild
|
Changing profiles
Now you need to change two sets of profiles: your
gcc-config profile and your Portage profile.
Code Listing 2.6 |
# cd /etc
# rm make.profile
# ln -s ../usr/portage/profiles/default-x86-1.4 make.profile
|
Code Listing 2.7 |
# gcc-config --list-profiles
# gcc-config i686-pc-linux-gnu-3.2.2
|
Recompile toolchain
Now you need to recompile your core toolchain with your new
compiler. If you are continuing in the same shell, you need
to run source /etc/profile as gcc-config instructed you
to. Then emerge glibc and binutils using your new
compiler:
Code Listing 2.8 |
# emerge glibc binutils
|
Warning: It is quite likely that you will upgrade glibc from a
2.2 or older version to 2.3. Do not downgrade glibc
afterwards. Any software you have compiled against glibc 2.3
will stop working, and this can make your system
unusable. |
Recompiling everything with your new compiler
Now you may recompile everything on your system with
your new compiler:
Code Listing 2.9 |
# emerge -e world
|
Note: If this command fails at any point due to errors, you
can use emerge --resume to continue the process where
you left off. This requires Portage 2.0.47 or later. |
The contents of this document are licensed under the Creative Commons - Attribution / Share Alike license.
|