1 |
Branko Badrljica <brankob@××××××××××.com> posted |
2 |
49FA4127.5060704@××××××××××.com, excerpted below, on Fri, 01 May 2009 |
3 |
02:24:07 +0200: |
4 |
|
5 |
> Question that comes to my mind is why isn't this implemented in portage |
6 |
> as it is as it's very useful tool. |
7 |
> |
8 |
> With it, one could take a disk from machine with hopelessly broken |
9 |
> system, connect it to good machine and reemerge broken packages, for |
10 |
> example. Or, say, emerge packages on fast machine and install them to |
11 |
> slow machine etc etc. |
12 |
|
13 |
Because, while there are certainly uses for the feature you described, |
14 |
there's really no need for it to do either of the above. Setting $ROOT |
15 |
before an emerge works just fine for the broken system case, and I've in |
16 |
fact used it for just that tho the details were slightly different than |
17 |
your scenario.[1] |
18 |
|
19 |
I'll be doing a variant of the emerge on a fast machine and install on a |
20 |
slow machine in a few months, when I finish a different project I'm |
21 |
working on, thus making room for an additional installation image on my |
22 |
main machine. The caveat in my case is that the main machine is a dual |
23 |
dual-core Opteron 290 running Gentoo/amd64, while I'll be creating a 32- |
24 |
bit Gentoo/x86 chroot image for my 32-bit x86 Atom based Acer Aspire One |
25 |
netbook. Thus, I won't be able to use the same packages and will have to |
26 |
create an entirely separate set, starting from a stage tarball in the x86 |
27 |
image just as if I were installing it natively to the amd64 machine, then |
28 |
doing an initial full image copy to the AA1, after which I'll emerge to |
29 |
the x86 image on the amd64, and emerge --pkgonly on the AA1/netbook. |
30 |
|
31 |
For that setting ROOT doesn't work quite as well, but after initial image |
32 |
installation, the slow machine can simply do an emerge --pkgonly with |
33 |
PKGDIR pointed at the appropriate x86 packages dir on the amd64 machine |
34 |
(if networked, on the thumbdrive I copied it to, otherwise). |
35 |
|
36 |
Thus in neither case is it necessary to be able to actually change the |
37 |
path they merge to, at least not relative to an already configurable |
38 |
ROOT, which provides sufficient flexibility for the above without the |
39 |
additional code necessary to manage what you are suggesting. |
40 |
|
41 |
Also note that since binpkgs are simply tarballs with some extra metadata |
42 |
(the ebuild and some other portage data, CHOST, etc) attached to the end |
43 |
using xpak, it's possible to use standard archiving tools to unpack |
44 |
either individual files or the entire package where desired. Of course, |
45 |
that's scriptable enough. |
46 |
|
47 |
..... |
48 |
|
49 |
[1] In my case, I keep two identically sized root partitions, labeled |
50 |
root and rootbak. Root contains all the paths portage installs to as |
51 |
well as the installed package database.[2] Periodically, when the system |
52 |
seems in reasonably stable operating condition and I've tested booting, |
53 |
portage, gcc, X, and KDE, at minimum, I'll clean-mkfs rootbak, mount |
54 |
--bind / somewhere else so I can easily copy everything on just that |
55 |
partition, mount rootbak, and do an archive-copy snapshot the working |
56 |
system just as it is to rootbak. That way, if anything ever goes wrong |
57 |
on my working LABEL=root, I can simply reboot to LABEL=rootbak and have a |
58 |
system in exactly the same working condition as it was when I took the |
59 |
snapshot. In the recovery situation alluded to a brand new ~arch bash |
60 |
version simply wasn't working on my normal root, so I couldn't boot to |
61 |
it. I simply booted to rootbak, and then used the rootbak's portage with |
62 |
ROOT= set to the mounted LABEL=root, to remerge --packageonly the last |
63 |
working bash binpkg to my the LABEL=root mount. While it's still the |
64 |
same machine, it's exactly the same procedure one would use to recover a |
65 |
broken machine by connecting its hard drive and mounting its root |
66 |
filesystem on a working machine, as you suggested. |
67 |
|
68 |
|
69 |
[2] I learned the keep-everything-portage-does in sync lesson the hard |
70 |
way, awhile back when I had a disk partially go bad and I ended up with |
71 |
the partitions for / (including /etc, /bin, /sbin, and /lib(64)), /usr |
72 |
(including its lib and (s)bin dirs as well as /usr/share), and /var |
73 |
(including the installed package database in /var/db/portage) being three |
74 |
different ages, so while I still had a system functional enough to get |
75 |
back in shape, portage had no idea what was actually installed and while |
76 |
I could remerge binpkgs to catchup, when it tried to cleanup the old |
77 |
versions it was trying to cleanup files that weren't there and leaving |
78 |
files that were. That left me having to go thru at least the bin and lib |
79 |
dirs with a for loop, doing an equery b for each binary, then removing |
80 |
the unclaimed ones. WHAT A MESS!! As I said, I learned my lesson, so |
81 |
now it's arranged so anything portage installs is on the same partition/ |
82 |
volume as the database saying what's installed, so it all stays in sync. |
83 |
|
84 |
|
85 |
|
86 |
-- |
87 |
Duncan - List replies preferred. No HTML msgs. |
88 |
"Every nonfree program has a lord, a master -- |
89 |
and if you use the program, he is your master." Richard Stallman |