Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

How to emerge --sync from a local partition?

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
9 posts • Page 1 of 1
Author
Message
DavePrince
n00b
n00b
Posts: 40
Joined: Mon Feb 20, 2006 11:59 am
Location: Cambridgeshire, UK

How to emerge --sync from a local partition?

  • Quote

Post by DavePrince » Tue Mar 06, 2007 10:57 pm

I have a mission critical gentoo system that although it need not always be powered up, must always be available for use. (Well, okay it's a MythTV box.)
But I do want to upgrade it and experiment from time to time, so I've given it two root partitions, written a little script to automatically mirror the master OS onto the spare partition (and tweak fstab etc.) and made it dual boot so that when there's nothing on I can boot into the mirror; emerge --sync and update world and test it on and off for a fortnight or so until I'm sure it's stable.
At this point I'm happy with the mirror and I want to update the master, but obviously doing an emerge --sync on the master may pull in untested changes since the mirror was synced.
I can easily sync the /usr/portage directory from the mirror to the master system, but I suspect that won't be enough. I need to separately invoke whetver it is that says "updating portage cache" at the end of an emerge --sync; and maybe some other stuff as well. How do I go about this?
Alternatively, is there a way to make the "emerge --sync" command sync from a local directory (/mirror/usr/portage) rather than an rsync server on the web?
Top
paulbiz
Guru
Guru
Posts: 508
Joined: Sun Feb 01, 2004 9:03 pm
Location: St. Louis, Missouri, USA

  • Quote

Post by paulbiz » Tue Mar 06, 2007 11:35 pm

Hi,

Check out http://gentoo-wiki.com/HOWTO_Local_Rsync_Mirror.
Top
hielvc
Advocate
Advocate
Posts: 2805
Joined: Fri Apr 19, 2002 5:55 pm
Location: Oceanside, Ca

  • Quote

Post by hielvc » Thu Mar 08, 2007 3:46 am

Your answer is to use

Code: Select all

#!/bin/bash
mount -t proc /proc proc
mount --bind /usr/portage usr/portage
mount --bind /home/distfiles usr/portage/distfiles
chroot . /bin/bash
The key is "mount --bind " which will mount, in a second or however many places you want /usr/portage. Becarefull I accid... I mean conducted an experiment where I deleted it in some mysterious way and lost all my freashly built packages, damnit ! When you do it this way , in my case a PII chroot, you run "emerge --metadata" to update the local cache. For my PII chroot I had to use a different locction for my packages. The host was athlon_xp or now a pentium4.

I build the PII system making packages and use binpkg or as what worked better just copied the packsges over to pII lappy. You wont have this problem. Boot your mission critical server, mount your test partion, then humm in your case just mount /mnt/test/usr/portage on or over the server /usr/portage. Update your metadata and emerge away.
An A-Z Index of the Linux BASH command line
Top
Akkara
Bodhisattva
Bodhisattva
User avatar
Posts: 6702
Joined: Tue Mar 28, 2006 12:27 pm
Location: &akkara

  • Quote

Post by Akkara » Thu Mar 08, 2007 7:19 am

Is your second root derived from an exact copy of your first (with fstab, etc tweaked)?

It might be quicker to write a second script using your first as a template, that mirrors your backup onto your main root and un-tweaks fstab, etc.

Make sure you look it over and check it well before use tho! :)
Top
DavePrince
n00b
n00b
Posts: 40
Joined: Mon Feb 20, 2006 11:59 am
Location: Cambridgeshire, UK

  • Quote

Post by DavePrince » Thu Mar 08, 2007 9:04 am

paulbiz wrote:Check out http://gentoo-wiki.com/HOWTO_Local_Rsync_Mirror.
I had noticed that a while back, but it didn't seem appropriate as it starts off with having two separate boxes. I've got two OSses but only the one box, but I suppose that I could try tweaking the instructions so thet the master system runs the rsync server configured to read from the mirror partition and then emerge --sync with SYNC="rsync://localhost/gentoo-portage".
I'll give this a try next update.
Top
DavePrince
n00b
n00b
Posts: 40
Joined: Mon Feb 20, 2006 11:59 am
Location: Cambridgeshire, UK

  • Quote

Post by DavePrince » Thu Mar 08, 2007 9:48 am

Akkara wrote:It might be quicker to write a second script using your first as a template, that mirrors your backup onto your main root and un-tweaks fstab, etc.
That had crossed my mind. Speed's not a great issue though - the machine has an Athlon64 3400 so recompiling a heap of packages already recompiled on the mirror is not too onerous.
Also there's stuff changing on the master partition over the period of testing on the mirror - most importantly the mythtv sql database - which it would be at best a pain to lose and at worst disasterous. An easier way to implement this would be to swap the designation of master and mirror and identify the changing things to copy from the old master to the new master; but that all seems just a bit too dangerous.
Top
isoflux
n00b
n00b
Posts: 3
Joined: Sat Mar 04, 2006 8:47 am

  • Quote

Post by isoflux » Thu Mar 08, 2007 9:45 pm

emerge --info lists the options that emerge --sync uses on its invocation of rsync. I've used that before to sync a second root on a single box without any major issues.
Top
hielvc
Advocate
Advocate
Posts: 2805
Joined: Fri Apr 19, 2002 5:55 pm
Location: Oceanside, Ca

  • Quote

Post by hielvc » Thu Mar 08, 2007 11:02 pm

I think your makeing this to hard. You only need one portage tree. If you keep your USE flags the same then you can use the packages from one on either. When I first posted I was thinking in terms of doing this in a chroot situation, which you could do but you dont need to. All you need to do is keep one portage in sync, be it on the server or your tester. If you had a partition where your portage tree was keep then you could just add it to the fstab of both. You would still need to run --metadata on the one that you werent syncing with.

In your situation though if you log into tester as root then add to your " .bashrc "

Code: Select all

mount /dev/where_server_is /mnt/server
mount /mnt/server/usr/portage /usr/portage || {echo "failed to mount /usr/portage" ; exit 1 }
emerge --metadata 
An A-Z Index of the Linux BASH command line
Top
DavePrince
n00b
n00b
Posts: 40
Joined: Mon Feb 20, 2006 11:59 am
Location: Cambridgeshire, UK

  • Quote

Post by DavePrince » Sat Mar 10, 2007 11:46 am

I already had /usr/portage/distfiles mounted on the common data partition and symlinked from both /usr/portages. I think I'll keep the actual portage trees separate though so that at any point in time both systems are self-consistent.
"emerge --metadata" was the little secret I was looking for, so my procedure for updating the master to the same level as the mirror looks like this:

Code: Select all

cd /usr
mount -o ro /dev/sda7 /mirror
# sda7 is the mirrored root partition
rsync -av --delete /mirror/usr/portage .
emerge --metedata
emerge -uD world
Cheers / thanks for the help.
Top
Post Reply

9 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic