Contents of /xml/htdocs/doc/en/handbook/hb-working-portage.xml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.64 - (show annotations) (download) (as text)
Thu Aug 23 22:31:14 2007 UTC (11 years, 7 months ago) by nightmorph
Branch: MAIN
Changes since 1.63: +4 -4 lines
File MIME type: application/xml
removed all references to ati-gatos from the docs, as per drac's treecleaners last rites email. the gatos code has been merged into xorg's codebase. for the portage handbook p.mask example, replaced ati-gatos with a package that will actually stay in the tree. yay for unreal tournament\!

1 <?xml version='1.0' encoding='UTF-8'?>
2 <!DOCTYPE sections SYSTEM "/dtd/book.dtd">
4 <!-- The content of this document is licensed under the CC-BY-SA license -->
5 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
7 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-portage.xml,v 1.63 2007/03/25 23:58:47 nightmorph Exp $ -->
9 <sections>
11 <abstract>
12 This chapter explains the "simple" steps a user definitely needs to know to
13 maintain the software on his system.
14 </abstract>
16 <version>1.58</version>
17 <date>2007-08-23</date>
19 <section>
20 <title>Welcome to Portage</title>
21 <body>
23 <p>
24 Portage is probably Gentoo's most notable innovation in software management.
25 With its high flexibility and enormous amount of features it is frequently seen
26 as the best software management tool available for Linux.
27 </p>
29 <p>
30 Portage is completely written in <uri link="http://www.python.org">Python</uri>
31 and <uri link="http://www.gnu.org/software/bash">Bash</uri> and therefore fully
32 visible to the users as both are scripting languages.
33 </p>
35 <p>
36 Most users will work with Portage through the <c>emerge</c> tool. This chapter
37 is not meant to duplicate the information available from the emerge man page.
38 For a complete rundown of emerge's options, please consult the man page:
39 </p>
41 <pre caption="Reading the emerge man page">
42 $ <i>man emerge</i>
43 </pre>
45 </body>
46 </section>
47 <section>
48 <title>The Portage Tree</title>
49 <subsection>
50 <title>Ebuilds</title>
51 <body>
53 <p>
54 When we talk about packages, we often mean software titles that are available to
55 the Gentoo users through the Portage tree. The Portage tree is a collection of
56 <e>ebuilds</e>, files that contain all information Portage needs to maintain
57 software (install, search, query, ...). These ebuilds reside in
58 <path>/usr/portage</path> by default.
59 </p>
61 <p>
62 Whenever you ask Portage to perform some action regarding software titles, it
63 will use the ebuilds on your system as a base. It is therefore important that
64 you regularly update the ebuilds on your system so Portage knows about new
65 software, security updates, etc.
66 </p>
68 </body>
69 </subsection>
70 <subsection>
71 <title>Updating the Portage Tree</title>
72 <body>
74 <p>
75 The Portage tree is usually updated with <uri
76 link="http://rsync.samba.org/">rsync</uri>, a fast incremental file transfer
77 utility. Updating is fairly simple as the <c>emerge</c> command provides a
78 front-end for rsync:
79 </p>
81 <pre caption="Updating the Portage tree">
82 # <i>emerge --sync</i>
83 </pre>
85 <p>
86 If you are unable to rsync due to firewall restrictions you can still update
87 your Portage tree by using our daily generated Portage tree snapshots. The
88 <c>emerge-webrsync</c> tool automatically fetches and installs the latest
89 snapshot on your system:
90 </p>
92 <pre caption="Running emerge-webrsync">
93 # <i>emerge-webrsync</i>
94 </pre>
96 </body>
97 </subsection>
98 </section>
99 <section>
100 <title>Maintaining Software</title>
101 <subsection>
102 <title>Searching for Software</title>
103 <body>
105 <p>
106 To search through the Portage tree after software titles, you can use
107 <c>emerge</c> built-in search capabilities. By default, <c>emerge --search</c>
108 returns the names of packages whose title matches (either fully or partially)
109 the given search term.
110 </p>
112 <p>
113 For instance, to search for all packages who have "pdf" in their name:
114 </p>
116 <pre caption="Searching for pdf-named packages">
117 $ <i>emerge --search pdf</i>
118 </pre>
120 <p>
121 If you want to search through the descriptions as well you can use the
122 <c>--searchdesc</c> (or <c>-S</c>) switch:
123 </p>
125 <pre caption="Searching for pdf-related packages">
126 $ <i>emerge --searchdesc pdf</i>
127 </pre>
129 <p>
130 When you take a look at the output, you'll notice that it gives you a lot of
131 information. The fields are clearly labelled so we won't go further into their
132 meanings:
133 </p>
135 <pre caption="Example 'emerge --search' output">
136 * net-print/cups-pdf
137 Latest version available: 1.5.2
138 Latest version installed: [ Not Installed ]
139 Size of downloaded files: 15 kB
140 Homepage: http://cip.physik.uni-wuerzburg.de/~vrbehr/cups-pdf/
141 Description: Provides a virtual printer for CUPS to produce PDF files.
142 License: GPL-2
143 </pre>
145 </body>
146 </subsection>
147 <subsection>
148 <title>Installing Software</title>
149 <body>
151 <p>
152 Once you've found a software title to your liking, you can easily install it
153 with <c>emerge</c>: just add the package name. For instance, to install
154 <c>gnumeric</c>:
155 </p>
157 <pre caption="Installing gnumeric">
158 # <i>emerge gnumeric</i>
159 </pre>
161 <p>
162 Since many applications depend on each other, any attempt to install a certain
163 software package might result in the installation of several dependencies as
164 well. Don't worry, Portage handles dependencies well. If you want to find out
165 what Portage <e>would</e> install when you ask it to install a certain package,
166 add the <c>--pretend</c> switch. For instance:
167 </p>
169 <pre caption="Pretend to install gnumeric">
170 # <i>emerge --pretend gnumeric</i>
171 </pre>
173 <p>
174 When you ask Portage to install a package, it will download the necessary source
175 code from the internet (if necessary) and store it by default in
176 <path>/usr/portage/distfiles</path>. After this it will unpack, compile and
177 install the package. If you want Portage to only download the sources without
178 installing them, add the <c>--fetchonly</c> option to the <c>emerge</c> command:
179 </p>
181 <pre caption="Download the sourcecode for gnumeric">
182 # <i>emerge --fetchonly gnumeric</i>
183 </pre>
185 </body>
186 </subsection>
187 <subsection>
188 <title>Finding Installed Package Documentation</title>
189 <body>
191 <p>
192 Many packages come with their own documentation. Sometimes, the <c>doc</c> USE
193 flag determines whether the package documentation should be installed or not.
194 You can check the existence of a <c>doc</c> USE flag with the <c>emerge -vp
195 &lt;package name&gt;</c> command.
196 </p>
198 <pre caption="Checking the existence of a doc USE flag">
199 <comment>(alsa-lib is just an example, of course.)</comment>
200 # <i>emerge -vp alsa-lib</i>
201 [ebuild N ] media-libs/alsa-lib-1.0.14_rc1 -debug +doc 698 kB
202 </pre>
204 <p>
205 You can enable or disable the <c>doc</c> USE flag either globally in the
206 <path>/etc/make.conf</path> file or per package in the
207 <path>/etc/portage/package.use</path> file. The <uri
208 link="?part=2&amp;chap=2">USE Flags</uri> chapter covers this aspect in detail.
209 </p>
211 <p>
212 Once the package installed, its documentation is generally found in a
213 subdirectory named after the package under the <path>/usr/share/doc</path>
214 directory. You can also list all installed files with the <c>equery</c> tool
215 which is part of the <c>app-portage/gentoolkit</c> <uri
216 link="/doc/en/gentoolkit.xml">package</uri>.
217 </p>
219 <pre caption="Locating package documentation">
220 # <i>ls -l /usr/share/doc/alsa-lib-1.0.14_rc1</i>
221 total 28
222 -rw-r--r-- 1 root root 669 May 17 21:54 ChangeLog.gz
223 -rw-r--r-- 1 root root 9373 May 17 21:54 COPYING.gz
224 drwxr-xr-x 2 root root 8560 May 17 21:54 html
225 -rw-r--r-- 1 root root 196 May 17 21:54 TODO.gz
227 <comment>(Alternatively, use equery to locate interesting files:)</comment>
228 # <i>equery files alsa-lib | less</i>
229 media-libs/alsa-lib-1.0.14_rc1
230 * Contents of media-libs/alsa-lib-1.0.14_rc1:
231 /usr
232 /usr/bin
233 /usr/bin/alsalisp
234 <comment>(Output truncated)</comment>
235 </pre>
237 </body>
238 </subsection>
239 <subsection>
240 <title>Removing Software</title>
241 <body>
243 <p>
244 When you want to remove a software package from your system, use <c>emerge
245 --unmerge</c>. This will tell Portage to remove all files installed by that
246 package from your system <e>except</e> the configuration files of that
247 application if you have altered those after the installation. Leaving the
248 configuration files allows you to continue working with the package if you ever
249 decide to install it again.
250 </p>
252 <p>
253 However, a <brite>big warning</brite> applies: Portage will <e>not</e> check if
254 the package you want to remove is required by another package. It will however
255 warn you when you want to remove an important package that breaks your system
256 if you unmerge it.
257 </p>
259 <pre caption="Removing gnumeric from the system">
260 # <i>emerge --unmerge gnumeric</i>
261 </pre>
263 <p>
264 When you remove a package from your system, the dependencies of that package
265 that were installed automatically when you installed the software are left. To
266 have Portage locate all dependencies that can now be removed, use
267 <c>emerge</c>'s <c>--depclean</c> functionality. We will talk about this later
268 on.
269 </p>
271 </body>
272 </subsection>
273 <subsection>
274 <title>Updating your System</title>
275 <body>
277 <p>
278 To keep your system in perfect shape (and not to mention install the latest
279 security updates) you need to update your system regularly. Since Portage only
280 checks the ebuilds in your Portage tree you first have to update your Portage
281 tree. When your Portage tree is updated, you can update your system with
282 <c>emerge --update world</c>. In the next example, we'll also use the
283 <c>--ask</c> switch which will tell Portage to display the list of packages it
284 wants to upgrade and ask you if you want to continue:
285 </p>
287 <pre caption="Updating your system">
288 # <i>emerge --update --ask world</i>
289 </pre>
291 <p>
292 Portage will then search for newer version of the applications you have
293 installed. However, it will only verify the versions for the applications you
294 have <e>explicitly</e> installed (the applications listed in
295 <path>/var/lib/portage/world</path>) - it does not thoroughly check their
296 dependencies. If you want to update <e>every single package</e> on your system,
297 add the <c>--deep</c> argument:
298 </p>
300 <pre caption="Updating your entire system">
301 # <i>emerge --update --deep world</i>
302 </pre>
304 <p>
305 Since security updates also happen in packages you have not explicitly installed
306 on your system (but that are pulled in as dependencies of other programs), it
307 is recommended to run this command once in a while.
308 </p>
310 <p>
311 If you have altered any of your <uri link="?part=2&amp;chap=2">USE flags</uri>
312 lately you might want to add <c>--newuse</c> as well. Portage will then verify
313 if the change requires the installation of new packages or recompilation of
314 existing ones:
315 </p>
317 <pre caption="Performing a full update">
318 # <i>emerge --update --deep --newuse world</i>
319 </pre>
321 </body>
322 </subsection>
323 <subsection>
324 <title>Metapackages</title>
325 <body>
327 <p>
328 Some packages in the Portage tree don't have any real content but are used to
329 install a collection of packages. For instance, the <c>kde</c> package will
330 install a complete KDE environment on your system by pulling in various
331 KDE-related packages as dependencies.
332 </p>
334 <p>
335 If you ever want to remove such a package from your system, running <c>emerge
336 --unmerge</c> on the package won't have much effect as the dependencies remain
337 on the system.
338 </p>
340 <p>
341 Portage has the functionality to remove orphaned dependencies as well, but since
342 the availability of software is dynamically dependent you first need to update
343 your entire system fully, including the new changes you applied when changing
344 USE flags. After this you can run <c>emerge --depclean</c> to remove the
345 orphaned dependencies. When this is done, you need to rebuild the applications
346 that were dynamically linked to the now-removed software titles but don't
347 require them anymore.
348 </p>
350 <p>
351 All this is handled with the following three commands:
352 </p>
354 <pre caption="Removing orphaned dependencies">
355 # <i>emerge --update --deep --newuse world</i>
356 # <i>emerge --depclean</i>
357 # <i>revdep-rebuild</i>
358 </pre>
360 <p>
361 <c>revdep-rebuild</c> is provided by the <c>gentoolkit</c> package; don't forget
362 to emerge it first:
363 </p>
365 <pre caption="Installing the gentoolkit package">
366 # <i>emerge gentoolkit</i>
367 </pre>
369 </body>
370 </subsection>
371 </section>
372 <section>
373 <title>When Portage is Complaining...</title>
374 <subsection>
375 <title>About SLOTs, Virtuals, Branches, Architectures and Profiles</title>
376 <body>
378 <p>
379 As we stated before, Portage is extremely powerful and supports many features
380 that other software management tools lack. To understand this, we explain a few
381 aspects of Portage without going into too much detail.
382 </p>
384 <p>
385 With Portage different versions of a single package can coexist on a system.
386 While other distributions tend to name their package to those versions (like
387 <c>freetype</c> and <c>freetype2</c>) Portage uses a technology called
388 <e>SLOT</e>s. An ebuild declares a certain SLOT for its version. Ebuilds with
389 different SLOTs can coexist on the same system. For instance, the
390 <c>freetype</c> package has ebuilds with <c>SLOT="1"</c> and <c>SLOT="2"</c>.
391 </p>
393 <p>
394 There are also packages that provide the same functionality but are implemented
395 differently. For instance, <c>metalogd</c>, <c>sysklogd</c> and <c>syslog-ng</c>
396 are all system loggers. Applications that rely on the availability of "a system
397 logger" cannot depend on, for instance, <c>metalogd</c>, as the other system
398 loggers are as good a choice as any. Portage allows for <e>virtuals</e>: each
399 system logger provides <c>virtual/syslog</c> so that applications can depend on
400 <c>virtual/syslog</c>.
401 </p>
403 <p>
404 Software in the Portage tree can reside in different branches. By default your
405 system only accepts packages that Gentoo deems stable. Most new software titles,
406 when committed, are added to the testing branch, meaning more testing needs to
407 be done before it is marked as stable. Although you will see the ebuilds for
408 those software in the Portage tree, Portage will not update them before they are
409 placed in the stable branch.
410 </p>
412 <p>
413 Some software is only available for a few architectures. Or the software doesn't
414 work on the other architectures, or it needs more testing, or the developer that
415 committed the software to the Portage tree is unable to verify if the package
416 works on different architectures.
417 </p>
419 <p>
420 Each Gentoo installation adheres to a certain <c>profile</c> which contains,
421 amongst other information, the list of packages that are required for a system
422 to function normally.
423 </p>
425 </body>
426 </subsection>
427 <subsection id="blocked">
428 <title>Blocked Packages</title>
429 <body>
431 <pre caption="Portage warning about blocked packages (with --pretend)">
432 [blocks B ] mail-mta/ssmtp (is blocking mail-mta/postfix-2.2.2-r1)
433 </pre>
435 <pre caption="Portage warning about blocked packages (without --pretend)">
436 !!! Error: the mail-mta/postfix package conflicts with another package.
437 !!! both can't be installed on the same system together.
438 !!! Please use 'emerge --pretend' to determine blockers.
439 </pre>
441 <p>
442 Ebuilds contain specific fields that inform Portage about its dependencies.
443 There are two possible dependencies: build dependencies, declared in
444 <c>DEPEND</c> and run-time dependencies, declared in <c>RDEPEND</c>. When one of
445 these dependencies explicitly marks a package or virtual as being <e>not</e>
446 compatible, it triggers a blockage.
447 </p>
449 <p>
450 To fix a blockage, you can choose to not install the package or unmerge the
451 conflicting package first. In the given example, you can opt not to install
452 <c>postfix</c> or to remove <c>ssmtp</c> first.
453 </p>
455 <p>
456 You may also see blocking packages with specific atoms, such as
457 <b>&lt;</b>media-video/mplayer-bin-1.0_rc1-r2. In this case, updating to a more
458 recent version of the blocking package would remove the block.
459 </p>
461 <p>
462 It is also possible that two packages that are yet to be installed are blocking
463 each other. In this rare case, you should find out why you need to install both.
464 In most cases you can do with one of the packages alone. If not, please file a
465 bug on <uri link="http://bugs.gentoo.org">Gentoo's bugtracking system</uri>.
466 </p>
468 </body>
469 </subsection>
470 <subsection id="masked">
471 <title>Masked Packages</title>
472 <body>
474 <pre caption="Portage warning about masked packages">
475 !!! all ebuilds that could satisfy "bootsplash" have been masked.
476 </pre>
478 <pre caption="Portage warning about masked packages - reason">
479 !!! possible candidates are:
481 - gnome-base/gnome-2.8.0_pre1 (masked by: <i>~x86 keyword</i>)
482 - lm-sensors/lm-sensors-2.8.7 (masked by: <i>-sparc keyword</i>)
483 - sys-libs/glibc- (masked by: <i>-* keyword</i>)
484 - dev-util/cvsd-1.0.2 (masked by: <i>missing keyword</i>)
485 - games-fps/unreal-tournament-451 (masked by: <i>package.mask</i>)
486 - sys-libs/glibc-2.3.2-r11 (masked by: <i>profile</i>)
487 </pre>
489 <p>
490 When you want to install a package that isn't available for your system, you
491 will receive this masking error. You should try installing a different
492 application that is available for your system or wait until the package is put
493 available. There is always a reason why a package is masked:
494 </p>
496 <ul>
497 <li>
498 <b>~arch keyword</b> means that the application is not tested sufficiently
499 to be put in the stable branch. Wait a few days or weeks and try again.
500 </li>
501 <li>
502 <b>-arch keyword</b> or <b>-* keyword</b> means that the application does
503 not work on your architecture. If you believe the package does work file
504 a bug at our <uri link="http://bugs.gentoo.org">bugzilla</uri> website.
505 </li>
506 <li>
507 <b>missing keyword</b> means that the application has not been tested on
508 your architecture yet. Ask the architecture porting team to test the package
509 or test it for them and report your findings on our <uri
510 link="http://bugs.gentoo.org">bugzilla</uri> website.
511 </li>
512 <li>
513 <b>package.mask</b> means that the package has been found corrupt, unstable
514 or worse and has been deliberately marked as do-not-use.
515 </li>
516 <li>
517 <b>profile</b> means that the package has been found not suitable for your
518 profile. The application might break your system if you installed it or is
519 just not compatible with the profile you use.
520 </li>
521 </ul>
523 </body>
524 </subsection>
525 <subsection id="missingdependencies">
526 <title>Missing Dependencies</title>
527 <body>
529 <pre caption="Portage warning about missing dependency">
530 emerge: there are no ebuilds to satisfy "&gt;=sys-devel/gcc-3.4.2-r4".
532 !!! Problem with ebuild sys-devel/gcc-3.4.2-r2
533 !!! Possibly a DEPEND/*DEPEND problem.
534 </pre>
536 <p>
537 The application you are trying to install depends on another package that is not
538 available for your system. Please check <uri
539 link="http://bugs.gentoo.org">bugzilla</uri> if the issue is known and if not,
540 please report it. Unless you are mixing branches this should not occur and is
541 therefore a bug.
542 </p>
544 </body>
545 </subsection>
546 <subsection id="ambiguousebuild">
547 <title>Ambiguous Ebuild Name</title>
548 <body>
550 <pre caption="Portage warning about ambiguous ebuild names">
551 !!! The short ebuild name "aterm" is ambiguous. Please specify
552 !!! one of the following fully-qualified ebuild names instead:
554 dev-libs/aterm
555 x11-terms/aterm
556 </pre>
558 <p>
559 The application you want to install has a name that corresponds with more than
560 one package. You need to supply the category name as well. Portage will inform
561 you of possible matches to choose from.
562 </p>
564 </body>
565 </subsection>
566 <subsection id="circulardependencies">
567 <title>Circular Dependencies</title>
568 <body>
570 <pre caption="Portage warning about circular dependencies">
571 !!! Error: circular dependencies:
573 ebuild / net-print/cups-1.1.15-r2 depends on ebuild / app-text/ghostscript-7.05.3-r1
574 ebuild / app-text/ghostscript-7.05.3-r1 depends on ebuild / net-print/cups-1.1.15-r2
575 </pre>
577 <p>
578 Two (or more) packages you want to install depend on each other and can
579 therefore not be installed. This is most likely a bug in the Portage tree.
580 Please resync after a while and try again. You can also check <uri
581 link="http://bugs.gentoo.org">bugzilla</uri> if the issue is known and if not,
582 report it.
583 </p>
585 </body>
586 </subsection>
587 <subsection id="fetchfailed">
588 <title>Fetch failed</title>
589 <body>
591 <pre caption="Portage warning about fetch failed">
592 !!! Fetch failed for sys-libs/ncurses-5.4-r5, continuing...
593 <comment>(...)</comment>
594 !!! Some fetch errors were encountered. Please see above for details.
595 </pre>
597 <p>
598 Portage was unable to download the sources for the given application and will
599 try to continue installing the other applications (if applicable). This failure
600 can be due to a mirror that has not synchronised correctly or because the ebuild
601 points to an incorrect location. The server where the sources reside can also be
602 down for some reason.
603 </p>
605 <p>
606 Retry after one hour to see if the issue still persists.
607 </p>
609 </body>
610 </subsection>
611 <subsection id="profileprotect">
612 <title>System Profile Protection</title>
613 <body>
615 <pre caption="Portage warning about profile-protected package">
616 !!! Trying to unmerge package(s) in system profile. 'sys-apps/portage'
617 !!! This could be damaging to your system.
618 </pre>
620 <p>
621 You have asked to remove a package that is part of your system's core packages.
622 It is listed in your profile as required and should therefore not be removed
623 from the system.
624 </p>
626 </body>
627 </subsection>
628 <subsection id="digesterror">
629 <title>Digest Verification Failures</title>
630 <body>
632 <p>
633 Sometimes, when you attempt to emerge a package, it will fail with the message:
634 </p>
636 <pre caption="Digest verification failure">
637 &gt;&gt;&gt; checking ebuild checksums
638 !!! Digest verification failed:
639 </pre>
641 <p>
642 This is a sign that something is wrong with the Portage tree -- often, it is
643 because a developer may have made a mistake when committing a package to the
644 tree.
645 </p>
647 <p>
648 When the digest verification fails, do <e>not</e> try to re-digest the package
649 yourself. Running <c>ebuild foo digest</c> will not fix the problem; it will
650 almost certainly make it worse!
651 </p>
653 <p>
654 Instead, wait an hour or two for the tree to settle down. It's likely that the
655 error was noticed right away, but it can take a little time for the fix to
656 trickle down the Portage tree. While you're waiting, check <uri
657 link="http://bugs.gentoo.org">Bugzilla</uri> and see if anyone has reported
658 the problem yet. If not, go ahead and file a bug for the broken package.
659 </p>
661 <p>
662 Once you see that the bug has been fixed, you may want to re-sync to pick up
663 the fixed digest.
664 </p>
666 <impo>
667 This does <e>not</e> mean that you can re-sync your tree multiple times! As
668 stated in the rsync policy (when you run <c>emerge --sync</c>), users who sync
669 too often will be banned! In fact, it's better to just wait until your next
670 scheduled sync, so that you don't overload the rsync servers.
671 </impo>
673 </body>
674 </subsection>
675 </section>
676 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20