# pkg upgrade



## ankscorek (Jan 12, 2015)

Hi friends,

I used `portmaster` to upgrade ports. Recently I switched to pkg(8).

However it is not updating.


```
# pkg version -v -l'<'
Thunar-1.6.4  <  needs updating (index has 1.6.4_1)
cantarell-fonts-0.0.15  <  needs updating (index has 0.0.16)
curl-7.39.0_1  <  needs updating (index has 7.40.0)
dri-9.1.7_6,2  <  needs updating (index has 10.4.0,2)
ffmpeg-2.3.5_4,1  <  needs updating (index has 2.3.6,1)
flac-1.3.0_4  <  needs updating (index has 1.3.1)
fluxbox-1.3.5_2  <  needs updating (index has 1.3.6)
freetype2-2.5.4_1  <  needs updating (index has 2.5.5)
iso-codes-3.56  <  needs updating (index has 3.57)
libevent2-2.0.21_3  <  needs updating (index has 2.0.22)
libx264-0.142.2455_1  <  needs updating (index has 0.142.2455_2)
orc-0.4.22  <  needs updating (index has 0.4.23)
pciids-20150101  <  needs updating (index has 20150105)
speex-1.2.r1_7,1  <  needs updating (index has 1.2.r2,1)

# pkg update
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.

# pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking for upgrades (244 candidates): 100%
Processing candidates (244 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.
```

As can be seen there are updates available but `pkg` says all are up-to-date.


----------



## ljboiler (Jan 12, 2015)

You must be careful about what `pkg` is using for the version comparisons.  I'm guessing you have a local ports tree since you were previously using `portmaster`.  When it's comparing against a local ports tree that is current (updated via `portsnap` or SVN), you will see what you are seeing because the port(s) has been updated but the package(s) in the repository that `pkg upgrade` will fetch have not been rebuilt; that happens one a week, starting on Wednesday from what I've read.

Use  `pkg version -R ...` to ignore the local ports tree and check directly against the package repository.


----------



## ankscorek (Jan 12, 2015)

Can you please explain it further?


----------



## SirDice (Jan 12, 2015)

There's a difference between `pkg version -vR` and `pkg version -vI`. The first checks against the remote repository, the latter compares against your ports tree. As packages are only built once a week it's entirely possible your local ports tree will have newer version than the remote repository.


----------



## ankscorek (Jan 13, 2015)

SirDice said:


> There's a difference between `pkg version -vR` and `pkg version -vI`. The first checks against the remote repository, the latter compares against your ports tree. As packages are only built once a week it's entirely possible your local ports tree will have newer version than the remote repository.



`pkg version -vI` is reporting certain indexes need to be updated.

```
libebml-1.3.1  =  up-to-date with index
libevent2-2.0.21_3  <  needs updating (index has 2.0.22)
libexif-0.6.21_3  =  up-to-date with index
libexo-0.10.2_5  =  up-to-date with index
libffi-3.2.1  =  up-to-date with index
```

Just a snippet. There are more such entries.What is my next step to update these?

`pkg version -vR` reports something like


```
libglapi-10.4.0  >  succeeds remote (remote has 9.1.7_2)
libgnome-keyring-3.12.0_2  =  up-to-date with remote
libgpg-error-1.17  =  up-to-date with remote
libgphoto2-2.5.5.1  =  up-to-date with remote
```

This is just a snippet.


----------



## kpa (Jan 13, 2015)

That's because you're using the official packages that can be about one week behind the ports tree. It also looks like you have built some of the installed ports yourself. If you were building your own packages without using the official packages you wouldn't see any discrepancy between the versions.


----------



## uzsolt (Jan 13, 2015)

You can create an alias into /usr/local/etc/pkg.conf to list (binary) upgradable packages.


----------



## ankscorek (Jan 14, 2015)

kpa said:


> That's because you're using the official packages that can be about one week behind the ports tree. It also looks like you have built some of the installed ports yourself. If you were building your own packages without using the official packages you wouldn't see any discrepancy between the versions.





uzsolt said:


> You can create an alias into /usr/local/etc/pkg.conf to list (binary) upgradable packages.



How to resolve these inconsistencies?


----------



## uzsolt (Jan 14, 2015)

It isn't "solution" to your "problem" (there isn't inconsistency), only a small help: you don't need type `pkg version -vRl '<'` - it's enough to type (for example) `pkg upgradable`.
Sorry if I was equivocal.


----------



## ankscorek (Jan 14, 2015)

I use this to check for updates

```
#!/bin/sh
/usr/sbin/portsnap fetch update && \
/usr/local/sbin/portmaster -L --index-only | egrep '(ew|ort) version|total install'

echo -n "Last update: "
date -r `pkg query %t | sort | tail -n1` "+%Y%m%d"
```

This is what I get


```
Building new INDEX files... done.
   ===>>> New version available: freetype2-2.5.5
   ===>>> New version available: libevent2-2.0.22
   ===>>> New version available: libx264-0.142.2455_2
   ===>>> New version available: libyaml-0.1.6_2
   ===>>> New version available: orc-0.4.23
   ===>>> New version available: pciids-20150105
   ===>>> New version available: Thunar-1.6.4_1
   ===>>> New version available: cantarell-fonts-0.0.16
   ===>>> New version available: curl-7.40.0
   ===>>> New version available: dri-10.4.0,2
   ===>>> New version available: ffmpeg-2.3.6,1
   ===>>> New version available: flac-1.3.1
   ===>>> New version available: iso-codes-3.57
   ===>>> New version available: speex-1.2.r2,1
   ===>>> New version available: xcb-util-0.4.0,1
   ===>>> New version available: xcb-util-keysyms-0.4.0
   ===>>> New version available: firefox-35.0,1
   ===>>> New version available: fluxbox-1.3.6
   ===>>> New version available: slock-1.2
===>>> 486 total installed ports
   ===>>> 19 have new versions available
Last update: 20150111


root@noname:/home # pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking for upgrades (242 candidates): 100%
Processing candidates (242 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.
```

If there are updates available then why isn't `pkg upgrade` working or what am I missing?


----------



## SirDice (Jan 14, 2015)

ankscorek said:


> If there are updates available then why isn't `pkg upgrade` working or what am I missing?


The portmaster command you used compares versions against your /usr/ports/INDEX-*. As I said previously, the ports tree may be newer, it's constantly updated. Packages are only built once a week. So it's possible a port has been updated already but the package for it hasn't been built yet.

For example:

Monday: no updates; port A is at version 0.1, port B is at version 1.0.
Tuesday: port A updated to version 0.2
Wednesday: packages are build. Package A is version 0.2; Package B is version 1.0.
Thursday: Port B is updated to version 1.1.
Friday; Port A is version 0.2; Port B is version 1.1; Package A is version 0.2; Package B is version 1.0.

So, on Friday, if you check against INDEX (ports tree) package B would show as needing an update. A pkg-upgrade(8) however says everything is up to date as there's no new package B yet.


----------



## uzsolt (Jan 14, 2015)

ankscorek: why do you want to use the ports tree if you want switch to pkg? If you want binary, pre-built packages you don't need to use `portsnap` and `portmaster`, only need to run sometimes (every thursday or friday) `pkg update && pkg upgrade`. And you can check upgradable packages with `pkg version -Rl '<'`.
The ports tree and the database of packages ("repository") are different.


----------



## ankscorek (Jan 15, 2015)

I guess this cleared the fog in my mind..


----------

