Gentoo Portage makes it fairly easy to update all the installed packages on your system. The emerge and revdep-rebuild tools are powerful and make the process of recompiling everything much less painful than it sounds.
The emerge and revdep-rebuild commands require root privileges so switch to root or use sudo.
The first step is to synchronize your Portage tree with the latest mirror. This command will get you information on the latest packages that are currently available.
# emerge --sync
Perform an “pretend” emerge to see what packages will be updated and installed on your system.
# emerge -uDNvp world
These are the packages that would be merged, in order: Calculating world dependencies... done! [ebuild U ] dev-util/pkgconfig-0.23 [0.22] USE="-hardened" 1,009 kB [ebuild U ] media-sound/wavpack-4.50.1 [4.41.0] USE="mmx" 367 kB [ebuild U ] dev-libs/gmp-4.2.2-r2 [4.2.2] USE="-doc -nocxx" 0 kB . . . [ebuild N ] sys-apps/man-pages-posix-2003a 949 kB Total: 149 packages (100 upgrades, 36 new, 2 in new slots, 11 reinstalls), Size of downloads: 354,800 kB
Lets go over these options.
-u update packages
-D consider entire dependency tree for all packages
-N include packages with USE flag changes
-v verbose emerge output
-p pretend to do the emerge
The ‘world‘ argument tells emerge to use the list of packages in your world file. This list contains all packages that have been directly emerged on your system. These packages do not include dependences or packages that were emerged using the ‘–oneshot‘ option. Your world file is located here /var/lib/portage/world.
The output of this command will tell you one of two things. Either everything is good and you can go ahead and perform the update, or Portage has found some conflicts such as blocking packages that must be fixed before you continue. Hopefully the former is the case, but if there are conflicts Portage messages will usually point you in the right direction.
Before performing the actual update you can use the parallel-fetch feature to speed up the package downloads and shorten the update process. To do this add the following line to /etc/make.conf.
FEATURES="parallel-fetch"
If there are no Portage issues, you have reviewed the list of packages to be installed and everything looks correct, then you can start the update. To perform the update run the same command as before but remove the ‘-p‘ option.
# emerge -uDNv world
Occasionally a system update will break shared library dependencies as an upgraded package may no longer be compatible with packages which use it. Enter the revdep-rebuild reverse dependency re-builder tool.
The revdep-rebuild tool is part of the gentoolkit package which you must emerge first.
Run this command after a large system update to ensure all packages are in good shape.
# revdep-rebuild
This command will scan your system for missing shared library dependencies and fix them by re-emerging those missing packages.