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