# Non-conservative pkg-upgrade(8)



## grahamperrin@ (Nov 25, 2021)

With higher priority given to my poudriere repository, why did `pkg upgrade` *not* find the upgrade to `virtualbox-ose`?


```
% pkg -vv | grep -i conservative
CONSERVATIVE_UPGRADE = false;
% pkg -vv | grep priority
    priority        : 3,
    priority        : 0,
    priority        : 4
% pkg -vv | grep enabled
    enabled         : yes,
    enabled         : no,
    enabled         : yes,
% pkg -vv | grep url
    url             : "pkg+http://pkg.FreeBSD.org/FreeBSD:14:amd64/latest",
    url             : "https://alpha.pkgbase.live/current/FreeBSD:14:amd64/latest",
    url             : "file:///usr/local/poudriere/data/packages/main-default",
% su -
Password:
root@mowa219-gjp4-8570p-freebsd:~ # pkg upgrade --quiet -n
The following 2 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        binutils: 2.37_1,1 -> 2.37_2,1 [poudriere]
        virtualbox-ose-kmod: 6.1.28_1 -> 6.1.30 [poudriere]

Number of packages to be upgraded: 2
root@mowa219-gjp4-8570p-freebsd:~ # pkg upgrade --quiet -n virtualbox-ose
root@mowa219-gjp4-8570p-freebsd:~ # pkg upgrade --quiet -n -r poudriere virtualbox-ose
The following 3 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        curl: 7.79.1 -> 7.80.0 [poudriere]
        virtualbox-ose: 6.1.28_1 -> 6.1.30 [poudriere]
        virtualbox-ose-kmod: 6.1.28_1 -> 6.1.30 [poudriere]

Number of packages to be upgraded: 3
root@mowa219-gjp4-8570p-freebsd:~ # exit
logout
% pkg info -x poudriere
poudriere-devel-3.3.99.20211017_2
% pkg info -x pkg
dpkg-1.19.7
octopkg-0.3.1
pkg-1.17.5
pkg-provides-0.7.1
pkg_tree-1.1_5
pkgconf-1.8.0,1
py38-fastest_pkg-0.1.2
% uname -aKU
FreeBSD mowa219-gjp4-8570p-freebsd 14.0-CURRENT FreeBSD 14.0-CURRENT #115 main-n250650-ef396441ceb: Sat Nov 13 23:52:09 GMT 2021     root@mowa219-gjp4-8570p-freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG  amd64 1400041 1400041
% date
Thu 25 Nov 2021 06:59:58 GMT
% man 3 pkg_repos

…

     pkg_repo_priority() takes a pointer to a repository as argument and
     returns the priority of the repository as an unsigned integer.  Packages
     ae chosed preferentially from the repository with the highest priority
     value and which has that package available.

…

% man 5 pkg.conf

…

     CONSERVATIVE_UPGRADE: boolean
                      Ensure in multi repository mode that the priority is
                      given as much as possible to the repository where a
                      package was first installed from.  Default: YES.

…

     Repositories are processed in the order they are found on the REPOS_DIR
     search path, with individual repository configuration files in the same
     directory processed in alphabetical order.  Settings from files later in
     the search path will override those from earlier ones.  Packages are
     selected preferentially out of all the repositories that contain them
     from the repository with the highest priority, so long as they are
     suitable to solve the necessary dependency requirements.  However, this
     preference may be overruled when CONSERVATIVE_UPGRADE is set to true, in
     which case a package will as far as possible always be upgraded from the
     same repository the older installed version came from, as given in the
     repository annotation of the installed package.  See pkg-repository(8)
     for details.

…

% su -
Password:
root@mowa219-gjp4-8570p-freebsd:~ # pkg upgrade -n
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating poudriere repository catalogue...
poudriere repository is up to date.
All repositories are up to date.
Checking for upgrades (33 candidates): 100%
Processing candidates (33 candidates): 100%
Checking integrity... done (0 conflicting)
The following 2 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        binutils: 2.37_1,1 -> 2.37_2,1 [poudriere]
        virtualbox-ose-kmod: 6.1.28_1 -> 6.1.30 [poudriere]

Number of packages to be upgraded: 2
root@mowa219-gjp4-8570p-freebsd:~ # pkg upgrade -n -r poudriere virtualbox-ose
Updating poudriere repository catalogue...
poudriere repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 3 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        curl: 7.79.1 -> 7.80.0 [poudriere]
        virtualbox-ose: 6.1.28_1 -> 6.1.30 [poudriere]
        virtualbox-ose-kmod: 6.1.28_1 -> 6.1.30 [poudriere]

Number of packages to be upgraded: 3
root@mowa219-gjp4-8570p-freebsd:~ # bectl list -c creation
BE                    Active Mountpoint Space Created
n250511-5f73b3338ee-c -      -          1.84M 2021-11-08 03:29
n250511-5f73b3338ee-d -      -          73.6M 2021-11-13 15:43
n250650-ef396441ceb-a NR     /          66.6G 2021-11-14 00:24
root@mowa219-gjp4-8570p-freebsd:~ # bectl destroy -o n250511-5f73b3338ee-c
root@mowa219-gjp4-8570p-freebsd:~ # bectl create n250650-ef396441ceb-b
root@mowa219-gjp4-8570p-freebsd:~ # bectl activate n250650-ef396441ceb-b
Successfully activated boot environment n250650-ef396441ceb-b
root@mowa219-gjp4-8570p-freebsd:~ # exit
logout
% exit
```


----------



## grahamperrin@ (Nov 25, 2021)

Side note: `CONSERVATIVE_UPGRADE` is not within the sample configuration. 


```
% grep -i conservative /usr/local/etc/pkg.conf.sample
%
```


----------

