1 |
Steve Herber <herber@×××××.com> posted |
2 |
Pine.LNX.4.64.0802282342530.26122@×××××.com, excerpted below, on Fri, 29 |
3 |
Feb 2008 00:05:46 -0800: |
4 |
|
5 |
> I had a slightly different revdep-rebuild problem[.] |
6 |
|
7 |
> I could not find the weird -MERGING-mythtv packages. I did remember |
8 |
> having an emerge problem with MythTV when I first started to try it. |
9 |
|
10 |
> [I finally found it in] /var/db/pkg/media-tv. |
11 |
> |
12 |
> In the directory media-tv were subdirectories with the -MERGING name. I |
13 |
> removed all the directories in media-tv and reran revdep-rebuild and all |
14 |
> was well. |
15 |
|
16 |
As you likely figured out, /var/db/pkg/ is portage's merged package |
17 |
database. |
18 |
|
19 |
As a bit of background, portage tries to work as safely with the system |
20 |
as possible, leaving as little time for a crash to affect system |
21 |
stability as possible. Thus, it does all its compiling and a "fake |
22 |
install" to a temp location (PORTAGE_TMPDIR in make.conf, /var/tmp/ by |
23 |
default, with it adding the portage subdir to wherever the setting |
24 |
points, so normally /var/tmp/portage/), before doing the final qmerge |
25 |
step that merges everything from the fake location to the live filesystem. |
26 |
|
27 |
Of course, as portage does that final qmerge it also has to add the |
28 |
package information to the system database in /var/db/pkg/. Again, in |
29 |
ordered to minimize damage risk as much as possible, and to make it easy |
30 |
to correct the damage if something /does/ go wrong, portage initially |
31 |
creates and works in a tempdir in its package database, naming it |
32 |
MERGING- and the package name and version. It then does the copy from |
33 |
the fake-install into the live filesystem as fast as possible, before |
34 |
finally renaming the temporary package database dir, removing the |
35 |
MERGING- prefix. |
36 |
|
37 |
Thus, any MERGING-* entries in the database indicate partially merged |
38 |
packages. Portage or the entire system crashed during the critical |
39 |
qmerge phase, and the merge wasn't able to complete. It's wise to pay |
40 |
particular attention to such entries, as not only do they take up space |
41 |
in the database, but they indicate partially merged packages, some files |
42 |
of which are likely stuck in limbo on the live filesystem, orphaned in |
43 |
the incomplete qmerge step, not working and what's worse, very possibly |
44 |
triggering other system issues. These other issues could range from the |
45 |
revdep-rebuild issues you noted, to conflicting configurations (tho |
46 |
that's not likely due to portage's config-protect features), to build |
47 |
complications for other packages due to them picking up the wrong |
48 |
versions of files, to security issues if someone can manage to run stale |
49 |
binaries or link in stale libraries with known vulnerabilities, because |
50 |
neither the package manager nor the sysadmin really realizes those |
51 |
potentially vulnerable files are still there! |
52 |
|
53 |
Thus, it's important to properly clean up such partially merged packages |
54 |
when you find them. Fortunately, if you go back and try merging the same |
55 |
package over again, portage will cleanup after itself. Since that's what |
56 |
probably happens in the majority of cases, those MERGING entries are |
57 |
normally relatively temporary and cause no real problems. However, if |
58 |
the sysadmin decides to try a different version or simply gives up on |
59 |
whatever he was trying to merge, THEN there's the potential complications |
60 |
mentioned above, and a good Gentoo sysadmin will take the necessary steps |
61 |
to clean things up manually. |
62 |
|
63 |
Properly cleaning up is *NOT*, however, as simple as just deleting the |
64 |
MERGING-* entries in the package database. Rather, if the package can't |
65 |
be merged even if it'll be immediately unmerged (this is often simplest |
66 |
when possible, as the cleanup is then automatic), one must manually check |
67 |
to see if any of the files listed in the MERGING-* dir actually exist on |
68 |
the main filesystem. If they do, one should then run a query (equery |
69 |
belongs, or similar using your tool of choice) against the portage |
70 |
database to ensure no other merged packages (as might be the case if a |
71 |
different version was successfully merged) own the file in question, and |
72 |
if not delete it (or if one is extra careful, move it elsewhere for |
73 |
awhile to see if anything complains, just in case... as I said, sometimes |
74 |
other packages will have detected and built against the wrong version if |
75 |
it is still around due to a failed merge, they'll need rebuilt, but it |
76 |
can be useful to be able to move the file back if necessary until you can |
77 |
get the rebuild done). |
78 |
|
79 |
So, you removed the MERGING-* temporary database entry, but did you |
80 |
ensure any files it listed weren't still around causing trouble on your |
81 |
live filesystem? That's supposed to be done first, so you know exactly |
82 |
which files to check. However, if you missed doing that, you can usually |
83 |
do the check anyway, tho at the cost of more hassle and risk of missing |
84 |
something. In this case, again assuming the stale version is no longer |
85 |
in portage or otherwise can't be merged and unmerged, thus automating the |
86 |
process, the idea would be to check another version of the package, |
87 |
seeing what files it has, and that you don't have other orphaned versions |
88 |
of the same files still around. Again, be sure to equery belongs |
89 |
anything that you find, before just removing it, just to be sure. |
90 |
|
91 |
FWIW... the above is from experience... I had unstable hardware at one |
92 |
point, and unfortunately ended up with a bit of experience cleaning up |
93 |
such messes. I also ended up at one point with a portage database that |
94 |
didn't match what I had actually installed, due to an emergency rescue of |
95 |
a failing disk -- the backups I had of one part of the system didn't |
96 |
match the backups of a different part, didn't match the parts of the |
97 |
system I was able to successfully recover. =8^( Now THAT was a MESS to |
98 |
clean up! (Since then, I've made it a point to keep all the areas |
99 |
portage merges files to on the same partition and same backup as the |
100 |
package database. Thus, if I lose my working system, when I recover, the |
101 |
entire installed system and package database will be in sync, all from |
102 |
the same date when I did the backup, so if I get lazy and let the backup |
103 |
get old and stale, at least it'll all be the SAME staleness!) |
104 |
|
105 |
Hope that helps! =8^) |
106 |
|
107 |
-- |
108 |
Duncan - List replies preferred. No HTML msgs. |
109 |
"Every nonfree program has a lord, a master -- |
110 |
and if you use the program, he is your master." Richard Stallman |
111 |
|
112 |
-- |
113 |
gentoo-amd64@l.g.o mailing list |