| 1 |
<?xml version='1.0' encoding="UTF-8"?>
|
| 2 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/proj/en/portage/doc/manually-fixing-portage.xml,v 1.31 2013/03/19 16:19:10 zmedico Exp $ -->
|
| 3 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd" [
|
| 4 |
<!ENTITY stable_version "2.1.11.62">
|
| 5 |
]>
|
| 6 |
|
| 7 |
<guide>
|
| 8 |
|
| 9 |
<title>Manually fixing broken portage installations</title>
|
| 10 |
|
| 11 |
<author>
|
| 12 |
<mail link="genone@gentoo.org">Marius Mauch</mail>
|
| 13 |
</author>
|
| 14 |
|
| 15 |
<abstract>
|
| 16 |
This document attempts to help people to manually fix a broken sys-apps/portage
|
| 17 |
installation.
|
| 18 |
</abstract>
|
| 19 |
|
| 20 |
<!-- The content of this document is licensed under the CC-BY-SA license -->
|
| 21 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
|
| 22 |
<license/>
|
| 23 |
|
| 24 |
<version>0.3</version>
|
| 25 |
<date>2007-05-31</date>
|
| 26 |
|
| 27 |
<chapter>
|
| 28 |
<title>Manually fixing portage</title>
|
| 29 |
<section>
|
| 30 |
<title>Purpose</title>
|
| 31 |
<body>
|
| 32 |
|
| 33 |
<p>
|
| 34 |
This section will tell you how to manually update/fix your portage installation
|
| 35 |
in case you can't run <c>emerge sys-apps/portage</c>. While not hard it is
|
| 36 |
still to be done with great care, so please follow the listed steps exactly
|
| 37 |
(but apply common sense when necessary).
|
| 38 |
</p>
|
| 39 |
|
| 40 |
</body>
|
| 41 |
</section>
|
| 42 |
<section>
|
| 43 |
<title>Getting a portage tarball</title>
|
| 44 |
<body>
|
| 45 |
|
| 46 |
<p>
|
| 47 |
The first step to do is to get the tarball of a current portage version. In the
|
| 48 |
following text we will use <e>portage-&stable_version;</e> as an example (as this is the
|
| 49 |
current stable version at the time of this writing), please replace that with a
|
| 50 |
version present in the tree if possible.
|
| 51 |
</p>
|
| 52 |
|
| 53 |
<table>
|
| 54 |
<tr><th>Python Version</th><th>Portage Version</th></tr>
|
| 55 |
<tr>
|
| 56 |
<ti><= Python 2.5</ti>
|
| 57 |
<ti>
|
| 58 |
<uri link="http://distfiles.gentoo.org/distfiles/portage-2.1.6.tar.bz2">
|
| 59 |
portage-2.1.6.tar.bz2
|
| 60 |
</uri>
|
| 61 |
</ti>
|
| 62 |
</tr>
|
| 63 |
<tr>
|
| 64 |
<ti>>= Python 2.6</ti>
|
| 65 |
<ti>
|
| 66 |
<uri link="http://distfiles.gentoo.org/distfiles/portage-&stable_version;.tar.bz2">
|
| 67 |
portage-&stable_version;.tar.bz2
|
| 68 |
</uri>
|
| 69 |
</ti>
|
| 70 |
</tr>
|
| 71 |
</table>
|
| 72 |
|
| 73 |
<warn>
|
| 74 |
If your currently installed version of python reported by <c>python -V</c>
|
| 75 |
is less than 2.6 then you must choose a version of portage that is compatible with
|
| 76 |
it. If you have at least python 2.6 then use <e>portage-&stable_version;.tar.bz2</e>. If
|
| 77 |
you have python 2.4 or 2.5 then use <e>portage-2.1.6.tar.bz2</e>.
|
| 78 |
</warn>
|
| 79 |
|
| 80 |
<p>
|
| 81 |
Depending on the exact reason portage doesn't work for you anymore it may still
|
| 82 |
be possible to use it to fetch the tarball for you, so as a first step please
|
| 83 |
try to run <c>emerge --fetchonly sys-apps/portage</c>, only if that doesn't
|
| 84 |
work you have to manually fetch the tarball with:
|
| 85 |
</p>
|
| 86 |
|
| 87 |
<pre caption="Fetching portage tarball with wget">
|
| 88 |
# <i>wget -P /usr/portage/distfiles http://distfiles.gentoo.org/distfiles/portage-&stable_version;.tar.bz2</i>
|
| 89 |
</pre>
|
| 90 |
|
| 91 |
<p>
|
| 92 |
After that you should have the tarball available as
|
| 93 |
<path>/usr/portage/distfiles/portage-&stable_version;.tar.bz2</path>.
|
| 94 |
</p>
|
| 95 |
|
| 96 |
</body>
|
| 97 |
</section>
|
| 98 |
<section>
|
| 99 |
<title>Replacing the installed version</title>
|
| 100 |
<body>
|
| 101 |
|
| 102 |
<p>
|
| 103 |
The next step is to unpack the tarball to a temporary location, using
|
| 104 |
<path>/root/portage-recover</path> as example the commands to do that are:
|
| 105 |
</p>
|
| 106 |
|
| 107 |
<pre caption="Unpacking portage tarball">
|
| 108 |
# <i>cd /root</i>
|
| 109 |
# <i>mkdir portage-recover</i>
|
| 110 |
# <i>cd portage-recover</i>
|
| 111 |
# <i>tar xfj /usr/portage/distfiles/portage-&stable_version;.tar.bz2</i>
|
| 112 |
</pre>
|
| 113 |
|
| 114 |
<p>
|
| 115 |
After you have done this it's just a matter of replacing the python and bash
|
| 116 |
files of your existing installation with the ones from the tarball (in most
|
| 117 |
cases anyway). To do so please run:
|
| 118 |
</p>
|
| 119 |
|
| 120 |
<pre caption="Replacing installed files">
|
| 121 |
# <i>cd /root/portage-recover/portage-&stable_version;</i>
|
| 122 |
# <i>rm -rf /usr/lib/portage/*</i>
|
| 123 |
# <i>cp -R pym bin /usr/lib/portage/</i>
|
| 124 |
</pre>
|
| 125 |
|
| 126 |
<p>
|
| 127 |
If you are not using Gentoo on FreeBSD then you should remove the sed wrapper
|
| 128 |
script since it's not needed and it is known to cause problems with old
|
| 129 |
versions of bash:
|
| 130 |
</p>
|
| 131 |
|
| 132 |
<pre caption="Removing the sed wrapper script">
|
| 133 |
# <i>rm -f /usr/lib/portage/bin/sed</i>
|
| 134 |
</pre>
|
| 135 |
|
| 136 |
<note>
|
| 137 |
If you accidently unmerged portage before or lost
|
| 138 |
<path>/etc/make.globals</path> for other reasons you should also copy
|
| 139 |
<path>cnf/make.globals</path> back into <path>/etc</path>, otherwise
|
| 140 |
portage might behave in strange ways.
|
| 141 |
</note>
|
| 142 |
<note>
|
| 143 |
If the previous version of portage was less than 2.1 then you should now run
|
| 144 |
<c>emerge --metadata</c> before continuing to the next step. This is necessary
|
| 145 |
in order to convert the ebuild metadata to the new format that is used by
|
| 146 |
portage 2.1 and above. It is okay to run this command even if you are not sure
|
| 147 |
what the previous version of portage was.
|
| 148 |
</note>
|
| 149 |
|
| 150 |
<p>
|
| 151 |
Now you should have a working portage install again. To ensure a consistent
|
| 152 |
system state however you should now run <c>emerge sys-apps/portage</c> again
|
| 153 |
immediately.
|
| 154 |
</p>
|
| 155 |
|
| 156 |
<p>
|
| 157 |
If you get a <e>command not found</e> error message when you try to run
|
| 158 |
<c>emerge</c> you have to recreate the symlink:
|
| 159 |
</p>
|
| 160 |
|
| 161 |
<pre caption="Recreating the emerge symlink">
|
| 162 |
# <i>ln -sf ../lib/portage/bin/emerge /usr/bin/emerge</i>
|
| 163 |
</pre>
|
| 164 |
|
| 165 |
<p>
|
| 166 |
If these steps didn't work for you your problem is likely not a broken portage
|
| 167 |
installation but something else beyond the scope of this document. Please
|
| 168 |
recheck the <uri link="/proj/en/portage/doc/common-problems.xml">list of common
|
| 169 |
problems</uri> and also look in <uri
|
| 170 |
link="http://bugs.gentoo.org">bugzilla</uri> if the problem is reported there.
|
| 171 |
</p>
|
| 172 |
|
| 173 |
</body>
|
| 174 |
</section>
|
| 175 |
</chapter>
|
| 176 |
</guide>
|