Forums

Skip to content

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

repository/overlay sync-uri fallback?

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
Zucca
Moderator
Moderator
User avatar
Posts: 4679
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

repository/overlay sync-uri fallback?

  • Quote

Post by Zucca » Mon Jan 19, 2026 7:46 pm

I'm planning to set up a local mirror for all the repositories I tend to use. So mainly ::gentoo, ::guru and my own repository.

That's easy... for desktops or really any computer that's on my local network all the time. But with laptos that's not easily possible, unless I set up my own VPN. I'm not going to set that up, just yet at least...
To have, say laptop, be able to sync repos outside my local network, without editing appropriate repos.conf file, I'd need a some kind of fallback.

So. Is there a some kind of fallback mechanism for sync-uri?
..: Zucca :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2180
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

  • Quote

Post by pingtoo » Mon Jan 19, 2026 8:32 pm

I am curious why is that having a local cache copy of those ::gentoo, ::guru does not work in the laptop.

If the laptop configuration just like normal stage3 setup that just point to fetch from internet, this does not match your laptop workflow?
Top
Hu
Administrator
Administrator
Posts: 24380
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Mon Jan 19, 2026 8:38 pm

The laptop, like any ordinary Gentoo machine, will have a local copy of the repositories, for Portage to read. Zucca intends to sync those repositories from upstream on some schedule. As a performance optimization, that sync should pull from an on-LAN mirror if it is available (rather than going to the Internet), but he also wants it to transparently fall back to using the Internet-hosted copy if the LAN is unreachable.
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2180
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

  • Quote

Post by pingtoo » Mon Jan 19, 2026 8:57 pm

Hu wrote:The laptop, like any ordinary Gentoo machine, will have a local copy of the repositories, for Portage to read. Zucca intends to sync those repositories from upstream on some schedule. As a performance optimization, that sync should pull from an on-LAN mirror if it is available (rather than going to the Internet), but he also wants it to transparently fall back to using the Internet-hosted copy if the LAN is unreachable.
OK, thanks for information, so it is the source being different and wish to have way to selective choose source. understood now.
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2180
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

  • Quote

Post by pingtoo » Mon Jan 19, 2026 9:54 pm

One possible solution is use environment variable "PORTAGE_REPOSITORIES" However it not documented so using it have risk for future incompatibility.

Code: Select all

$ portageq envvar PORTAGE_REPOSITORIES

[DEFAULT]
auto-sync = yes
main-repo = gentoo
strict-misc-digests = true
sync-allow-hardlinks = true
sync-openpgp-key-refresh = true
sync-rcu = false
volatile = true

[gentoo]
auto-sync = yes
location = /var/db/repos/gentoo
masters = 
priority = -1000
strict-misc-digests = true
sync-allow-hardlinks = true
sync-openpgp-key-path = /usr/share/openpgp-keys/gentoo-release.asc
sync-openpgp-key-refresh = true
sync-openpgp-key-refresh-retry-count = 40
sync-openpgp-key-refresh-retry-delay-exp-base = 2
sync-openpgp-key-refresh-retry-delay-max = 60
sync-openpgp-key-refresh-retry-delay-mult = 4
sync-openpgp-key-refresh-retry-overall-timeout = 1200
sync-openpgp-keyserver = hkps://keys.gentoo.org
sync-rcu = false
sync-type = rsync
sync-uri = rsync://rsync.gentoo.org/gentoo-portage
volatile = false
sync-rsync-verify-metamanifest = yes
sync-rsync-extra-opts = 
sync-rsync-verify-jobs = 1
sync-rsync-verify-max-age = 3

Code: Select all

$ PORTAGE_REPOSITORIES="[gentoo]
> location = /var/db/repos/gentoo
> sync-type = rsync
> sync-uri = rsync://192.168.1.5/gentoo-portage" portageq envvar PORTAGE_REPOSITORIES
#
#------- output ---------
#
[DEFAULT]
auto-sync = yes
strict-misc-digests = true
sync-allow-hardlinks = true
sync-openpgp-key-refresh = true
sync-rcu = false
volatile = true

[gentoo]
auto-sync = yes
location = /var/db/repos/gentoo
masters = 
strict-misc-digests = true
sync-allow-hardlinks = true
sync-openpgp-key-refresh = true
sync-rcu = false
sync-type = rsync
sync-uri = rsync://192.168.1.5/gentoo-portage
volatile = false
sync-rsync-extra-opts = 

Code: Select all

$ PORTAGE_REPOSITORIES="[gentoo]
> location = /var/db/repos/gentoo
> sync-type = rsync
> sync-uri = rsync://192.168.1.5/gentoo-portage" emerge --info
#
#======== output ============
#
Portage 3.0.72 (python 3.13.9-final-0, !../../var/db/repos/gentoo/profiles/embedded, gcc-15, glibc-2.41-r6, 6.12.15-0-virt aarch64)
=================================================================
System uname: Linux-6.12.15-0-virt-aarch64-with-glibc2.41
KiB Mem:    12230792 total,   6248880 free
KiB Swap:    2097148 total,   2062200 free
Timestamp of repository gentoo: Wed, 14 Jan 2026 00:45:00 +0000
Head commit of repository gentoo: c04ef0e6f570c10e0d6936f2645be19704aca163
sh bash 5.3_p9
ld GNU ld (Gentoo 2.45.1 p1) 2.45.1
dev-build/autoconf:       2.72-r5::gentoo
dev-build/automake:       1.18.1::gentoo
dev-build/libtool:        2.5.4::gentoo
dev-lang/python:          3.13.9::gentoo, 3.14.0_p1::gentoo
sys-devel/binutils:       2.45.1::gentoo
sys-kernel/linux-headers: 6.12::gentoo (virtual/os-headers)
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://192.168.1.5/gentoo-portage
    volatile: False
    sync-rsync-extra-opts: 

Binary Repositories:

gentoobinhost
    priority: 1
    sync-uri: https://distfiles.gentoo.org/releases/arm64/binpackages/23.0/arm64

ACCEPT_KEYWORDS="arm64"
ACCEPT_LICENSE="@FREE"
CFLAGS="-O2 -pipe"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d"
CXXFLAGS="-O2 -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--nospinner --color n --root-deps=rdeps --quiet-build --verbose=n"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync merge-wait multilib-strict nodoc noinfo noman notitles parallel-fetch pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
PKGDIR="/var/cache/binpkgs"
PORTAGE_TMPDIR="/var/tmp"
USE="arm64 minimal multicall zlib" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LLVM_TARGETS="AArch64 BPF LoongArch M68k Mips PowerPC RISCV Sparc WebAssembly X86" PYTHON_SINGLE_TARGET="python3_13" PYTHON_TARGETS="python3_13" VIDEO_CARDS="fbdev"
Unset:  PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND
Top
b11n
Guru
Guru
User avatar
Posts: 301
Joined: Wed Mar 26, 2003 8:15 am
Location: New Zealand

  • Quote

Post by b11n » Mon Jan 19, 2026 10:14 pm

You might find it more elegant to do this at the network layer instead of the application layer.

You don't say what you're using to manage networking, but one idea might be to use a DNS alias to set sync-uri, and have your network manager point that alias to either your on-LAN mirror when you're home, and default to your preferred mirror on the internet otherwise.

The beauty of doing it this way is it can work with any DNS-based application that doesn't need to verify host identity (so no HTTPS)
Is there gas in the caaaaar?
Yes, there's gas in the caaaar
Top
Zucca
Moderator
Moderator
User avatar
Posts: 4679
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Tue Jan 20, 2026 7:56 am

b11n wrote:You might find it more elegant to do this at the network layer instead of the application layer.
Yeah.
I briefly thought about this too.
So far the least hacky approach.

Pingtoo's idea is the easiest to implement: just make an alias for it.
..: Zucca :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
Post Reply

7 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