View previous topic :: View next topic |
Author |
Message |
myart n00b
Joined: 20 Jun 2005 Posts: 4 Location: Tychy, Poland
|
Posted: Mon Jun 20, 2005 9:33 am Post subject: "cloning" an existing system |
|
|
Hello,
how can I clone an existing Gentoo installation? I mean a process after
which I will have a fully functional Gentoo system in a separate directory
which I am able to chroot into (like the one created by unpacking stage3
tarball). I tried the following method but it didn't work:
Code: | # mkdir newdir
# ROOT=newdir emerge system |
(emerge stops when merging pam)
Thanks. |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Mon Jun 20, 2005 10:31 am Post subject: |
|
|
No, that won't work - the necessary infrastructure isn't in place.
What you mean is not cloning, since that implies a complete copy of an existing system, which is easy.
Just designate a directory/mountpoint somewhere and do a complete install.
If you do want to clone your current setup search for the Stage 4 guide. _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
myart n00b
Joined: 20 Jun 2005 Posts: 4 Location: Tychy, Poland
|
Posted: Mon Jun 20, 2005 11:57 am Post subject: |
|
|
I don't want to create a stage4 copy because my system went dirty as
I manually modified the content of files in /etc, there might also be some
orphaned libraries and/or executables. I want to avoid transferring all that
rubbish to the newly created image. Is there a way of extracting a pure
stage3 from my current installation where all I have is a running Gentoo
system and a portage tree?
IMHO in this situation installing from the original stage3 seems to be not
very much in the Gentoo spirit |
|
Back to top |
|
|
drwook Veteran
Joined: 30 Mar 2005 Posts: 1324 Location: London
|
Posted: Mon Jun 20, 2005 1:37 pm Post subject: |
|
|
mkdir {whatever}
extract stage 3 tarball to {whatever}
mount -o bind /proc /{whatever}/proc
mount -o bind /usr/portage /{whatever}/usr/portage
cp /etc/resolv.conf /{whatever}/etc/resolv.conf
chroot /{whatever}
env-update
source /etc/profile
(edit your make.conf if appropriate)
emerge (whatever you want)
You could copy your world file & emerge world to get the same packages if you wanted to, but I wouldn't personally as it seems to be an exercise in removing cruft... This is just off the top of my head, but sounds like roughly what you're trying to achieve. |
|
Back to top |
|
|
myart n00b
Joined: 20 Jun 2005 Posts: 4 Location: Tychy, Poland
|
Posted: Mon Jun 20, 2005 4:24 pm Post subject: |
|
|
I think what you described is just a way of installing Gentoo from within another Linux distro, not necessarily Gentoo, using a previously downloaded stage3 tarball. What I'm trying to achieve is to produce a stage3-like full root ('/') directory, ready to chroot into, from within an existing Gentoo installation.
Besides the method described in my first post I also tried extracting the system to .tbz2 binary packages and then populating them in a new directory:
Code: |
for i in `emerge -ep system | grep \/ | cut -c 17-`
do quickpkg =$i
done
mkdir /newroot
for i in `ls /usr/portage/packages/All`
do ROOT=/newroot emerge --nodeps --usepkgonly $i
done
|
but the above method produces a broken system. |
|
Back to top |
|
|
slycordinator Advocate
Joined: 31 Jan 2004 Posts: 3065 Location: Korea
|
Posted: Mon Jun 20, 2005 6:54 pm Post subject: |
|
|
Of course that system you're creating is broken. During a regular install of gentoo you first unpacked a stage tarball. The stage tarball contains the directory structure and some utilities which are all essential for installing gentoo. You ABSOLUTELY MUST unpack a stage tarball onto that new path before doing all that.
But I think once you get that part working the rest should fall in place.
Though remember that you'll either have to copy /usr/portage from the old system to the new, unpack a portage snapshot, or run "emerge sync" in the new system because as it is the new partition will have an empty /usr/portage |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Tue Jun 21, 2005 1:25 pm Post subject: |
|
|
myart wrote: | I don't want to create a stage4 copy because my system went dirty as
I manually modified the content of files in /etc, there might also be some
orphaned libraries and/or executables. I want to avoid transferring all that
rubbish to the newly created image. |
Clear.
myart wrote: | Is there a way of extracting a pure stage3 from my current installation where all I have is a running Gentoo system and a portage tree? |
You're confused - there is no difference.
The only thing you can do from within your current - working but screwed - Gentoo installation is the exact same thing you would have to do from within any running Linux environment: extract a Stage tarball and build a new Gentoo system.
myart wrote: | IMHO in this situation installing from the original stage3 seems to be not
very much in the Gentoo spirit |
Actually, it is the only option you have. _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
myart n00b
Joined: 20 Jun 2005 Posts: 4 Location: Tychy, Poland
|
Posted: Wed Jun 22, 2005 7:52 am Post subject: |
|
|
adaptr wrote: |
The only thing you can do from within your current - working but screwed - Gentoo installation is the exact same thing you would have to do from within any running Linux environment: extract a Stage tarball and build a new Gentoo system.
|
I forgot to mention that my system, although seems to be "dirty", is still able to reproduce itself, i.e. "emerge -e world" works.
Therefore I am pretty sure there must be a way of extracting a clean stage3-like enviroment from it. |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Wed Jun 22, 2005 10:53 am Post subject: |
|
|
Well, maybe, but that was my point: the closest thing to a "clean, stage-3 like environment" is... a Stage 3 tarball.
If you are including any packages merged after a Stage 3 then by definition you are not talking about a Stage 3.
Determining which parts can be salvaged from your completed system may be more trouble than it is worth. _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
drwook Veteran
Joined: 30 Mar 2005 Posts: 1324 Location: London
|
Posted: Wed Jun 22, 2005 11:49 am Post subject: |
|
|
I think I must be missing something here, but just in case I'm not...
You want to extract the files and directories that would be in a stage 3 tarball, but you want them from your "dirty" system rather than a tarball.
1/ why would you want to risk carrying any of the 'dirtiness' over to your new system
2/ What advantage do you see in NOT taking these files from a tarball (this is what's confusing me the most)
3/ If this is regarding having to update a few system packages, what in the tarball takes more than a few minutes to recompile a new version of?
I'm assuming you're running ~arch and want the 'unstable' gcc & glibc, right? If so, I think you can use a utility called something like quickpkg(?) to create a binary package of them & install them from that.
Whatever way you look at it, I'd be extracting a stage 3 tarball though. |
|
Back to top |
|
|
slycordinator Advocate
Joined: 31 Jan 2004 Posts: 3065 Location: Korea
|
Posted: Thu Jun 23, 2005 5:33 am Post subject: |
|
|
Like I said before what you should probably do is:
1) Download the stage3 tarball for whichever processor you're using.
2) mount the new partition
3) unpack the tarball to that partition
4) unpack the latest portage tree snapshot onto the new partition (you can avoid this step by doing "emerge sync" once you've booted the new system but that'll take longer I think in the long-run).
5) run the script you described before.
Then you can continue as usual with
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=7 |
|
Back to top |
|
|
NewBlackDak Guru
Joined: 02 Nov 2003 Posts: 512 Location: Utah County, UT
|
Posted: Thu Aug 04, 2005 4:54 pm Post subject: |
|
|
slycordinator wrote: | Like I said before what you should probably do is:
1) Download the stage3 tarball for whichever processor you're using.
2) mount the new partition
3) unpack the tarball to that partition
4) unpack the latest portage tree snapshot onto the new partition (you can avoid this step by doing "emerge sync" once you've booted the new system but that'll take longer I think in the long-run).
5) run the script you described before.
Then you can continue as usual with
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=7 |
What's with the script? Why not chroot to the new dir/partition, and follow the install guide?
That's all your doing when you install from cd(installing one linux from another).
If you want things like your home directory in the new install just copy them over before chrooting.
Copy your world, and make.conf over aswell. _________________ Gentoo systems.
X2 4200+@2.6 - Athy
X2 3600+ - Myth
UltraSparc5 440 - sparcy |
|
Back to top |
|
|
slycordinator Advocate
Joined: 31 Jan 2004 Posts: 3065 Location: Korea
|
Posted: Thu Aug 04, 2005 6:37 pm Post subject: |
|
|
NewBlackDak wrote: |
What's with the script? Why not chroot to the new dir/partition, and follow the install guide?
That's all your doing when you install from cd(installing one linux from another).
If you want things like your home directory in the new install just copy them over before chrooting.
Copy your world, and make.conf over aswell. |
If he chroots to the new directory and follows the install guide that will require compiling the new system (at some point he'll run "emerge -e system"). But since all the stuff created by "emerge -e system" already exists on his current box all he needs to do is make binary packages of them and install in the new partition using those packages.
That'll be MUCH faster than just following the install guide. |
|
Back to top |
|
|
BlinkEye Veteran
Joined: 21 Oct 2003 Posts: 1046 Location: Gentoo Forums
|
Posted: Tue Jan 24, 2006 8:50 pm Post subject: Re: "cloning" an existing system |
|
|
myart wrote: | Hello,
how can I clone an existing Gentoo installation? I mean a process after
which I will have a fully functional Gentoo system in a separate directory
which I am able to chroot into (like the one created by unpacking stage3
tarball). I tried the following method but it didn't work:
Code: | # mkdir newdir
# ROOT=newdir emerge system |
(emerge stops when merging pam)
Thanks. |
take a look at https://forums.gentoo.org/viewtopic-t-312817-postdays-0-postorder-asc-start-0.html . it does exactly that. _________________ Easily backup up your system? klick
Get rid of SSH Brute Force Attempts / Script Kiddies klick |
|
Back to top |
|
|
|