# Upgrading with multiple ports repositories



## pgauret (Sep 18, 2019)

I am running a dual repository setup with FreeBSD-latests and a custom Synth repo. I noticed that when running `pkg upgrade`, even though my custom Synth repo has newer version of the packages available they are not upgraded. It appears this is only the case if the package was originally installed from the FreeBSD repo.

Reading the pkg man page, I found the CONSERVATIVE_UPGRADE option which seems to address exactly my need and allow a newer package version to be installed during an upgrade even if coming from a different repo. However setting  CONSERVATIVE_UPGRADE to false does not change `pkg upgrade` behaviour.

The workaround for now is to run `pkg upgrade -r Synth` which then upgrades to the newer version of the packages. Concern is that in the future a newer version of the upgraded packages may come from the FreeBSD repo and be ignored.

Am I missing something here? How are those of you with multiple repositories dealing with upgrades?

Output of my pkg config below if needed.


```
Version                 : 1.11.1
PKG_DBDIR = "/var/db/pkg";
PKG_CACHEDIR = "/var/cache/pkg";
PORTSDIR = "/usr/ports";
INDEXDIR = "";
INDEXFILE = "INDEX-12";
HANDLE_RC_SCRIPTS = true;
DEFAULT_ALWAYS_YES = false;
ASSUME_ALWAYS_YES = false;
REPOS_DIR [
    "/etc/pkg/",
    "/usr/local/etc/pkg/repos/",
]
PLIST_KEYWORDS_DIR = "";
SYSLOG = true;
ABI = "FreeBSD:12:amd64";
ALTABI = "freebsd:12:x86:64";
DEVELOPER_MODE = false;
VULNXML_SITE = "http://vuxml.freebsd.org/freebsd/vuln.xml.bz2";
FETCH_RETRY = 3;
PKG_PLUGINS_DIR = "/usr/local/lib/pkg/";
PKG_ENABLE_PLUGINS = true;
PLUGINS [
]
DEBUG_SCRIPTS = false;
PLUGINS_CONF_DIR = "/usr/local/etc/pkg/";
PERMISSIVE = false;
REPO_AUTOUPDATE = true;
NAMESERVER = "";
HTTP_USER_AGENT = "pkg/1.11.1";
EVENT_PIPE = "";
FETCH_TIMEOUT = 30;
UNSET_TIMESTAMP = false;
SSH_RESTRICT_DIR = "";
PKG_ENV {
}
PKG_SSH_ARGS = "";
DEBUG_LEVEL = 0;
ALIAS {
}
CUDF_SOLVER = "";
SAT_SOLVER = "";
RUN_SCRIPTS = true;
CASE_SENSITIVE_MATCH = false;
LOCK_WAIT = 1;
LOCK_RETRIES = 5;
SQLITE_PROFILE = false;
WORKERS_COUNT = 0;
READ_LOCK = false;
PLIST_ACCEPT_DIRECTORIES = false;
IP_VERSION = 0;
AUTOMERGE = true;
VERSION_SOURCE = "";
CONSERVATIVE_UPGRADE = true;
PKG_CREATE_VERBOSE = false;
AUTOCLEAN = false;
DOT_FILE = "";
REPOSITORIES {
}
VALID_URL_SCHEME [
    "pkg+http",
    "pkg+https",
    "https",
    "http",
    "file",
    "ssh",
    "ftp",
    "ftps",
    "pkg+ssh",
    "pkg+ftp",
    "pkg+ftps",
]
ALLOW_BASE_SHLIBS = false;
WARN_SIZE_LIMIT = 1048576;
METALOG = "";
OSVERSION = 1200086;
IGNORE_OSVERSION = false;


Repositories:
  FreeBSD: {
    url             : "pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
  Synth: {
    url             : "http://192.168.1.99/live_packages/",
    enabled         : yes,
    priority        : 10,
    mirror_type     : "HTTP",
    fingerprints    : "/usr/share/keys/pkg"
  }
```


----------



## Fightmilk (Apr 24, 2022)

Same problem, followed the same logic as you. Did you ever find a solution?


----------



## grahamperrin@ (Apr 24, 2022)

pgauret said:


> … pkg man page …



Maybe also set an integer for priority. 

pkg.conf(5), <https://www.freebsd.org/cgi/man.cgi...anpath=FreeBSD-Ports#REPOSITORY_CONFIGURATION> in particular. 

pkg-repository(5), <https://www.freebsd.org/cgi/man.cgi...eeBSD-Ports#WORKINGWITH_MULTIPLE_REPOSITORIES> in particular. 

FreeBSD bug 263537 – pkg.conf(5) refers to non-existent pkg-repository(8)


----------



## Fightmilk (Apr 25, 2022)

Thanks for the response Graham.

I can't speak for the OP, but I've tried setting a priority as well to no effect.

Let's take git for example. Git 2.36 was released in ports, but the package in latest hadn't been built yet as of a couple of days ago. I made two test repos with only the single git package in each. 

Repos looked like:
FreeBSD: git-2.35
Custom-1: git-2.35
Custom-2: git-2.36

Pkg upgrade will not upgrade to git 2.36, even with CONSERVATIVE_UPGRADE=false and FreeBSD repo given lower priority.

If the FreeBSD repo is disabled, pkg successfully marks git for upgrade.
If FreeBSD repo is disabled and git-2.35 is forcefully re-installed from the Custom-1 repository, now pkg upgrade exhibits the same behavior and will not mark git for upgrade.

I saw a previous post of yours with a similar issue:








						Solved - pkg-upgrade(8), CONSERVATIVE_UPGRADE and ports-mgmt/poudriere-devel 3.3.99.20210521
					

Below, why did pkg upgrade -f poudriere-devel not find the upgrade to 3.3.99.20210521?  root@mowa219-gjp4-8570p:~ # pkg info -x poudriere poudriere-devel-3.3.99.20210303_2 root@mowa219-gjp4-8570p:~ # pkg upgrade -f poudriere-devel Updating FreeBSD repository catalogue... FreeBSD repository is up...




					forums.freebsd.org
				



but in the few reports that I've seen, people seem to think it's not worth the effort to understand pkg's behavior, and the solution is to only enable one repo.


----------

