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.11 2007/10/15 20:56:00 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 |
<note>A script to automate the following procedure is available |
39 |
<uri link="http://dev.gentoo.org/~genone/scripts/get_portage_back.sh">here</uri>. |
40 |
</note> |
41 |
|
42 |
</body> |
43 |
</section> |
44 |
<section> |
45 |
<title>Getting a portage tarball</title> |
46 |
<body> |
47 |
|
48 |
<p> |
49 |
The first step to do is to get the tarball of a current portage version. In the |
50 |
following text we will use <e>portage-2.1.1</e> as an example (as this is the |
51 |
current stable version at the time of this writing), please replace that with a |
52 |
version present in the tree if possible. |
53 |
</p> |
54 |
<warn> |
55 |
If your currently installed version of python reported by <c>python -V</c> |
56 |
is less than 2.4 then you must choose a version of portage that is compatible with |
57 |
it. If you have at least python 2.3 then use <e>portage-2.1.1.tar.bz2</e>. If |
58 |
you have python 2.2 then use <e>portage-2.0.51.22.tar.bz2</e>. |
59 |
</warn> |
60 |
|
61 |
<p> |
62 |
Depending on the exact reason portage doesn't work for you anymore it may still |
63 |
be possible to use it to fetch the tarball for you, so as a first step please |
64 |
try to run <c>emerge --fetchonly sys-apps/portage</c>, only if that doesn't |
65 |
work you have to manually fetch the tarball with: |
66 |
</p> |
67 |
|
68 |
<pre caption="Fetching portage tarball with wget"> |
69 |
# <i>wget -P /usr/portage/distfiles http://distfiles.gentoo.org/distfiles/portage-2.1.1.tar.bz2</i> |
70 |
</pre> |
71 |
|
72 |
<p> |
73 |
After that you should have the tarball available as |
74 |
<path>/usr/portage/distfiles/portage-2.1.1.tar.bz2</path>. |
75 |
</p> |
76 |
|
77 |
</body> |
78 |
</section> |
79 |
<section> |
80 |
<title>Replacing the installed version</title> |
81 |
<body> |
82 |
|
83 |
<p> |
84 |
The next step is to unpack the tarball to a temporary location, using |
85 |
<path>/root/portage-recover</path> as example the commands to do that are: |
86 |
</p> |
87 |
|
88 |
<pre caption="Unpacking portage tarball"> |
89 |
# <i>cd /root</i> |
90 |
# <i>mkdir portage-recover</i> |
91 |
# <i>cd portage-recover</i> |
92 |
# <i>tar xfj /usr/portage/distfiles/portage-2.1.1.tar.bz2</i> |
93 |
</pre> |
94 |
|
95 |
<p> |
96 |
After you have done this it's just a matter of replacing the python and bash |
97 |
files of your existing installation with the ones from the tarball (in most |
98 |
cases anyway). To do so please run: |
99 |
</p> |
100 |
|
101 |
<pre caption="Replacing installed files"> |
102 |
# <i>cd /root/portage-recover/portage-2.1.1</i> |
103 |
# <i>cp -R pym bin /usr/lib/portage/</i> |
104 |
</pre> |
105 |
|
106 |
<p> |
107 |
If you are not using Gentoo on FreeBSD then you should remove the sed wrapper |
108 |
script since it's not needed and it is known to cause problems with old |
109 |
versions of bash: |
110 |
</p> |
111 |
|
112 |
<pre caption="Removing the sed wrapper script"> |
113 |
# <i>rm -f /usr/lib/portage/bin/sed</i> |
114 |
</pre> |
115 |
|
116 |
<note> |
117 |
If you accidently unmerged portage before or lost |
118 |
<path>/etc/make.globals</path> for other reasons you should also copy |
119 |
<path>cnf/make.globals</path> back into <path>/etc</path>, otherwise |
120 |
portage might behave in strange ways. |
121 |
</note> |
122 |
<note> |
123 |
If the previous version of portage was less than 2.1 then you should now run |
124 |
<c>emerge --metadata</c> before continuing to the next step. This is necessary |
125 |
in order to convert the ebuild metadata to the new format that is used by |
126 |
portage 2.1 and above. It is okay to run this command even if you are not sure |
127 |
what the previous version of portage was. |
128 |
</note> |
129 |
|
130 |
<p> |
131 |
Now you should have a working portage install again. To ensure a consistent |
132 |
system state however you should now run <c>emerge sys-apps/portage</c> again |
133 |
immediately. |
134 |
</p> |
135 |
|
136 |
<p> |
137 |
If you get a <e>command not found</e> error message when you try to run |
138 |
<c>emerge</c> you have to recreate the symlink: |
139 |
</p> |
140 |
|
141 |
<pre caption="Recreating the emerge symlink"> |
142 |
# <i>ln -s ../lib/portage/bin/emerge /usr/bin/emerge</i> |
143 |
</pre> |
144 |
|
145 |
<p> |
146 |
If these steps didn't work for you your problem is likely not a broken portage |
147 |
installation but something else beyond the scope of this document. Please |
148 |
recheck the <uri link="/proj/en/portage/doc/common-problems.xml">list of common |
149 |
problems</uri> and also look in <uri |
150 |
link="http://bugs.gentoo.org">bugzilla</uri> if the problem is reported there. |
151 |
</p> |
152 |
|
153 |
</body> |
154 |
</section> |
155 |
</chapter> |
156 |
</guide> |