The big emerge
(Note:quite a few people in the forums recommend against building the world due to potential breakage).
At the should update the system using the following:
EMERGE-UV World
If you get the This error:
[Blocks B ] Sys-apps/pam-login (is blocking sys-apps/shadow-4.0.18.1) ...
!!! Error:the above package list contains packages which cannot is installed
!!! At the same time on the same system.
Then you'll need to resolve this using:
Features=-collision-protect emerge--nodeps Shadow && emerge--unmerge Pam-login
And then repeat the world emerge.
=========================================
Original URL:
Http://www.gentoo.org/doc/zh_cn/handbook/handbook-x86.xml?part=2&chap=1
1. Portage Introductory content: Welcome to Portage Portage Tree Package Maintenance when Portage complains ...
1.a. Welcome to use Portage
Portage is probably the most notable innovation in Gentoo's software package management. It has a high degree of flexibility and a number of other features that make it often considered the best package management tool in Linux.
Portage is written entirely in Python and bash. Because they are all scripting languages, Portage is also completely visible to the user.
Most users will use the emerge tool to portage. The purpose of this section is not to repeat what has been provided in the Emerge man page, if you want to fully understand the options provided by the Emerge tool, refer to the corresponding instructions given in the man page.
Code Listing 1.1: Getting Help for emerge |
$ mans emerge
|
1.b. Portage Tree
Ebuilds
When we talk about (software) packages, we usually refer to the name of the package provided by the Portage tree for Gentoo users. The Portage Tree is a collection of ebuilds files that contain the Portage management Tools maintenance software (installation, search, query, ...). ), and is placed in the/usr/portage directory by default.
Whenever you ask Portage to perform some action on a package in the system, it will base on the Ebuilds file in the system. Therefore, you may want to update the Ebuild file in the System Portage tree regularly so that Portage knows which software is added, which software released the security update, and so on.
Update Portage Tree
Usually we use the rsync command to update the Portage tree, which is a fast and incremental file Transfer tool. In addition the emerge command provides a fairly simple front end for the rsync command.
Code Listing 2.1: Updating the Portage tree |
# emerge--sync
|
You can still update the local portage tree by downloading a snapshot of the portage tree that we summarize daily, if you are unable to perform rsync operations due to firewall restrictions. The Emerge-webrsync command automatically downloads and installs the latest portage snapshot to your system.
Code Listing 2.2: Running Emerge-webrsync |
# Emerge-webrsync
|
1.c. Package Maintenance
Query for Software
To find the software that you refer to in the Portage tree, you can use the built-in search function in the emerge command. By default, Emerge--search returns packages whose names match the names you specify (either full or partial).
For example, to find the software that has the word "PDF" in its name:
Code Listing 3.1: Finding a package with a PDF name |
$ emerge--search PDF
|
You can use the--SEARCHDESC (or abbreviated-s) switch if you want to find the software by description of the software:
Code Listing 3.2: Finding PDF-related packages |
$ emerge--searchdesc PDF
|
When you look at the output, you'll notice that it provides a lot of information. Since the relevant areas have been clearly labeled, we will no longer further describe the meanings of each part:
Code 3.3: ' Emerge--search ' returns an example of the result |
* net-print/cups-pdf
Latest version available:1.5.2
Latest version installed: [Not installed]
Size of Downloaded files:15 kB
homepage: http://cip.physik.uni-wuerzburg.de/~vrbehr/cups-pdf/
Description: Provides a virtual printer for CUPS to produce PDF files.
License: GPL-2
|
Installation of software
Whenever you find a software that interests you, you can easily install it with the emerge command. For example, to install Gnumeric:
Code Listing 3.4: Installing Gnumeric |
# emerge Gnumeric
|
Because many applications depend on each other, attempting to install any of them may require the installation of other related software on which they depend. Without worrying, portage can handle dependencies between packages well. When you install a software, you can add the--pretend switch to see which software Portage will install at the same time. For example:
Code Listing 3.5: pretending to install Gnumeric |
# emerge--pretend Gnumeric
|
When you ask Portage to install a software, it will automatically download the appropriate source code package from the Internet and save it in the/usr/portage/distfiles directory by default, then unzip the source package, compile and install the software. If you only want portage to download the source packages locally without installing them, add the--fetchonly option after the emerge command:
Code Listing 3.6: Download the Gnumeric source code package |
# emerge--fetchonly Gnumeric
|
Find documents for installed software
Many packages contain their own documents, and sometimes Doc's use flags determine whether the self-contained documents in the package will be installed locally. You can check for the presence of the DOC use flag by EMERGE-VP < package name > command.
Code Listing 3.7: Checking for the presence of DOC's use flags |
(Of course alsa-lib is just an example.) )
# EMERGE-VP alsa-lib
[ebuild N ] media-libs/alsa-lib-1.0.14_rc1 -debug +doc 698 KB
|
The best way to enable Doc is to enable the packages you want to enable in/etc/portage/package.use, so you can only get the software documentation you want. Globally enabling this flag is known to cause circular dependencies. For more information, see the use sign chapter.
When a package is installed, its documentation is usually stored in a subdirectory named after the package name in the/usr/share/doc directory. You can also use the Equery tool to list all files generated by this software after installation, this tool comes from the App-portage/gentoolkit package.
Code Listing 3.8: Locating the package's documentation |
# ls-l/usr/share/doc/alsa-lib-1.0.14_rc1 Total
-rw-r--r-- 1 root root 669 (May) 21:54 changelog.gz
-rw-r--r-- 1 root root 9373 21:54 copying.gz
drwxr-xr-x 2 root root 8560 may 21:54 html
-RW -r--r-- 1 root root 196 may 21:54 todo.gz
(or use Equery to locate the file you are interested in:)
# equery Files Alsa-lib | less
media-libs/alsa-lib-1.0.14_rc1
* Contents of Media-libs/alsa-lib-1.0.14_rc1:/
usr
/usr/bin
/usr/bin/alsalisp
(Partial output)
|
Removal of software
Use the Emerge--unmerge command when you want to remove a package from the system. After the command is executed, Portage will remove all files installed on your system except those that you modified after installing the package. These modified profiles are retained to make it easier for you to use the same package again in the future.
However, it is important to note that Portage will not check if the package you are deleting is still dependent on the other packages. But when you want to delete an important package that might damage your system, it will still give you a warning.
Code Listing 3.9: Removing Gnumeric from the system |
# emerge--unmerge Gnumeric
|
When you remove a package from the system, the packages that were previously installed automatically to satisfy their dependencies will be retained. If you want portage to find the relevant packages that can now be removed, you can use the Emerge--depclean feature. We will talk about this later.
Update your system
To keep your system in top shape (not to mention installing those latest security updates), you need to update your system regularly. Because Portage can only check for ebuilds files that are already in the local portage tree, you should first update your portage tree. When your portage tree is updated, you can update the system with the Emerge--update World command. In the next example, we will also use the--ask switch to control portage display the list of packages it will update and let you decide whether to continue with the update.
Code Listing 3.10: Updating your system |
# Emerge--update--ask World
|
Portage will then look for a newer version of the package you have installed, but it will only check the packages that you have explicitly installed (that is, the packages listed in the/var/lib/portage/world file). It's not going to be complete. Check whether packages that are dependent on these software also need to be updated. If you want to update each package in your system, add the--deep parameter:
Code Listing 3.11: updating the entire system |
# Emerge--update--deep World
|
Because sometimes developers will launch security updates for packages that you don't explicitly require to install (but are loaded into the system by other packages), we recommend running this command occasionally.
You may need to add the--newuse option whenever you change any of the use flags in your system. This way portage will check whether the change in this use flag is causing the need to install a new package or recompile the existing package.
Code Listing 3.12: Performing a full update |
# emerge--update--deep--newuse World
|
Meta Packages
Some packages in the Portage tree do not contain any actual content, but are only used to install a collection of packages. For example, the KDE package is a collection of KDE-dependent, interdependent packages that you can install to build a complete KDE environment in your system.
If you attempt to remove a collection of such packages from the system, simply using the emerge--unmerge command does not fulfill your requirements because the dependencies of these packages remain in the system.
Don't worry, Portage also provides the ability to remove orphaned dependent packages, but because dependencies between packages are dynamic, you first need to fully update your entire system, including changes that result from changing use flag settings. After this you can run emerge--depclean to remove packages that are completely not dependent on other packages ("Orphaned dependencies"). After removal you will need to recompile those applications that have been dynamically connected to the packages that were just removed, because these programs do not actually require those packages.
All of these can be implemented with the following three commands:
Code Listing 3.13: Removing orphaned dependent packages |
# emerge--update--deep--newuse World
# emerge--depclean
# Revdep-rebuild
|
The Revdep-rebuild tool is provided by the Gentoolkit package; Don't forget to emerge it first before use:
Code Listing 3.14: Installing the Gentoolkit Package |
# emerge Gentoolkit
|
1.d. When Portage complained ...
About Slot,virtual, branching, architecture, and profile
As we noted earlier, Portage is a very powerful package management tool that supports many features that are missing from other similar tools. To understand this, we give you a rough explanation of some portage.
By using Portage, different versions of a software can coexist in a single system. Other distributions tend to include version numbers directly in the package name (for example, FreeType and Freetype2), and Gentoo's Portage uses a technique we call slots to achieve this coexistence. A ebuild declares an exact slot for its own version. Ebuild of the same software with different slots can coexist in the same system. For example, the FreeType package in the example above has a different ebuilds, with slot= "1" and slot= "2" respectively.
There are a few different packages that provide similar functionality. For example, METALOGD,SYSKLOGD and Syslog-ng are system logging tools. Programs that rely on the system logging tool do not rely on one of them, such as METALOGD, because other syslog tools may also be a good choice. Fortunately Portage allows the use of virtual packages: Each system logging tool can provide virtual/syslog packages, so applications can be set to rely solely on virtual/syslog.
The software in the portage tree can exist in different branches. Your system will only accept packages that Gentoo believes are stable by default. Most of the newly submitted software will be added to the Test branch. This means more testing is required before the software is marked as stable. Although you can see that the ebuilds of those software have been added to the Portage Tree, Portage will not install them until they are added to the stable branch.
Some software is available only on a few architectures. Or it is not possible to run in other architectures, or you still need to test it more, or the developer who submits the software to the Portage tree is not sure whether the software will run on other architectures.
Each Gentoo installation is attached to a certain profile, which contains a list of the packages required for a functioning system, in addition to other information.
Blocked packets
Code 4.1:portage warning about blocked packets (using the--pretend parameter) |
[Blocks B ] MAIL-MTA/SSMTP (is blocking MAIL-MTA/POSTFIX-2.2.2-R1)
|
Code 4.2:portage warning about blocked packets (do not use the--pretend parameter) |
!!! Error:the Mail-mta/postfix Package conflicts and another package.
!!! Both can ' t be installed on the same system together.
!!! Please use the ' emerge--pretend ' to determine blockers.
|
The Ebuilds file contains specific fields that provide portage with information about the various dependencies of the software. There are two possible dependencies for a total: A compilation dependency, a declaration in the depend region, and a runtime dependency that is declared in the Rdepend zone. If either of the two dependencies explicitly indicates that an entity or virtual package (which may already be installed and is being installed) is incompatible with the package to be installed, the installation of the software is blocked.
In order for the installation to continue, you can choose not to install the package or uninstall the conflicting package first. For example, in this example, you can choose not to install Postfix, or to uninstall SSMTP first.
You may also encounter cases where certain versions of packages are blocked, such as <media-video/mplayer-bin-1.0_rc1-r2. In this case, upgrading to an updated version will solve the problem.
It is also possible that two packages that need to be installed block each other. In this rare case, you should be clear about why you need to install them at the same time. Most of the time you just need to install one of them. If this is not the case, please submit a bug in the Gentoo bug tracking system so that we can find the solution.
Blocked packages
Code 4.3:portage warning about masked packets |
!!! All ebuilds that could satisfy "Bootsplash" has been masked.
|
Code 4.4:portage warning about masked packets-reason |
!!! possi BLE candidates is:-Gnome-base/gnome-2.8.0_pre1 (masked by: ~x86 keyword)-lm-sensors/lm-sensors-2.8.7 (masked by:-SP Arc keyword)-sys-libs/glibc-2.3.4.20040808 (masked by:-* keyword)-dev-util/cvsd-1.0.2 (Masked by:missing keyword)-
games-fps/unreal-tournament-451 (Masked By:package.mask)-sys-libs/glibc-2.3.2-r11 (Masked By:profile) |
When you want to install a package that is not available for your system. You will receive a masking error like this. You should try to install programs that are available to your system or wait for those that are unavailable to be available. Usually a package is blocked because: ~arch keyword means that the software is not fully tested and cannot enter a stable branch, please wait for a while before attempting to use it. -arch keyword or -* keyword means that the software does not work in the architecture of your machine. If you are sure it will work then please submit a bug report to our Bugzilla website. missing keyword means that the software has not been tested in the architecture of your machine. You can ask the appropriate architecture transplant team if it can be tested, or you will test them yourself and submit your findings to our Bugzilla website. Package.mask means that the software is considered to be corrupt, unstable, or more serious, and it is intentionally identified as "should not be used". profile means that the software does not apply to your profile. Installing such an application may damage your system or simply not be compatible with the profile you are using.
Dependency missing
Code 4.5:portage warnings about dependency misses |
Emerge:there is no ebuilds to satisfy ">=SYS-DEVEL/GCC-3.4.2-R4".
!!! Problem with ebuild SYS-DEVEL/GCC-3.4.2-R2
!!! Possibly a depend/*depend problem.
|
This means that the application you are trying to install depends on a few other packages that are not available to your system. Please go to Bugzilla to see if there is a record of this problem, if you do not find the relevant information, please submit a report. Unless your system mixes different branches, this kind of problem shouldn't happen, and if that happens, it's a bug.
meaning unknown ebuild name
Code 4.6:portage warning for unknown ebuild name |
!!! The short ebuild name "Aterm" is ambiguous. Please specify!!! One of the
following fully-qualified ebuild names instead:
dev-libs/aterm
x11-terms/ Aterm
|
The application you are installing corresponds to multiple packages with the same name. You need to specify the name of the category at the same time. Portage lists all the packages that can be selected for matching names.
Cyclic dependency
Code 4.7:portage warning about circular dependency issues |
!!! Error:circular dependencies:
ebuild/net-print/cups-1.1.15-r2 depends on ebuild/app-text/ghostscript-7.05.3-r1< C8/>EBUILD/APP-TEXT/GHOSTSCRIPT-7.05.3-R1 depends on EBUILD/NET-PRINT/CUPS-1.1.15-R2
|
Two (or more) packages that you want to install cannot be installed because of a cyclic dependency. This is probably due to a bug in the portage tree. Please wait a while before you try to install again. You can also go to bugzilla to see if there is a report for this issue, or to submit a report about it.
Download failed
Code 4.8:portage warning about download failure |
!!! Fetch failed for SYS-LIBS/NCURSES-5.4-R5, continuing ...
(...)
!!! Some fetch errors were encountered. Please see above for details.
|
When Portage downloads the source code for the specified software, it attempts to continue installing other (if applicable) applications. The source code download failure may originate from the mirror server not synchronizing correctly, or it may be because the Ebuild file gives the wrong download address. The server that saved the source code could also be a machine for some reason.
Try again after an hour to see if the problem persists.
System Profile Protection
Code 4.9:portage warning about packages protected in profile |
!!! Trying to Unmerge package (s) under System profile. ' Sys-apps/portage '
!!! This could is damaging to your system.
|
You require one of the system core packages to be removed. It is the required software listed in your profile and therefore cannot be removed from the system.
Digest validation Failure
Sometimes when you try to emerge a package, it fails and gives the following information:
Code 4.10:digest validation failed |
>>> checking ebuild checksums
!!! Digest Verification failed:
|
This is a sign of an error in the Portage tree, usually due to an error when the developer submits a package to the portage tree.
When the digest check fails, do not attempt to regenerate digest for this package yourself. Using ebuild foo manifest does not fix the problem, but almost certainly makes the problem worse.
Instead, wait for a two hours to allow the developer to fix the Portage tree. In general, errors are likely to be noticed by developers right away, but the portage tree repair also takes a little time. When you wait, go to bugzilla to see if someone has reported the problem. If not, submit a bug report for that damaged package.
Once you see this issue fixed on bugzilla, you only need to re-sync to download the repaired digest.
Important: But it is worth noting that this does not mean that you can repeat sync your portage tree (for the same rsync server) multiple times in a short period of time. As the rsync policy points out (when you run emerge--sync), those users who do multiple sync too often in a short period of time will be blocked by the update server (usually by adding your IP to the Prohibit list and retaining it for a specified period of time). In fact, it's best to wait until your next scheduled update, because you won't overload the Rsync server and affect the normal use of other users. |